-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
fix(s3-deployment): handle properly quoted strings in JSON files #33698
base: main
Are you sure you want to change the base?
Conversation
The S3 deployment custom resource now properly handles strings containing quotes when used in JSON files, while maintaining the existing behavior for other file types including YAML files. Changes: - Added JSON detection and special handling in the Lambda custom resource - Added integration tests for both JSON and YAML files with quoted values - Added bucket cleanup configuration to the test stack Test cases show that: - JSON files properly escape quotes: {"secret_value": "test\"with\"quotes"} - YAML files work as-is: secret_value: test"with"quotes
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #33698 +/- ##
==========================================
+ Coverage 82.24% 82.38% +0.14%
==========================================
Files 119 120 +1
Lines 6875 6937 +62
Branches 1161 1170 +9
==========================================
+ Hits 5654 5715 +61
- Misses 1118 1119 +1
Partials 103 103
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add some unit tests for the different cases here? (json, yaml, nested json with quotes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the unit tests.
AWS CodeBuild CI Report
Powered by github-codebuild-logs, available on the AWS Serverless Application Repository |
The S3 deployment custom resource now properly handles strings containing quotes when used in JSON files, while maintaining the existing behavior for other file types including YAML files.
Issue #22661
Closes #22661 .
Reason for this change
Investigation Findings
Source.jsonData
level, we only have markers, not actual values:BEFORE Fix (Current Broken State)
When the Lambda replaces markers:
AFTER (With Fix)
The Lambda now detects JSON files and handles them specially:
Key Insights
Description of changes
Changes:
Describe any new or updated permissions being added
N/A
Description of how you validated changes
Test cases show that:
{"secret_value": "test\"with\"quotes"}
secret_value: test"with"quotes
Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license