fix: guard ref names in billingaccountbinding create policy#69
Open
ecv wants to merge 2 commits into
Open
Conversation
The create-with-refs rule matched on has(projectRef) and has(billingAccountRef) but its summary dereferenced projectRef.name and billingAccountRef.name. A create whose refs omit name (rejected by admission, but still recorded in the audit requestObject) raised CEL "no such key: name", sending the event to the DLQ -- the same leak class as milo-os/activity#212. Require the .name leaves in the match so malformed bindings fall through to the create-fallback rule instead of leaking.
5 tasks
create-with-refs reads audit.requestObject.spec refs (always present, safe), but create-fallback derefs audit.responseObject.metadata.name unconditionally. A create that misses the refs guard and is rejected returns a Status as responseObject with no metadata.name, raising "no such key: name" -> DLQ. A generateName create rejected before naming also has an empty objectRef.name. Replace with a per-level-guarded fallback chain: responseObject.metadata.name -> objectRef.name -> responseObject.details.name -> literal The details branch is guarded with has(responseObject.details) because some Status responses carry no details. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
Tighten the
create-with-refsmatch inbillingaccountbinding-policy.yamltorequire
projectRef.nameandbillingAccountRef.name, the fields its summarydereferences.
Why
Same DLQ-leak class as milo-os/activity#212. The match guarded only
has(projectRef)/has(billingAccountRef), but the summary derefs their.name. A create whose refs omitname(rejected by admission, but stillrecorded in the audit
requestObject) raises CELno such key: name→ eventto DLQ → retries fail.
Fix
Adding the
.nameleaves to the match routes malformed bindings to theexisting
create-fallbackrule (created billing account binding <name>)instead of leaking. Match-based guard, consistent with this file's style.
Remediation
Merge + billing release → the
billing-milo-activity-policiesFluxKustomization re-applies the corrected CR. No
kubectl.Related