You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit fixes a bug in the predicate that checks if a ref refers
to a virtual doc during the rule index build.
Empty packages or packages containing only undefined rules generate an
empty object. The bug was causing refs to empty packages to not be
considered _virtual_ and therefore they could be indexed.
In the issue, the case that passes did so because the ref was
non-ground so the indexer excluded it. The case the failed was ground
and the ref referred to an empty package so the indexer included
it. This could be seen by enabling tracing (the index event showed
zero matching rules so the expression failed.)
The fix updates the virtual predicate to just walk down the rule
tree instead of accumulating rules. If at any point there are no rules
AND there are no children, the ref is not virtual. Otherwise, the ref
is virtual.
Fixesopen-policy-agent#1863
Signed-off-by: Torin Sandall <[email protected]>
This commit fixes a bug in the predicate that checks if a ref refers
to a virtual doc during the rule index build.
Empty packages or packages containing only undefined rules generate an
empty object. The bug was causing refs to empty packages to not be
considered _virtual_ and therefore they could be indexed.
In the issue, the case that passes did so because the ref was
non-ground so the indexer excluded it. The case the failed was ground
and the ref referred to an empty package so the indexer included
it. This could be seen by enabling tracing (the index event showed
zero matching rules so the expression failed.)
The fix updates the virtual predicate to just walk down the rule
tree instead of accumulating rules. If at any point there are no rules
AND there are no children, the ref is not virtual. Otherwise, the ref
is virtual.
Fixes#1863
Signed-off-by: Torin Sandall <[email protected]>
Expected Behavior
Empty packages should evaluate consistently, ideally as an empty object
{}
Actual Behavior
Empty packages evaluate differently depending on how the Rego is written
Steps to Reproduce the Problem
data.undefined.z
in the REPL:data.defined.z
in the REPL:Additional Info
Version: 0.14.2
Build Commit: db9855d
Build Timestamp: 2019-10-04T15:28:33Z
Build Hostname: 65ca4a7c4e81
The text was updated successfully, but these errors were encountered: