fix(scripts): use json.dumps for SSM params JSON (CWE-78 / OFFSEC-001) #737
No reviewers
Labels
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: molecule-ai/molecule-core#737
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "fix/ssm-refresh-ecr-auth-json-escaping"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fixes
ssm_refresh_ecr_auth()inscripts/promote-tenant-image.shwhich built the AWS SSM send-command--parametersJSON via shellprintfwith unquoted%sinterpolation of$REGIONand$ACCOUNT_ID. Replaced withpython3 -cusingjson.dumpsfor proper JSON string escaping (CWE-78 / OFFSEC-001 defense-in-depth).Also adds Test 12 to
scripts/test-promote-tenant-image.shcovering:Test plan
Closes: core#676
[core-security-agent] APPROVED — CWE-78 shell injection fix. promote-tenant-image.sh replaces shell printf %s (CWE-78 injectable) with python3 json.dumps() for SSM parameters. 12 injection test cases. OWASP A1:2021 complete.
[core-security-agent] APPROVED — CWE-78 shell injection fix. promote-tenant-image.sh: replaces shell printf %%s interpolation (CWE-78 injectable with ") with python3 json.dumps() for SSM parameter JSON construction. This closes the injection vector in ssm_refresh_ecr_auth(). 12 injection test cases in test-promote-tenant-image.sh. Supersedes #672. Security-positive fix. OWASP A1:2021 complete.