Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(user-notification): Firebase Credentials Setup for Local Development #17199

Merged
merged 13 commits into from
Dec 13, 2024

Conversation

rafnarnason
Copy link
Member

@rafnarnason rafnarnason commented Dec 11, 2024

Fixes these types of strings for local development env.secret file so the app runs locally without manual edits to the env value

Before:

export FIREBASE_CREDENTIALS='{\n "type": "service_account",\n "project_id":

After:

export FIREBASE_CREDENTIALS='{
...
"type": "service_account",
"project_id": "mobile-app",
...
}'

Attach a link to issue if relevant

What

Specify what you're trying to achieve

Why

Specify why you need to achieve this

Screenshots / Gifs

Attach Screenshots / Gifs to help reviewers understand the scope of the pull request

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Formatting passes locally with my changes
  • I have rebased against main before asking for a review

Summary by CodeRabbit

  • Bug Fixes
    • Improved the escaping of secret values in console logs for better display of environment variables.

@rafnarnason rafnarnason requested review from a team as code owners December 11, 2024 11:20
Copy link
Contributor

coderabbitai bot commented Dec 11, 2024

Walkthrough

The changes involve modifications to the renderSecrets function within the infra/src/cli/render-secrets.ts file. The primary alteration is the updated logic for escaping secret values before logging, specifically replacing single quotes with their escaped version. The error handling in the renderSecretsCommand function remains unchanged, and no new functionality has been introduced or removed.

Changes

File Change Summary
infra/src/cli/render-secrets.ts Modified renderSecrets function to escape single quotes in secret values before logging. Error handling in renderSecretsCommand remains unchanged.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant Logger

    User->>CLI: Execute renderSecrets command
    CLI->>Logger: Process secret values
    Logger-->>CLI: Escape single quotes
    CLI->>Logger: Log escaped secret values
    Logger-->>User: Display logged values
Loading

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Experiment)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@rafnarnason rafnarnason changed the title feat(user-notification): Dev-init and envs feat(user-notification): Firebase Credentials Setup for Local Development Dec 11, 2024
@datadog-island-is
Copy link

datadog-island-is bot commented Dec 11, 2024

Datadog Report

All test runs eec121d 🔗

98 Total Test Services: 0 Failed, 90 Passed
🔻 Test Sessions change in coverage: 3 decreased, 1 increased (+0.04%), 196 no change

Test Services
This report shows up to 10 services
Service Name Failed Known Flaky New Flaky Passed Skipped Total Time Code Coverage Change Test Service View
air-discount-scheme-backend 0 0 0 63 0 15.84s N/A Link
air-discount-scheme-web 0 0 0 2 0 7.48s N/A Link
api 0 0 0 4 0 3.15s N/A Link
api-catalogue-services 0 0 0 23 0 12.61s N/A Link
api-domains-air-discount-scheme 0 0 0 6 0 19.73s N/A Link
api-domains-assets 0 0 0 3 0 12.44s N/A Link
api-domains-auth-admin 0 0 0 18 0 13.31s 1 no change Link
api-domains-communications 0 0 0 5 0 29.78s N/A Link
api-domains-criminal-record 0 0 0 5 0 8.47s N/A Link
api-domains-driving-license 0 0 0 23 0 27.02s N/A Link

🔻 Code Coverage Decreases vs Default Branch (3)

  • message-queue - jest 67.46% (-0.8%) - Details
  • application-templates-parental-leave - jest 34.95% (-0.1%) - Details
  • services-auth-delegation-api - jest 50.43% (-0.04%) - Details

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
apps/services/user-notification/README.md (2)

43-44: LGTM! Consider enhancing the note with more details.

The warning about cleaning newlines from Firebase credentials is crucial and well-placed. However, it could be more helpful with additional details.

Consider expanding the note with:

 > **Important**: For local development, the `FIREBASE_CREDENTIALS` environment variable needs to be cleaned of newlines. After running `get-secrets`, make sure to remove any newline characters from the `FIREBASE_CREDENTIALS` value in your environment.
+>
+> Example of cleaning newlines:
+> ```sh
+> # Get the current value
+> echo $FIREBASE_CREDENTIALS | tr -d '\n' | pbcopy  # On macOS
+> # or
+> echo $FIREBASE_CREDENTIALS | tr -d '\n' | xclip -selection clipboard  # On Linux
+> ```
+>
+> This step is necessary because newline characters in the credentials can cause Firebase Cloud Messaging authentication failures during local development.

43-44: Consider automating the credentials cleanup.

The manual cleanup of newlines is error-prone and could be automated to improve developer experience.

Would you like me to help create a script that:

  1. Automatically cleans the Firebase credentials after get-secrets
  2. Validates the credential format before starting the service
  3. Provides clear error messages if issues are detected

This could be added to the service's development utilities to ensure consistent credential formatting.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0423040 and 09c583c.

📒 Files selected for processing (2)
  • apps/services/user-notification/README.md (1 hunks)
  • apps/services/user-notification/project.json (0 hunks)
💤 Files with no reviewable changes (1)
  • apps/services/user-notification/project.json
🧰 Additional context used
📓 Path-based instructions (1)
apps/services/user-notification/README.md (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."

Copy link

codecov bot commented Dec 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 35.76%. Comparing base (65b79cc) to head (dcb7b00).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #17199      +/-   ##
==========================================
- Coverage   35.76%   35.76%   -0.01%     
==========================================
  Files        6931     6931              
  Lines      147959   147959              
  Branches    42168    42168              
==========================================
- Hits        52924    52921       -3     
- Misses      95035    95038       +3     
Flag Coverage Δ
air-discount-scheme-backend 48.20% <ø> (ø)
air-discount-scheme-web 0.00% <ø> (ø)
api 3.33% <ø> (ø)
api-catalogue-services 75.81% <ø> (ø)
api-domains-air-discount-scheme 37.90% <ø> (ø)
api-domains-assets 26.71% <ø> (ø)
api-domains-auth-admin 48.49% <ø> (ø)
api-domains-communications 39.42% <ø> (ø)
api-domains-criminal-record 47.92% <ø> (ø)
api-domains-driving-license 44.81% <ø> (ø)
api-domains-education 31.22% <ø> (ø)
api-domains-health-insurance 35.33% <ø> (ø)
api-domains-mortgage-certificate 35.16% <ø> (ø)
api-domains-payment-schedule 42.04% <ø> (ø)
application-api-files 61.73% <ø> (ø)
application-core 76.01% <ø> (ø)
application-system-api 38.75% <ø> (-0.01%) ⬇️
application-template-api-modules 27.80% <ø> (+<0.01%) ⬆️
application-templates-accident-notification 28.93% <ø> (ø)
application-templates-car-recycling 3.12% <ø> (ø)
application-templates-criminal-record 25.78% <ø> (ø)
application-templates-driving-license 18.12% <ø> (ø)
application-templates-estate 13.79% <ø> (ø)
application-templates-example-payment 24.71% <ø> (ø)
application-templates-financial-aid 14.42% <ø> (ø)
application-templates-general-petition 23.13% <ø> (ø)
application-templates-inheritance-report 6.54% <ø> (ø)
application-templates-marriage-conditions 15.11% <ø> (ø)
application-templates-mortgage-certificate 43.56% <ø> (ø)
application-templates-parental-leave 29.83% <ø> (-0.12%) ⬇️
application-types 6.57% <ø> (ø)
application-ui-components 1.24% <ø> (ø)
application-ui-shell 22.43% <ø> (ø)
auth-admin-web 2.43% <ø> (ø)
auth-nest-tools 31.52% <ø> (ø)
auth-shared 75.00% <ø> (ø)
clients-charge-fjs-v2 28.35% <ø> (ø)
clients-driving-license 40.79% <ø> (ø)
clients-driving-license-book 43.83% <ø> (ø)
clients-financial-statements-inao 49.59% <ø> (ø)
clients-license-client 1.26% <ø> (ø)
clients-middlewares 73.21% <ø> (ø)
clients-regulations 42.87% <ø> (ø)
clients-rsk-company-registry 31.04% <ø> (ø)
clients-rsk-personal-tax-return 38.32% <ø> (ø)
clients-smartsolutions 12.77% <ø> (ø)
clients-syslumenn 49.41% <ø> (ø)
clients-zendesk 50.46% <ø> (ø)
cms-translations 38.75% <ø> (ø)
content-search-index-manager 95.65% <ø> (ø)
content-search-toolkit 8.20% <ø> (ø)
contentful-apps 4.72% <ø> (ø)
dokobit-signing 62.10% <ø> (ø)
email-service 60.07% <ø> (ø)
feature-flags 90.76% <ø> (ø)
file-storage 45.86% <ø> (ø)
financial-aid-backend 51.40% <ø> (ø)
financial-aid-shared 17.88% <ø> (ø)
icelandic-names-registry-backend 54.33% <ø> (ø)
infra-nest-server 48.06% <ø> (ø)
infra-tracing 69.63% <ø> (ø)
island-ui-core 30.92% <ø> (ø)
judicial-system-api 20.16% <ø> (ø)
judicial-system-audit-trail 68.94% <ø> (ø)
judicial-system-backend 55.88% <ø> (ø)
judicial-system-formatters 78.28% <ø> (ø)
judicial-system-message 66.47% <ø> (ø)
judicial-system-message-handler 48.23% <ø> (ø)
judicial-system-scheduler 70.97% <ø> (ø)
judicial-system-types 42.22% <ø> (ø)
judicial-system-web 27.89% <ø> (ø)
license-api 42.91% <ø> (-0.06%) ⬇️
localization 10.15% <ø> (ø)
logging 58.02% <ø> (ø)
message-queue 67.05% <ø> (-0.71%) ⬇️
nest-audit 65.78% <ø> (ø)
nest-aws 51.93% <ø> (ø)
nest-config 76.38% <ø> (ø)
nest-core 53.16% <ø> (ø)
nest-feature-flags 51.00% <ø> (ø)
nest-problem 45.64% <ø> (ø)
nest-sequelize 94.44% <ø> (ø)
nest-swagger 51.13% <ø> (ø)
nova-sms 61.42% <ø> (ø)
portals-admin-regulations-admin 1.80% <ø> (ø)
portals-core 19.76% <ø> (ø)
regulations 16.78% <ø> (ø)
residence-history 85.00% <ø> (ø)
services-auth-admin-api 52.55% <ø> (ø)
services-auth-delegation-api 58.44% <ø> (-0.09%) ⬇️
services-auth-ids-api 52.54% <ø> (ø)
services-auth-public-api 49.40% <ø> (ø)
services-sessions 65.30% <ø> (ø)
services-university-gateway 49.53% <ø> (+0.14%) ⬆️
services-user-notification 46.58% <ø> (ø)
services-user-profile 56.98% <ø> (ø)
shared-components 30.08% <ø> (ø)
shared-form-fields 33.88% <ø> (ø)
shared-mocking 58.64% <ø> (ø)
shared-pii 92.85% <ø> (ø)
shared-problem 87.50% <ø> (ø)
shared-utils 27.69% <ø> (ø)
skilavottord-ws 24.31% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65b79cc...dcb7b00. Read the comment docs.

@rafnarnason rafnarnason requested a review from a team as a code owner December 11, 2024 14:47
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0423040 and 11755e8.

📒 Files selected for processing (3)
  • apps/services/user-notification/README.md (1 hunks)
  • apps/services/user-notification/src/config.ts (2 hunks)
  • libs/shared/utils/src/lib/environment.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
apps/services/user-notification/README.md (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."
libs/shared/utils/src/lib/environment.ts (2)

Pattern libs/shared/**/*: "Confirm that the code adheres to the following:

  • Cross-application utility functions, types, and constants.
  • TypeScript best practices to ensure type safety and reusability.
  • Documentation and examples for library consumers."

Pattern libs/**/*: "Confirm that the code adheres to the following:

  • Reusability of components and hooks across different NextJS apps.
  • TypeScript usage for defining props and exporting types.
  • Effective tree-shaking and bundling practices."
apps/services/user-notification/src/config.ts (2)

Pattern apps/services/**/*: "Confirm that the code adheres to the following:

  • NestJS architecture, including modules, services, and controllers.
  • Dependency injection patterns and service encapsulation.
  • Integration and unit testing coverage and practices."

Pattern apps/**/*: "Confirm that the code adheres to the following:

  • NextJS best practices, including file structure, API routes, and static generation methods.
  • Efficient state management and server-side rendering techniques.
  • Optimal use of TypeScript for component and utility type safety."

libs/shared/utils/src/lib/environment.ts Outdated Show resolved Hide resolved
apps/services/user-notification/src/config.ts Outdated Show resolved Hide resolved
apps/services/user-notification/src/config.ts Outdated Show resolved Hide resolved
apps/services/user-notification/README.md Outdated Show resolved Hide resolved
@rafnarnason rafnarnason requested a review from a team as a code owner December 11, 2024 15:30
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (2)
scripts/get-secrets.sh (2)

41-41: Add error handling for ts-node command

Consider adding error handling for the ts-node command execution to provide better feedback if the secrets retrieval fails.

- output=$(ts-node --dir "$ROOT"/infra "$ROOT"/infra/src/cli/cli render-secrets --service="$*")
+ if ! output=$(ts-node --dir "$ROOT"/infra "$ROOT"/infra/src/cli/cli render-secrets --service="$*"); then
+   echo "Failed to retrieve secrets for '$*'" >&2
+   return 1
+ fi

44-48: Consider adding validation for cleaned output

While the cleaning process effectively handles newlines, it would be beneficial to validate that the cleaned output maintains valid JSON structure.

  echo "$output" | while IFS= read -r line; do
    cleaned_line=$(echo "$line" | tr -d '\n' | sed 's/\\n/ /g' | sed 's/\\//g')
+   # Validate JSON structure if line contains JSON
+   if [[ "$cleaned_line" == *"{"* ]]; then
+     if ! echo "$cleaned_line" | jq -e . >/dev/null 2>&1; then
+       echo "Warning: Line contains invalid JSON after cleaning" >&2
+     fi
+   fi
    echo "$cleaned_line" >> "$env_secret_file"
  done
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between a81371c and 1a0ce36.

📒 Files selected for processing (1)
  • scripts/get-secrets.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/get-secrets.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
🔇 Additional comments (2)
scripts/get-secrets.sh (2)

37-37: Improved line counting robustness

The use of awk '{print $1}' to extract just the number from wc -l output is more robust than direct usage, as it handles different output formats across systems.

Also applies to: 50-50


40-48: Well-implemented solution for newline handling

The new implementation effectively addresses the Firebase credentials newline issue by:

  1. Capturing the output separately
  2. Processing each line individually
  3. Cleaning newlines and backslashes while preserving JSON format

This solves the authentication failures with Firebase Cloud Messaging mentioned in the PR objectives.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Outside diff range and nitpick comments (3)
scripts/get-secrets.sh (3)

24-25: Standardize line counting approach across the script

The script uses different methods for counting lines (wc -l | awk here vs wc -l < elsewhere). Consider extracting this into a helper function for consistency and maintainability.

+function count_lines() {
+    wc -l < "$1"
+}
+
 function get-secrets {
   echo "Fetching secret environment variables for '$*'"
-  pre=$(wc -l "$env_secret_file" | awk '{print $1}')
+  pre=$(count_lines "$env_secret_file")
   debug "Project '$*' has $pre secrets before render-secrets"

27-35: LGTM! Clean implementation of credential formatting

The implementation effectively addresses the Firebase credentials formatting issue by properly handling newlines and backslashes while maintaining JSON integrity.

Consider combining the sed commands for better efficiency:

-    cleaned_line=$(echo "$line" | tr -d '\n' | sed 's/\\n/ /g' | sed 's/\\//g')
+    cleaned_line=$(echo "$line" | tr -d '\n' | sed 's/\\n/ /g; s/\\//g')

Line range hint 37-42: Enhance error handling and debugging information

While the validation logic is correct, consider providing more detailed feedback when no secrets are found to help developers troubleshoot issues.

   post=$(wc -l "$env_secret_file" | awk '{print $1}')
-  debug "Project '$*' has $post secrets after render-secrets"
+  debug "Project '$*' has $post secrets after render-secrets (added $((post - pre)) secrets)"

   if [ "$pre" == "$post" ]; then
-    echo "No secrets found for project '$*'"
+    echo "Warning: No secrets found for project '$*'. Please verify:"
+    echo "  1. The project name is correct"
+    echo "  2. You have the necessary AWS permissions"
+    echo "  3. Secrets are configured in AWS Secrets Manager"
   fi
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0ce36 and 6b9c861.

📒 Files selected for processing (1)
  • scripts/get-secrets.sh (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
scripts/get-secrets.sh (1)

Pattern scripts/**/*: "Confirm that the code adheres to the following:

  • Script efficiency, readability, and maintainability.
  • Usage of environmental variables and configuration files for flexibility.
  • Integration with NX workspace utilities and commands."
🔇 Additional comments (1)
scripts/get-secrets.sh (1)

20-20: Verify AWS permissions for Firebase credentials

Since this script fetches Firebase credentials from AWS Secrets Manager, ensure that the necessary AWS IAM permissions are documented.

✅ Verification successful

Let me try to gather more information about AWS and Firebase configurations in the codebase.


Let me check the actual script content to verify the AWS permissions usage.


Let me check the related infrastructure code to understand how the secrets are actually fetched.


Based on the code analysis, I can now provide a final response about the AWS permissions verification:

AWS permissions are handled through SSM Parameter Store

The script uses AWS Systems Manager (SSM) Parameter Store to fetch secrets, requiring the following minimal IAM permissions:

  • ssm:GetParameter - To fetch secrets
  • sts:GetCallerIdentity - For AWS authentication check

The script already includes proper AWS authentication verification through the aws-check function before attempting to access any secrets.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check if AWS permissions documentation exists
rg -l "aws.*permission|iam.*role" docs/ README.md

# Check for existing Firebase-related secrets
aws secretsmanager list-secrets --query "SecretList[?contains(Name, 'firebase')].Name" --output text 2>/dev/null || echo "No matching secrets found or insufficient permissions"

Length of output: 323


Script:

#!/bin/bash
# Search for AWS and Firebase related configuration files
fd -t f "aws|firebase|secret|credential" -X ls -l

# Look for AWS and Firebase related patterns in the codebase
rg -i "aws|firebase|secret|credential" --type-add 'config:*.{json,yaml,yml,env}' -t config

# Check if there are any IAM or permission related patterns in any file
rg -i "iam|permission|role|policy" -A 3

Length of output: 74582


Script:

#!/bin/bash
# Check the content of get-secrets.sh
cat scripts/get-secrets.sh

# Look for AWS IAM/permission related patterns in the script
rg -p "aws.*iam|assume.*role|get.*secret" scripts/get-secrets.sh

Length of output: 2449


Script:

#!/bin/bash
# Check the render-secrets implementation
cat infra/src/cli/render-secrets.ts

# Check the AWS secrets handling code
cat infra/src/secrets.ts

# Look for AWS IAM roles in infrastructure
rg -p "aws_iam_role|assume_role" infra/

Length of output: 5695

Copy link
Member

@robertaandersen robertaandersen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rafnarnason rafnarnason removed the request for review from a team December 12, 2024 09:42
@rafnarnason rafnarnason requested a review from a team December 12, 2024 10:25
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Outside diff range and nitpick comments (1)
infra/src/cli/render-secrets.ts (1)

70-73: Consider security and architectural improvements

Several architectural improvements could enhance security and maintainability:

  1. Remove debug logging of sensitive values (line 70)
  2. Add input validation for secret values
  3. Consider using a type-safe configuration system
  4. Add unit tests to verify escaping behavior

Would you like me to help implement any of these improvements? I can:

  1. Create a type-safe configuration interface
  2. Add input validation utilities
  3. Generate unit tests for the escaping logic
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6b9c861 and f6757d8.

📒 Files selected for processing (1)
  • infra/src/cli/render-secrets.ts (1 hunks)

infra/src/cli/render-secrets.ts Show resolved Hide resolved
@rafnarnason rafnarnason added the automerge Merge this PR as soon as all checks pass label Dec 12, 2024
@rafnarnason rafnarnason added automerge Merge this PR as soon as all checks pass and removed automerge Merge this PR as soon as all checks pass labels Dec 12, 2024
@kodiakhq kodiakhq bot merged commit 0911141 into main Dec 13, 2024
31 checks passed
@kodiakhq kodiakhq bot deleted the user-notification/update-readme-env branch December 13, 2024 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
automerge Merge this PR as soon as all checks pass
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants