fix: security preset cannot render placeholders; disruptive SCPs opt-in - #43
Merged
Conversation
…opt-in
Usability review blocker 5, two independent defects:
(a) presets/security-focused.yaml shipped org_id "o-REPLACEME" and the
schema accepted any string, so the placeholder validated and rendered
into IAM policies (aws:PrincipalOrgID) against a nonexistent org.
SecurityConfig.org_id now has a field_validator: empty stays allowed
(deploy.sh prompts), a non-empty value must match ^o-[a-z0-9]{10,32}$,
and REPLACE/EXAMPLE/CHANGEME (any case) are rejected with a pointer to
`aws organizations describe-organization --query Organization.Id`.
The preset ships org_id "" with the same pointer in a comment.
(b) terraform/org-guardrails defaulted enable_scp_memory_enforce_cmk
and enable_gateway_scps to true, but the accelerator's own gateway sets
no KMS key and the security-focused preset runs Cedar LOG_ONLY while
the SCP assumes ENFORCE - following SECURITY_CONTROLS.md as written
could make the project's guardrails deny the project's own platform.
Both now default false; descriptions and a new compatibility-preflight
subsection in docs/SECURITY_CONTROLS.md spell out what to enable first
(security stack KMS on every covered memory; Cedar ENFORCE + gateway
CMK) and that attaching them over a default deployment locks the
platform out.
Consequence handled: with org_id now empty and resource_policies on,
the memory stack raises at synth (confirmed by running the parity
check). check-contract.sh exports ORG_ID=o-paritycheck123 next to
CDK_DEFAULT_ACCOUNT - env beats platform.yaml, real deploys still
prompt.
Verified:
- .venv pytest tests/ -q: 143 passed
- ruff check + format --check on platform_config.py and its tests: clean
- PY=.venv/... check-contract.sh: all 6 configs PASS
(security-focused synthesizes, 8 stacks)
- shellcheck --severity=warning scripts/check-contract.sh: clean
- terraform fmt -check terraform/org-guardrails: clean
|
Commit: Security Scan Results
|
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.
What
Usability-review blocker 5: the enterprise security quick start was internally incompatible, two ways.
Placeholders validated.
presets/security-focused.yamlshippedorg_id: "o-REPLACEME"and the schema accepted any string — the placeholder rendered into IAM policies against an organization that does not exist.The guardrails denied their own platform.
terraform/org-guardrailsdefaultedenable_scp_memory_enforce_cmkandenable_gateway_scpsto true, while the accelerator's default deployment creates Memory without a CMK and runs Cedar inLOG_ONLYwhere the SCP assumesENFORCE. Followingdocs/SECURITY_CONTROLS.mdas written could lock the platform out of its own APIs.Fixes
SecurityConfig.org_idgains a validator: empty stays allowed (deploy.shprompts), a non-empty value must matcho-[a-z0-9]{10,32}, and anything containing REPLACE/EXAMPLE/CHANGEME is rejected with the command that finds the real id.org_id: ""with that guidance inline.docs/SECURITY_CONTROLS.mdgets an "Org SCP compatibility preflight" subsection: SCP → what the accelerator must have enabled first, with the explicit lock-out warning.ORG_IDfor synth (env beatsplatform.yaml), since the memory stack hard-fails resource policies without one — the predicted failure was reproduced first, then fixed.Verified
143 tests green (three new: valid id passes,
o-REPLACEMErejected pointing atdescribe-organization, wrong-shape rejected); contract parity green across all 6 configs;terraform fmt -checkclean; ruff and shellcheck clean.