Commit 975bfa0
authored
Minor version upgrading OPA/Rego compatibility with new language features, (#208)
crypto/JWT support, and build system improvements.
**New Features**
- OPA Rego compatibility upgraded from v1.8.0 to v1.14.1.
- Added template string interpolation support (`$"Hello {name}!"` and
`` $`raw {expr}` ``), including the `internal.template_string` built-in.
- Added `array.flatten` built-in.
- Added `crypto.*` built-in family: hashing (MD5, SHA1, SHA256), HMAC
(MD5, SHA1, SHA256, SHA512), X.509 certificate parsing and verification,
RSA key parsing, and key pair parsing.
`crypto.x509.parse_and_verify_certificates_with_options` is not yet
implemented (no OPA conformance tests exist for it).
- Added `io.jwt.*` built-in family: `decode`, `decode_verify`, `encode_sign`,
`encode_sign_raw`, and signature verification for HS256/384/512,
RS256/384/512, PS256/384/512, ES256/384/512, and EdDSA.
EdDSA is only available with the OpenSSL backend.
- Added pluggable crypto backend architecture controlled by the
`REGOCPP_CRYPTO_BACKEND` CMake option:
- `mbedtls` (default) — Mbed TLS v3.6.2, built from source via
FetchContent with zero system dependencies on any platform.
- `openssl3` — OpenSSL 3.0+ (requires system install).
- `bcrypt` — Windows CNG (Windows only, no external dependencies).
- `""` — Crypto disabled; crypto/JWT builtins return an error at runtime.
- Added Windows CMake presets (`debug-windows`, `release-windows`,
`debug-windows-opa`, `release-windows-opa`) using the `bcrypt` backend.
- Wrapper builds (Python, Rust, .NET) now pass the crypto backend through to
CMake. Python and .NET use `bcrypt` on Windows and `mbedtls` elsewhere;
Rust uses `mbedtls` on all platforms.
**Bug Fixes**
- Fixed `numbers.range_step` behavior to match current OPA expectations.
- Fixed `strings.count` with empty substring to return `len(s)+1` instead of
looping indefinitely, matching OPA semantics.
- Fixed `split` with empty delimiter to split into individual characters,
matching OPA semantics.
- Fixed JSON object key deduplication to use last-wins semantics, matching
Go `json.Unmarshal` and OPA behavior.
- Fixed `sprintf` `%v` format to render sets using Rego display syntax
(`{1, 2, 3}` / `set()`) instead of internal angle-bracket representation.
- Fixed `to_json`/`to_key` rendering of `true`, `false`, and `null` for
synthetically constructed AST nodes with empty locations.
**Migration Notes**
- JSON objects with duplicate keys now keep only the last value for each key
("last-wins" semantics), matching Go `json.Unmarshal` and OPA behavior.
Previously, duplicate keys were preserved in the AST. If your data documents
or inputs contain duplicate keys and you relied on earlier values being
visible, those values will now be silently dropped.
- `crypto.x509.parse_and_verify_certificates` follows OPA's convention: the
last certificate in the PEM bundle is treated as the leaf (workload)
certificate; all others are treated as CA or intermediate certificates.
Revocation checking (CRL/OCSP) is not performed, matching OPA behavior.
**Build & Infrastructure**
- Upgraded Trieste dependency (switched regex engine from RE2 to TRegex).
Validated against full OPA conformance test suite including regex patterns.
- Removed RE2 from link targets across all build configurations and wrappers.
- CI: Windows PR gate job now uses `release-windows-opa` preset.
- Added test infrastructure for marking tests as `unsupported` (used for
EdDSA tests on non-OpenSSL backends).
Signed-off-by: Matthew A Johnson <matjoh@microsoft.com>
Signed-off-by: Matthew Johnson <matjoh@microsoft.com>1 parent a10e095 commit 975bfa0
65 files changed
Lines changed: 12055 additions & 117 deletions
File tree
- .github
- skills
- bump-version
- code-review
- opa-compat-check
- references
- reports
- plan-conservative
- plan-security
- plan-speed
- plan-usability
- rego-fuzzer
- references
- regocpp-builtins
- references
- trieste-dev
- references
- workflows
- include/rego
- src
- builtins
- tests
- tools
- wrappers
- dotnet/Rego
- python
- rust/regorust
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
0 commit comments