feat(platform): a hipaa platform must choose its guardrail - #52
Merged
Conversation
`compliance.hipaa` declared a posture and checked nothing particular to it. Its only invariant was the generic one it shares with `soc2` — a Platform must declare at least what its Tenant declares — so the flag was strictly weaker than its sibling, which additionally requires the budget kill-switch. Every model route resolves to a guardrail: the route's own guardrailRef, else the gateway's defaultGuardrailRef, else the cluster baseline the operator reads from SSM. That fallback is deliberate and is the right default for a general workload. It is also a general-purpose guardrail — it anonymizes email, phone and card numbers, blocks SSN, and covers no other entity — and a route reaches it by omission rather than by anyone choosing it. So a hipaa Platform whose routes name no guardrail now reports one finding per unguarded route. The check is that a decision was made, not what the decision was: whether a named guardrail carries the right entities and blocks rather than anonymizes is a question about Bedrock state this audit does not read, while declaring HIPAA and silently inheriting a default is answerable from the CRs alone. Gateways are matched to their Platform by spec.platformRef, so a peer tenant's gateway in the same namespace is never attributed here. A list that fails reports rather than returning clean — an unread gateway is not a cleared one. Adds the SARIF rule alongside the finding type, which the rule-coverage test requires. Mutation-tested: dropping the hipaa gate, firing for every platform, removing the platformRef filter, and ignoring either guardrail ref are all caught.
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
platform auditnow reports ahipaaPlatform whose model routes name no guardrail and therefore fall back to the cluster baseline.Why
compliance.hipaadeclared a posture and checked nothing particular to it. Its only invariant was the generic one it shares withsoc2— a Platform must declare at least what its Tenant declares — so the flag was strictly weaker than its sibling, which additionally requires the budget kill-switch.Every model route resolves to a guardrail, in this order:
guardrailRefdefaultGuardrailRefThat fallback is deliberate and is the right default for a general workload. It is also a general-purpose guardrail — it anonymizes
EMAIL,PHONEandCREDIT_DEBIT_CARD_NUMBER, blocksUS_SOCIAL_SECURITY_NUMBER, and covers no other entity — and a route reaches it by omission rather than by anyone choosing it.What the rule asserts, and what it doesn't
It asserts a decision was made, not what the decision was.
Whether a named guardrail carries the right entities, and blocks rather than anonymizes on output, is a question about Bedrock state this audit does not read — it would need a new AWS reader port. Declaring HIPAA and silently inheriting a default is answerable from the CRs alone, so that is what this checks.
Details
spec.platformRef, so a peer tenant's gateway in the same namespace is never attributed here.defaultGuardrailRefon the gateway satisfies every route on it.Mutation-tested
hipaagate so the rule never firesplatformReffilterdefaultGuardrailRefguardrailRefVerification
task build,task test,task lint(0 issues),scripts/check-context.sh,scripts/coverage.sh— all green, every floor met.One incidental change
gofmt -wrealigned a const block inaudit_test.gothat was already unformatted onmain. Kept rather than reverted — re-introducing it would leave the file gofmt-dirty. Worth noting separately that nothing in this repo gates Go formatting, which is how it got there.