fix!: Remove cryptographic builtins (#396)

Cryptographic builtins are removed due to various reasons like FIPS
compliance. Users needing crypto builtins are encouraged to use
extensions.

Deprecated functions are also removed.

Signed-off-by: Anand Krishnamoorthi <anakrish@microsoft.com>
This commit is contained in:
Anand Krishnamoorthi
2025-04-16 12:24:19 -07:00
committed by GitHub
parent 667cb0d90f
commit 9e43bd9878
17 changed files with 155 additions and 1070 deletions

View File

@@ -456,18 +456,6 @@ cases:
query: data.test
error: data cannot be shadowed
- note: deprecated-function
data: {}
modules:
- |
package test
x {
cast_array([1])
}
query: data.test
want_result:
x: true
- note: invalid-deprecated-function
data: {}
modules:
@@ -478,4 +466,4 @@ cases:
cast_array([1])
}
query: data.test
error: is deprecated
error: could not find function cast_array

View File

@@ -1,6 +1,4 @@
v0/aggregates
v0/all
v0/any
v0/arithmetic
v0/array
v0/assignments
@@ -13,19 +11,12 @@ v0/bitsor
v0/bitsshiftleft
v0/bitsshiftright
v0/bitsxor
v0/casts
v0/comparisonexpr
v0/completedoc
v0/compositebasedereference
v0/compositereferences
v0/comprehensions
v0/containskeyword
v0/cryptohmacequal
v0/cryptohmacmd5
v0/cryptohmacsha256
v0/cryptohmacsha512
v0/cryptomd5
v0/cryptosha256
v0/dataderef
v0/defaultkeyword
v0/disjunction
@@ -88,9 +79,7 @@ v0/sets
v0/sprintf
v0/strings
v0/subset
v0/toarray
v0/topdowndynamicdispatch
v0/toset
v0/time
v0/trim
v0/trimleft
@@ -132,12 +121,6 @@ v1/compositebasedereference
v1/compositereferences
v1/comprehensions
v1/containskeyword
v1/cryptohmacequal
v1/cryptohmacmd5
v1/cryptohmacsha256
v1/cryptohmacsha512
v1/cryptomd5
v1/cryptosha256
v1/dataderef
v1/defaultkeyword
v1/disjunction
@@ -221,4 +204,4 @@ v1/uuid
v1/varreferences
v1/virtualdocs
v1/walkbuiltin
v1/withkeyword
v1/withkeyword

View File

@@ -214,6 +214,32 @@ fn run_opa_tests(opa_tests_dir: String, folders: &[String]) -> Result<()> {
// Mocks non-existent jwt builtin.
println!("skipping mock test for io.jwt.decode_verify: {}", case.note);
continue;
} else {
let tests_with_unsupported_builtins = ["jsonbuiltins/yaml round-trip"];
if tests_with_unsupported_builtins.contains(&case.note.as_str()) {
// The test expects unsupported built-in to be called.
println!("skipping test using unsupported builtins: {}", case.note);
continue;
}
let tests_with_deprecated_builtins = [
"regexmatch/re_match: ref",
"regexmatch/re_match: raw",
"regexmatch/re_match: raw: undefined",
"regexmatch/re_match",
"regexmatch/re_match: undefined",
"sets/set_diff: refs",
"withkeyword/builtin: http.send example",
"withkeyword/builtin-builtin: arity 1, replacement is simple",
"withkeyword/function: direct call, built-in replacement, arity 1, result captured",
"withkeyword/builtin-builtin: arity 1, replacement is compound",
"withkeyword/function: direct call, built-in replacement, arity 1",
];
if tests_with_deprecated_builtins.contains(&case.note.as_str()) {
// The test expects deprecated built-in to be called.
println!("skipping test using deprecated builtins: {}", case.note);
continue;
}
}
// Normalize for comparison.