Repository navigation
Releases
v1.22.4
This is a fix release for a vulnerability (CVE-2026-97054) in Go's HTTP/1 server:
https://groups.google.com/g/golang-announce/c/iY8TY0wWgbM
net/http: HTTP/1 server crash due to MaxBytesReader header race
For HTTP/1 servers, when MaxBytesReader's limit is exceeded,
"Connection: close" header is automatically set without synchronization,
which might race with another header being set explicitly in the server
handler. As a result, an HTTP/1 server that utilizes MaxBytesReader or
MaxBytesHandler can crash due to runtime panic if its handler reads the
request body concurrently with writing the response header.Thanks to Jakub Ciolek (https://ciolek.dev) for reporting this issue.
This is CVE-2026-97054 and Go issue https://go.dev/issue/82563.
Note that our security guidance includes not running OPA with its interfaces exposed to adversarial actors, like the public internet. This is fixed regardless, if only to avoid too many spurious vulnerability checker reports.
Also note that if you build your OPA binaries yourself, this patch release does not apply to you, as you control the version of Go that's used. This patch release affects the published binaries and docker images of OPA.
v1.22.3
This is a bugfix release for a type checker regression in v1.22.0.
It also includes a dependency bump for github.com/klauspost/compress.
Note
The security advisory in question is GHSA-fpmh-frq8-7rj8.
Note that OPA does not support zstd compression in its handlers, but automated vulnerability checkers still flag this as an issue, which is why we bump this version in a patch release.
Allow keys of empty collections in rules replaced by with
A rule like default x := {} is typed as an empty collection, so any constant key on it is rejected, even though tests replace it using with. Empty collections in the types of rules that a with modifier targets are now typed as any.
Dependency Updates
- build(deps): Bump github.com/agnivade/levenshtein from 1.2.1 to 1.2.2
- build(deps): Bump github.com/foxcpp/go-mockdns from 1.2.0 to 1.3.0
- build(deps): Bump github.com/gobwas/glob from 1.0.0 to 1.1.0
- build(deps): Bump github.com/huandu/go-sqlbuilder from 1.43.0 to 1.44.1
- build(deps): Bump github.com/klauspost/compress from 1.20.0 to 1.20.3
- build(deps): Bump github.com/lestrrat-go/jwx/v3 from 3.3.0 to 3.4.0
- build(deps): Bump github.com/prometheus/client_golang from 1.24.1 to 1.25.0
- build(deps): Bump github.com/spf13/pflag from 1.0.10 to 1.1.0
- build(deps): Bump github.com/vektah/gqlparser/v2 from 2.5.58 to 2.5.64
- build(deps): Bump go.opentelemetry.io/contrib/bridges/prometheus from 0.71.0 to 0.72.0
- build(deps): Bump go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp from 0.71.0 to 0.72.0
- build(deps): Bump go.opentelemetry.io/otel from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetrichttp from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/sdk from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/sdk/metric from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/otel/trace from 1.46.0 to 1.47.0
- build(deps): Bump go.opentelemetry.io/proto/otlp from 1.11.0 to 1.11.1
- build(deps): Bump go.yaml.in/yaml/v3 from 3.0.5 to 3.0.6
- build(deps): Bump golang.org/x/sync from 0.23.0 to 0.24.0
- build(deps): Bump golang.org/x/term from 0.46.0 to 0.47.0
- build(deps): Bump golang.org/x/text from 0.42.0 to 0.43.0
- build(deps): Bump google.golang.org/grpc from 1.84.0 to 1.85.0
- build(deps): Bump oras.land/oras-go/v2 from 2.6.2 to 2.7.0
v1.22.2
This is a bugfix release for a type checker regression in v1.21.0.
Iterating an empty collection is rejected by the type checker
Policies that iterate a collection known to be empty, such as some x in [] or m[_] where m := {},
were rejected with rego_type_error: undefined ref. Iteration with a non-constant key is valid again, and simply
yields nothing. Comparing or unifying the elements of such a collection with a value is accepted as well.
Constant keys, like [][0], are still reported as undefined.
Reported by @kholia.
v1.22.1
This is a bugfix release for a rule indexer regression in v1.21.0.
x in {"a", input.y} never matches for a ref x
allow if {
input.x in {"a", input.y}
}For an input of {"x": "b", "y": "b"}, this should evaluate to true. Due to a bug in the
rule indexer, the rule body hadn't been returned, and allow thus evaluated to undefined.
Reported by @kholia.
v1.22.0
This release contains a mix of new features, performance improvements and bug fixes. Notably:
- New
rego.v2import - Configurable log level for HTTP access logs
- Stricter handling of bundle signature filenames (breaking change)
- Partial evaluation unrolls
everyover a known domain
Configurable log level for HTTP access logs
Added --log-level-request (default info) to control the level at which the HTTP
server's "Received request."/"Sent response." access log lines are emitted, independent
of the general --log-level. Set it to debug to keep those lines out of logs unless
--log-level is also turned up.
Authored by @srenatus
New rego.v2 import (#9224, #9269)
import rego.v2 enables the and and or keywords and the improved not semantics in one
import, in place of future.keywords.and, future.keywords.or, and future.keywords.not.
In a v0 module it also implies rego.v1. It is gated by the new rego_v2_import capability
feature.
package example
import rego.v2
allow if input.user.admin or not (input.user.suspended or input.user.locked)See Importing rego.v2.
Additionally: bundles can be declared as Rego v2 by setting the rego_version manifest attribute to 2 (individua
bundle modules by setting file_rego_versions); and the Go API accepts the new ast.RegoV2 rego-version when parsing,
compiling, and formatting Rego modules.
The rego.v2 import is a redundant no-op for modules loaded these ways.
See bundle file format.
Authored by @johanfylling
Stricter handling of bundle signature filenames (#9300)
Breaking change: We have corrected a long-standing bug in bundle signing and verification, which will cause bundles containing files matching the suffix pattern *signatures.json to no longer pass verification in newer versions of OPA.
These bundles will need to be re-signed by this or newer versions of OPA to have a correct .signatures.json file.
Bundles that do not contain filenames with the *signatures.json pattern are unaffected, and will continue to verify correctly across OPA versions.
OPA has historically been very lax in deciding where to source bundle signature data from during bundle verification, and would attempt to load bundle signatures data from any file in the bundle that had the filename suffix pattern *signatures.json.
This could cause surprising behavior at bundle verification time, and resulted in all files with the *signatures.json pattern being ignored for signing, allowing filenames like foosignatures.json to be added to a bundle without being integrity-checked by the bundle signature.
OPA now identifies the bundle signatures file by its exact basename .signatures.json (the same way it locates the bundle manifest and data files), so it is found regardless of any directory prefix, and a bundle containing more than one signatures file is rejected.
Additionally, OPA will now correctly detect and sign all other files with the suffix pattern *signatures.json, which may cause bundles signed by this and future versions of OPA to have different signatures from the same content signed by older versions of OPA.
Authored by @philipaconrad
Partial evaluation unrolls every over a known domain
Partial evaluation now evaluates an every over a known collection of at most 32 elements (counting nested everys together) once per element, instead of keeping it in the result when its body has unknowns. The result is the conjunction of the body for each element, which the data filtering targets of the Compile API can translate. See every.
Authored by @srenatus
Runtime, SDK, Tooling
- bundle: Avoid using filepath in FS directory loader (#9418) authored by @anderseknert
- bundle: Canonicalize
data.ymlfor bundle signatures (#9301) reported and authored by @philipaconrad - bundle: Name the missing key when a signing block has a keyid but no keys (#9408) authored by @sspaink
- bundle: Resolve wasm manifest paths against the base dir (#5620) authored by @sspaink, reported by @johanfylling
- bundle: Stricter bundle signatures filename handling. (#9289) reported and authored by @philipaconrad
- bundle: don't parse policies that activation deletes (#9339) authored by @srenatus
- cmd/version: Note that the _static binaries are deprecated (#9441) authored by @srenatus
- cmd: Replace spf13/viper with os.LookupEnv (#9288) authored by @sspaink
- compile: Escape slashes in annotation entrypoint paths (#6794) authored by @sspaink, reported by @srenatus
- compile: Report untranslatable policies as fragment errors (#9373) authored by @srenatus
- compile: mirror, not negate, a comparison with the unknown on the right (#9373) authored by @srenatus
- debug: Add JSON tags to debugger struct fields (#9335) authored by @anderseknert
- format: Adding
ast.RegoV2enum to Go API (#9377) authored by @johanfylling - format: Allow early exit on the fail condition (#9156) authored by @oleksii-udovychenko
- loader: Skip duplicate files and name the conflicting path in merge errors (#2983) authored by @sspaink, reported by @anderseknert
- metrics: Replace rcrowley/go-metrics with in-tree sample (#7536) reported and authored by @sspaink
- metrics: Tweak sample code (#9305) authored by @srenatus
- metrics_export: Support resource attributes on exported metrics (#9393) authored by @srenatus
- plugins/bundle: Optionally send superseded etags in If-None-Match (#9370) authored by @srenatus
- plugins/logs: Export decision log buffer size and upload counters to Prometheus (#3812) authored by @sspaink, reported by @anderseknert
- plugins/logs: Include metrics and error in mask and drop policy input (#9357) reported and authored by @girishkvs
- plugins/logs: Keep full chunks in the size buffer with manual trigger (#9349) authored by @sspaink
- plugins/logs: Support masking array-rooted input and result (#9356) reported and authored by @girishkvs
- plugins/status: Export decision log status and drop counters to Prometheus (#9285) authored by @sspaink, reported by @tsandall
- runtime: Allow configuring the HTTP access log level (#9290) authored by @srenatus
- runtime: Restart the serve routine to apply config file changes (#9184) authored by @sspaink, reported by @charlieegan3
- sdk: Convert ND builtins cache so decision log mask rules apply (#9355) reported and authored by @girishkvs
- server/types: Skip the extras decode when all top-level keys are known (#9378) authored by @sspaink
- server: Create TLS file watcher before returning listeners (#9420) authored by @sspaink
- server: Expose compile request body to the authorizer (#9427) authored by @srenatus
- server: Expose query API request body to the authorizer (#9427) authored by @srenatus
- server: Name not activated bundles in /health?bundles error (#6713) authored by @sspaink, reported by @ahd3r
- server: Report size and limit when request body is too large (#3310) authored by @sspaink, reported by @grosser
- server: Resolve encoded request paths consistently in authorizer and handlers (#9323) authored by @sspaink, reported by @abhishekkushwaha4u
- tester: Only trace tests that have test cases (#9409) reported and authored by @jbpros
Compiler, Topdown and Rego
- ast/parser: Set generated on true bodies (#9412) authored by @charlieegan3
- ast/scanner: Report non-breaking spaces as illegal characters (#5796) authored by @sspaink, reported by @anderseknert
- ast: Add...
v1.21.4
This release builds the OPA binary artifacts with the latest version of Go (v1.27.3).
See: https://groups.google.com/g/golang-announce/c/66pojueaQek
v1.21.3
v1.21.3
Bundle signature verification could be side-stepped (GHSA-g2pf-6v5v-qcc8)
An attacker able to alter bundle bytes could supply arbitrary policy and data to an OPA that was configured
to verify bundle signatures. This could happen if the attacker controls any of:
- OPA bundle/discovery service (including an artifact store it uses)
- MitM between OPA and bundle/discovery service
- write access to a file:// bundle path or the bundle persistence directory
Two separate side-steps are fixed:
Issue 1. Signature verification keyed on keyid rather than on the signing block
OPA only required a .signatures.json file when signing.keyid was set, so a bundle stripped of its signature was
accepted if only e.g. bundles[_].signing was set instead of bundles[_].signing.keyid. Verification now depends on
the presence of a signing block, as documented; keyid only selects which key to use.
Affected:
bundles[_].signingordiscovery.signingconfigured withoutkeyid: an empty block, or one with onlyscopeor
exclude_files.- Embedders (SDK, custom plugins,
v1/loader,v1/compile) callingbundle.NewVerificationConfig(keys, "", ...)with
an empty key id.
Not affected:
- Configurations with an explicit
bundles[_].signing.keyidordiscovery.signing.keyid. opa run/opa eval/opa buildwith--verification-key, which defaults--verification-key-idtodefault.
Passing--verification-key-id ""explicitly was affected.- Configurations with top-level
keysbut nosigningblock: not a verification opt-in before or after this fix.
Unsigned bundles are still accepted, and OPA now logs a warning at startup for bundles in this state.
Workaround: on affected versions, set an explicit keyid on every bundle that must be signed:
bundles:
authz:
service: acmecorp
resource: bundle.tar.gz
signing:
keyid: my_key # must name an entry under the top-level `keys`
discovery:
resource: /discovery.tar.gz
signing:
keyid: my_discovery_key
keys:
my_key:
algorithm: RS256
key: |
-----BEGIN PUBLIC KEY-----
...Further behaviour changes:
- A
signingblock with no entries under the top-levelkeysis now a startup configuration error, rather than a
configuration that rejects every signed bundle while accepting unsigned ones. bundle.NewVerificationConfignow requires signatures by default. Embedders can opt out with
WithSkipBundleVerification(true)or the new(*VerificationConfig).WithOptionalSignature().
Issue 2. Unsigned delta bundle downgrade
Delta bundles skipped verification entirely, so an attacker could replace a signed snapshot bundle with an unsigned
delta bundle on the same resource. The signed policy stays active while the attacker controls any data inside the
bundle's roots. Delta bundles not supporting signing
was documented, but unenforced. OPA now rejects them with delta bundles do not support signature verification.
Affected:
- Any bundle or discovery configuration with a
signingblock, with or withoutkeyid. opa run/opa evalwith--verification-key.
Not affected:
- Configurations that don't verify signatures: no
signingblock, or--skip-verify. Nothing was verified to begin
with.
Workaround: there is no configuration that makes affected versions reject delta bundles. Until upgrading, ensure
the integrity of the bundle bytes themselves: TLS terminated by OPA or a trusted hop, restricted write access to the
bundle service, artifact store and bundle persistence directory.
Bundle services that must keep serving unsigned delta bundles after upgrading can opt out per bundle with the new
bundles[_].signing.allow_unsigned_delta_bundles (or discovery.signing.allow_unsigned_delta_bundles) field.
Snapshot bundles must still be signed.
Reported by Brian Willows (@BrianWillows, Graith Internet, graith.co.uk), authored by @johanfylling.
v1.21.2
This release builds the OPA binary artifacts with the latest version of Go (v1.27.2), its standard library, and the golang.org/x/net dependency (v0.60.0).
See these security advisories:
- https://groups.google.com/g/golang-announce/c/U2fTuyDJznI
- https://groups.google.com/g/golang-announce/c/ZPwCyRUuGBs
Furthermore, it addresses a mismatch in how encoded slashes were handled in the input to a basic authorization policy and the Data API (#9323, reported by @abhishekkushwaha4u, fixed by @sspaink).
v1.21.1
This release fixes a compiler regression introduced in OPA v1.21.0.
Fix some … in/every in comprehensions nested in object and set literals (#9280)
A comprehension using some … in or every in its body, nested inside an object or set literal, was wrongly treated as ground, so the compiler skipped rewriting it. some … in then failed with rego_unsafe_var_error; every caused a compiler panic:
package example
p := {"k": [r.a | some r in input.xs]} # rego_unsafe_var_error: var r is unsafe
q := {[1 | every x in input.xs { x > 0 }]} # panicArray literals weren't affected, and neither were literals that contain some other non-ground term.
v1.21.0
This release contains a mix of new features and bug fixes. Notably:
- Improved rule indexing
- Improved rule recursion check
- YAML is parsed against the 1.2 core schema (breaking change)
Rules with general refs no longer collide in the recursion check (#6813)
Before, this was a recursion error:
package play
p[x].foo.bar if {
x := "a"
not p[x].foo.baz
}
p[x].foo.baz if {
x := "a"
false
}Rules with a variable in their head are all stored at the ground prefix of their ref, so
p[x].foo.bar and p[x].foo.baz looked like dependencies of each other. The compiler is
now less conservative and compares the ref parts past the prefix. Genuine cycles are still
reported.
The IR and Wasm targets however still return an error: they plan one function per ground
path prefix, and cannot evaluate part of a function that is still being planned.
Authored by @sspaink, reported by @tsandall
Data and Query APIs can return rule labels in the response (#9211)
# METADATA labels for evaluated rules were only available in decision log
events. The Data API (GET/POST /v1/data) and Query API (GET/POST /v1/query) now accept a rule_labels query parameter to include the same
merged labels in the response payload, under a rule_labels key.
Authored by @srenatus
Behavior change: response gzip compression now bounds its buffer to min_length (#9205)
The server's gzip response compression (server.encoding.gzip) buffered an entire
incoming Write call before deciding whether to compress, so a single large write could
grow the buffer well past min_length before that decision was made. The handler is now
built on klauspost/compress/gzhttp
instead of a hand-rolled buffer and gzip.Writer pool, which caps what it buffers to
min_length (floored at 512 bytes) before streaming the remainder through the chosen
path. min_length and compression_level behave the same as before; only gzip is
negotiated, not zstd.
Authored by @srenatus
YAML is now parsed against the 1.2 core schema (#5754, #6598)
OPA parsed YAML with a library pinned to go-yaml v2, which implements YAML 1.1. Under
1.1, the bare words y, n, yes, no, on and off resolve to booleans, so a
GitHub Actions workflow loaded with --data came back with true where it should have
had on:
on: push{ "true": "push" }These words are now plain strings, as the YAML 1.2 core schema specifies. true and
false are unaffected. This applies everywhere OPA reads YAML: --data, bundles,
config files, and the yaml.unmarshal builtin.
If you were relying on yes/no/on/off being read as booleans, quote the value and
use true/false instead.
Authored by @sspaink, reported by @scnewma and @johnc-c
Empty composite literals are now typed as empty (#7275)
The type checker used to give the empty object literal {} the type
object[any: any], the empty array literal [] the type array[any], and the
empty set literal set() the type set[any], i.e. the types of a collection
that may hold anything. Every other literal is typed by its contents, so
referencing a key that isn't there is caught at compile time — but only for
non-empty literals:
obj := {"foo": "bar"}
obj.bar # rego_type_error: undefined ref: obj.bar
obj := {}
obj.bar # compilesEmpty literals are now typed as what they are: an object with no properties, an
array with no items, and a set with no members. Both examples above now fail to
compile, and so does every other way of selecting from an empty literal,
including iterating one (some x in []).
Comparing an empty object or array literal against a value whose type says it
can't be empty ({"foo": "bar"} == {}) is now a match error too, the same way
{"foo": "bar"} == {"bar": "foo"} already was. Use count(x) == 0 to test a
collection for emptiness without asserting its type. Sets are unaffected here:
set[string] describes any set of strings, the empty one included, so
{"foo"} == set() still compiles.
Authored by @sspaink, reported by @disaverio
Rule indexing improvements
The rule indexer now excludes rules from more kinds of expression, and builds a smaller
trie to do it with. See Use indexed statements
for what is indexed.
startswith,endswith,strings.any_prefix_matchandstrings.any_suffix_match
are indexed when the base strings are known at compile time.- A reference that reads a key out of the object at its ground prefix in base data
(data.groups.admins.members[input.subject]) is indexed by asking that object for the
key, where such a ruleset used to leave every rule a candidate. - References rooted at a local variable (
x := input; x.foo == "a") are indexed the
same asinput.foo == "a", and a chain of assignments no longer drops the constraint
at the end of it. - A rule's path through the trie stops at the last level it constrains, and a reference
reached by several values no longer leaves the rest of the rule unindexed. - Candidates come back in declaration order, which the indexer documented but did not
do. Acomplete rules must not produce multiple outputserror now points at the first
of the conflicting definitions rather than the second, and partial evaluation names
and orders the generated locals of its support rules differently. What a policy
evaluates to is unaffected.
Changes
- ast: Count a ref once when an index entry replaces its var entry (#9257) authored by @srenatus, reported by @vlsi
- ast: Index a lookup into a collection in base data (#9235) authored by @srenatus
- ast: Index refs rooted at a local variable (#9081) authored by @srenatus
- ast: Let concrete index values supersede leftover "any" entries (#9081) authored by @srenatus
- ast: Number the references an index is built on (#9190) authored by @srenatus
- ast: Number the refs a rule requires (#9244) authored by @srenatus
- ast: Number the rules an index holds (#9190) authored by @srenatus
- ast: Keep refs no rule constrains to a value out of the trie (#9190) authored by @srenatus
- ast: Stop a rule index path at its last constrained level (#9108) authored by @srenatus
- ast: Walk a rule tree's children in a stable order (#9190) authored by @srenatus
- docs: Document indexing of refs rooted at a local variable (#9081) authored by @srenatus
- index: Also index suffix matching (endswith, strings.any_suffix_match) + some tweaks (#9164) authored by @srenatus
- perf: Add startswith and strings.any_prefix_match indexing (#9161) authored by @tsandall
- rego: Benchmark index lookups at every match position (#9190) authored by @srenatus
Runtime, SDK, Tooling
- compile: don't panic on non-string table/column mappings (#9241) authored by @sspaink
- debug: Adding
querystack-trace framing mode (#9128) authored by @johanfylling - dependencies: Include else bodies and unused ref bindings (#4814) authored by @sspaink, reported by @anderseknert
- download: Fix Trigger() racing a cancelled context into a false success (#9233) authored by @srenatus
- download: Fix ignored OCI downloader settings (#9113) authored by @sspaink
- download: Note that ociTarget.Exists is dead code (#9233) authored by @srenatus
- download: Resolve OCI bundles behind an image index (#7461) authored by @sspaink, reported by @zscott
- download: Stop BundleRequest timer on OCI early returns (#9233) authored by @srenatus
- fix:
runner.CapturePrintOutputsetting never read (#9104) authored by @anderseknert - format: don't drop comments after an inline
ifbody (#9109) authored by @sspaink, reported by @anderseknert - metricsexport: Support custom headers on the OTLP exporter (#9234) authored by @srenatus
- plugins/logs: Add trace_id, span_id and request_context to the event AST (#9193) authored by @sspaink
- plugins/logs: Fix data race on the cached mask and drop queries (#9189) ...