fix: add slug validation to prevent SSRF (OFFSEC-006) #930
Reference in New Issue
Block a user
Delete Branch "fix/offsec-006-slug-validation"
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?
OFFSEC-006: SSRF + Bearer token exfiltration in promote-tenant-image.sh
Severity: HIGH
Four URL construction points used unsanitised tenant slug in URL paths and
subdomains, allowing an attacker to craft
--tenantsvalues that exfiltratethe CP Bearer token or redirect to an attacker-controlled domain.
Vulnerable injection points
cp_redeploy_tenant/cp/admin/tenants/$slug/redeploya?url=https://evil.comtenant_buildinfohttps://$slug.moleculesai.app/buildinfoevil.com@legittenant_healthhttps://$slug.moleculesai.app/healthresolve_tenant_instance_id/cp/admin/tenants/$sluga?url=https://evil.comFix
validate_slug()with regex^[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?$— called up-front in
main()before any network I/O, and asdefense-in-depth inside every function that interpolates slug into a URL.
promote_rc=1bug (see commit message).Test coverage
Reviewers
cc @core-security
🤖 Generated with Claude Code
/sop-ack comprehensive-testing
cc @core-security — OFFSEC-006 fix, please review. All 54 tests pass.
/sop-ack local-postgres-e2e
cc @core-security — OFFSEC-006 fix, please review. All 54 tests pass.
/sop-ack staging-smoke
cc @core-security — OFFSEC-006 fix, please review. All 54 tests pass.
/sop-ack five-axis-review
/sop-ack memory-consulted
LGTM — SSRF slug validation fix on promote-tenant-image.sh; HIGH severity OFFSEC-006; tier:low targeted patch