Skip to content

fix(cli): mutable list default arg in sync.py (KSM-1191) - #1106

Merged
stas-schaller merged 1 commit into
release/tool/cli/v1.5.0from
fix/KSM-1191-cli-mutable-default-arg
Aug 12, 2026
Merged

fix(cli): mutable list default arg in sync.py (KSM-1191)#1106
stas-schaller merged 1 commit into
release/tool/cli/v1.5.0from
fix/KSM-1191-cli-mutable-default-arg

Conversation

@stas-schaller

@stas-schaller stas-schaller commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

CLI: four AWS sync methods in sync.py used 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_aws now use maps: Optional[list] = None, normalized to maps = maps or [] where the method has no earlier guard (KSM-1191)

Testing

cd integration/keeper_secrets_manager_cli && pytest

196 passed, 5 skipped.

Breaking Changes

None.

Related Issues

  • Jira: KSM-1191

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.

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
stas-schaller merged commit 343dd74 into release/tool/cli/v1.5.0 Aug 12, 2026
10 checks passed
@stas-schaller
stas-schaller deleted the fix/KSM-1191-cli-mutable-default-arg branch August 12, 2026 19:36
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants