Skip to content

Commit

Permalink
genpolicy: align state path getter and setter
Browse files Browse the repository at this point in the history
Before this patch there was a mismatch between the JSON path under which
the state of the rule evaluation is set in comparison to under which
it is retrieved.

This resulted in the behavior that each time the policy was evaluated,
it thought it was the _first_ time the policy was evaluated.
This also means that the consistency check for the `sandbox_name`
was ineffective.

Signed-off-by: Leonard Cohnen <[email protected]>
  • Loading branch information
3u13r authored and Redent0r committed Dec 16, 2024
1 parent 349120d commit 22fe9cc
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/tools/genpolicy/rules.rego
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ get_state() = state {
}

get_state_path(key) = path {
path := concat("/", ["", key]) # prepend "/" to key
# prepend "/pstate/" to key
path := concat("/", ["/pstate", key])
}

# Helper functions to conditionally concatenate if op is not null
Expand Down

0 comments on commit 22fe9cc

Please sign in to comment.