Repository navigation
feat(server): apply operation policy modes, pass the peer, log decisions - #2425
Merged
Merged
Conversation
Signed-off-by: Tibor Kircsi <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
csirmazbendeguz
previously approved these changes
Oct 28, 2026
Signed-off-by: Tibor Kircsi <[email protected]> # Conflicts: # server/policy/policies_test.go
tkircsi
enabled auto-merge
October 28, 2026 11:01
tkircsi
disabled auto-merge
October 28, 2026 11:02
csirmazbendeguz
approved these changes
Oct 28, 2026
2 tasks done
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.
Second of the two-layer content-policy PRs, on top of #2419. Closes #2344, refs #2128.
#2419 gave operation policies an input to read. This makes the three things that input was for actually work.
Modes are applied per policy.
Operation.Modeshipped in v1.8.0 as configuration nothing read. It is now resolved at load time and applied inDecide:offdoes not run the policy,shadowruns it and logs the decision without refusing the record,enforcerefuses it. An unset mode enforces — no shipped configuration setsmode:, so the alternative would have silently disabled OASF schema validation in the Helm values, daemon config and e2e suite. Per policy, so one can be introduced in shadow while the rest keep enforcing.The peer reaches the policy.
Decidetakes...DecideOption, and autosync passespolicy.FromPeer(peerID.String())to populatecontext.source_peer_id. An option rather than a parameter because one of four callers has one. This is not an authorization input: the allow-set is matched against the authenticatedpeer.IDinMaybeEnqueuelong before a validator runs, so this only buys per-peer rules.Decisions are logged. Each policy that runs writes one line under the
policycomponent, carryingoperation,cid,policy_id,mode,decision,reason, andpeerorcaller. Emitted insideDeciderather than by its callers, because a shadow policy's decision is dropped there and never returned — the log is the whole of what shadow mode produces.decisionis what the policy decided andmodeis what was done about it, sodecision=refuse mode=shadowreads as a record that was accepted. Refusals atINFO, accepted records atDEBUG. Only the CID is logged, never the record. Thedir_policy_gate_*counters are untouched; they aggregate over the evaluation layer.Not included: the issue asks the log to carry the verdict keys read.
verdictsis declared in neither the CEL environment nor the Rego document, since reaching one needs a database read this path does not have, so the field would be empty on every line. It belongs in the PR that makes the read gate apull/searchpolicy.