-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Asserting
every
domain is an collection type before evaluation (#6763)
Fixing an issue where a non-collection `every`-domain didn’t fail evaluation. Removing a possible attack surface, where an attacker with the ability to craft portions of the input document could replace a value with an expected collection type, that is known to be processed by an `every`-statement, with a non-collection value and thereby would cause the policy to accept a query that should otherwise be rejected. Fixes: #6762 Signed-off-by: Johan Fylling <johan.dev@fylling.se>
- Loading branch information
1 parent
27da341
commit 62834a2
Showing
6 changed files
with
329 additions
and
21 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,151 @@ | ||
--- | ||
cases: | ||
- note: "every/non-iter domain: int" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in 42 { v > 1 } | ||
} | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: string" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in "foobar" { v > 1 } | ||
} | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: bool" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in true { v > 1 } | ||
} | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: null" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in null { v > 1 } | ||
} | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: built-in call" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in floor(13.37) { v > 1 } | ||
} | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: function call" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in foo(1, 2) { v > 1 } | ||
} | ||
foo(a, b) := a + b | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: rule ref" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in q { v > 1 } | ||
} | ||
q := 1 | ||
query: data.test.p = x | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: data int" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in data.iterate_me { v > 1 } | ||
} | ||
query: data.test.p = x | ||
data: | ||
iterate_me: 1 | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: input int" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in input.iterate_me { v > 1 } | ||
} | ||
query: data.test.p = x | ||
input: | ||
iterate_me: 1 | ||
want_result: | ||
- x: 1 | ||
- note: "every/non-iter domain: input int (1st level)" | ||
modules: | ||
- | | ||
package test | ||
import future.keywords.every | ||
default p := 1 | ||
p := 2 { | ||
every v in input { v > 1 } | ||
} | ||
query: data.test.p = x | ||
input: 1 | ||
want_result: | ||
- x: 1 |
Oops, something went wrong.