fix: resolve issues #3911 and #3939#3948
Open
Hardikrepo wants to merge 1 commit into
Open
Conversation
aws#3911 - Security: normalize do_not_verify values to lists so `in` performs exact element matching instead of substring matching, preventing logical ID uniqueness check bypass via crafted resource types. aws#3939 - Globals.Function: Architectures at resource level now overrides the global value instead of being concatenated, since Lambda only supports a single architecture value. Introduced _list_override_properties frozenset in GlobalProperties to handle this class of properties. Tests: added tests/translator/test_verify_logical_id.py (9 tests) and 2 new cases in tests/plugins/globals/test_globals.py.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Security: Logical ID uniqueness check can be bypassed via substring matching #3911 - Security: Logical ID uniqueness check bypass
Normalized all \do_not_verify\ values in \�erify_logical_id.py\ from plain strings to lists. Python's \in\ operator on a string performs substring matching, allowing a crafted resource type like \AWS::Serverless::Fun\ to bypass the uniqueness check. Using lists ensures exact element matching.
Globals.Function Architectures should be overridden by resource-level Architectures #3939 - Globals.Function Architectures concatenates instead of overrides
Added _list_override_properties = frozenset({'Architectures'})\ to \GlobalProperties\ in \globals.py. When \Architectures\ is set at both global and resource level, the resource-level value now replaces the global value entirely. Previously, SAM concatenated both lists (e.g. [x86_64, arm64]), which is invalid since Lambda only supports one architecture.
Files Changed
Test Plan
Fixes #3911
Fixes #3939