fix(cli): mutable list default arg in sync.py (KSM-1191) - #1106
Merged
stas-schaller merged 1 commit intoAug 12, 2026
Merged
Conversation
sync_aws_json_with_client, sync_aws_json, sync_aws_with_client and sync_aws declared maps: list = [], a mutable default argument shared and mutated across calls that omit it. Switched all four to Optional[list] = None with maps = maps or [] where the method iterates without an earlier guard. Originally found via Datadog SAST triage (VM-2868) on a private-repo branch; ported here onto cli-1.5.0's current colorama-free sync.py. KSM-1191
stas-schaller
added a commit
that referenced
this pull request
Aug 12, 2026
) sync_aws_json_with_client, sync_aws_json, sync_aws_with_client and sync_aws declared maps: list = [], a mutable default argument shared and mutated across calls that omit it. Switched all four to Optional[list] = None with maps = maps or [] where the method iterates without an earlier guard. Originally found via Datadog SAST triage (VM-2868); ported here onto cli-1.5.0's current colorama-free sync.py. KSM-1191 Co-authored-by: Sergey Aldoukhov <[email protected]>
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
CLI: four AWS sync methods in
sync.pyused a mutable list (maps: list = []) as a default argument, which Python evaluates once at function-definition time and shares across calls that omit it.Changes
Fixed
sync_aws_json_with_client,sync_aws_json,sync_aws_with_client,sync_awsnow usemaps: Optional[list] = None, normalized tomaps = maps or []where the method has no earlier guard (KSM-1191)Testing
196 passed, 5 skipped.
Breaking Changes
None.
Related Issues
Originally found by Sergey Aldoukhov while triaging Datadog SAST findings (VM-2868); ported here onto cli-1.5.0's current sync.py. Commit author is credited accordingly.