Expose matched rule id to action callbacks#65
Draft
annacai21 wants to merge 2 commits into
Draft
Conversation
|
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.
Summary
Action callbacks fired by multi-rule policies (e.g. requirements.bin where multiple rules share one action) couldn't tell which rule actually triggered. This adds
rule_idto the node schema, hasdd-requirements-converterstamp each rule's stable id on its root node, and exposes the firing rule's id viaplcs_eval_ctx_get_matched_rule_id()for action callbacks to read.Changes
fbs-schema/nodes.fbs: newrule_id: stringonCompositeNodeandEvaluatorNode(additive — old buffers read empty, old engines ignore).composite_evaluatorcaptures the depth-0 OR child'srule_idon short-circuit TRUE; exposed via newplcs_eval_ctx_get_matched_rule_id().ruleIDarg and stamp it on each rule's root. Deny rules use their JSONid; libc rules synthesize one (e.g.libc_glibc_x64_below_min_2.17.0). Deny rules without anidare rejected.Follow-ups (out of scope)
action_allow_deny_injectionto read the new accessor (~3 lines).Test plan
go test ./...— passes, with new assertions on the rule_id stamped on each top-level OR child