feat(scripts): harden JSON parameter construction in ssm_refresh_ecr_auth (mc#676) #678

Closed
core-devops wants to merge 1 commits from infra/676-ssm-auth-json-hardening into main

1 Commits

Author SHA1 Message Date
6a08eaa9c2 feat(scripts): harden JSON parameter construction in ssm_refresh_ecr_auth (mc#676)
Some checks failed
Block internal-flavored paths / Block forbidden paths (pull_request) Successful in 5s
Secret scan / Scan diff for credential-shaped strings (pull_request) Successful in 9s
sop-checklist / all-items-acked (pull_request) [soft-fail tier:low] acked: 0/7 — missing: comprehensive-testing, local-postgres-e2e, staging-smoke, +4 — body-unfilled: 7
CI / Detect changes (pull_request) Successful in 15s
sop-checklist-gate / gate (pull_request) Successful in 10s
E2E Staging Canvas (Playwright) / detect-changes (pull_request) Successful in 18s
qa-review / approved (pull_request) Failing after 15s
E2E API Smoke Test / detect-changes (pull_request) Successful in 18s
security-review / approved (pull_request) Failing after 15s
Handlers Postgres Integration / detect-changes (pull_request) Successful in 19s
Runtime PR-Built Compatibility / detect-changes (pull_request) Successful in 22s
sop-tier-check / tier-check (pull_request) Successful in 16s
gate-check-v3 / gate-check (pull_request) Failing after 23s
CI / Platform (Go) (pull_request) Successful in 7s
E2E Staging Canvas (Playwright) / Canvas tabs E2E (pull_request) Successful in 7s
CI / Canvas (Next.js) (pull_request) Successful in 6s
CI / Python Lint & Test (pull_request) Successful in 5s
CI / Canvas Deploy Reminder (pull_request) Has been skipped
Runtime PR-Built Compatibility / PR-built wheel + import smoke (pull_request) Successful in 5s
Handlers Postgres Integration / Handlers Postgres Integration (pull_request) Successful in 7s
E2E API Smoke Test / E2E API Smoke Test (pull_request) Successful in 8s
CI / Shellcheck (E2E scripts) (pull_request) Successful in 11s
CI / all-required (pull_request) Successful in 1s
Ops Scripts Tests / Ops scripts (unittest) (pull_request) Successful in 35s
lint-required-no-paths / lint-required-no-paths (pull_request) Successful in 1m6s
audit-force-merge / audit (pull_request) Has been skipped
Five-Axis review of #672 flagged that REGION and ECR_ACCOUNT_ID are
interpolated into a JSON payload for SSM send-command without validation.
A malicious value (e.g. containing " or \) could break JSON well-formedness
or — in the authenticated-operator threat model — introduce a command-injection
seam in the embedded shell command.

Changes:
- promote-tenant-image.sh: add validation after argument parsing:
    * REGION must match ^[a-z0-9-]+$ (exit 64)
    * ECR_ACCOUNT_ID (if set) must match ^[0-9]{12}$ (exit 64)
- test-promote-tenant-image.sh: add 3 test cases to Test 8:
    * exit 64 on JSON-injection region ("x";rm -rf /)
    * exit 64 on non-12-digit ECR_ACCOUNT_ID
    * valid region + ECR_ACCOUNT_ID passes validation

All 43 tests pass. Tier: low — defense-in-depth on authenticated-operator-only
threat model. Closes mc#676.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-12 08:52:21 +00:00