Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Opa Knowledge Patch?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/nevaberry-opa-knowledge-patch)
---
name: opa-knowledge-patch
description: Open Policy Agent (OPA)
version: "1.23.0"
license: MIT
metadata:
author: Nevaberry
---
# Open Policy Agent compatibility guidance
Load this skill when migrating Rego, building or signing bundles, using the
Compile API, embedding OPA in Go, or changing server and decision-log settings.
The references contain the detailed behavior, examples, and release-specific fixes.
## Reference index
| Reference | Topics |
| --- | --- |
| [Migration and Rego](references/migration-and-rego.md) | Compatibility modes, rule heads, Rego v2, type checks, YAML |
| [CLI, Testing, and Bundles](references/cli-testing-and-bundles.md) | Bundle layout and signing, optimization, Wasm builds, tests, formatting, inspection |
| [Evaluation and Built-ins](references/evaluation-and-builtins.md) | SQL and Solr filters, partial evaluation, numeric precision, built-ins |
| [Go SDK and Tooling](references/go-sdk-and-tooling.md) | Go API changes, compiler and oracle, transports, Wasm lifetime, toolchains |
| [Observability and Decision Logs](references/observability-and-decision-logs.md) | Masking, labels, buffers, file logging, tracing, Prometheus and OTLP |
| [Server, Plugins, and Security](references/server-plugins-and-security.md) | Authorization, HTTP clients, TLS, configuration, downloads, plugin lifecycle |
## Breaking changes and deprecations
### Bundle roots, descriptors, and signatures
OPA 1.23.0 roots a local bundle directory at its exact `.manifest` file.
Files above that directory are excluded, with warnings from `opa build` and `opa sign`.
For local tarballs, put `.manifest`, `.signatures.json`, and `patch.json` at the archive root.
HTTP and OCI bundles and their persisted copies still load misplaced descriptors with warnings.
Rebuild affected bundles with `opa build -b ./bundle`, using the extracted manifest directory,
before a future release rejects them.
Signature paths are relative to the bundle root and use `/` on every platform in OPA 1.23.0.
Re-sign directory bundles signed by older `opa sign` or `opa build -b` versions,
and update `--exclude-files-verify` patterns to match the new paths.
When merging bundles, `opa build -b` writes a new root manifest; sign the merged build separately.
In OPA 1.21.3, a bundle or discovery `signing` block requires signed snapshot bundles.
With signature verification enabled, delta bundles are rejected by default.
To keep accepting unsigned deltas, set `bundles.<name>.signing.allow_unsigned_delta_bundles`
or `discovery.signing.allow_unsigned_delta_bundles` to `true`; snapshots still require signatures.
OPA 1.22.0 requires the exact basename `.signatures.json` and rejects multiple such files.
Re-sign affected bundles with OPA 1.22.0 or later so ordinary files ending in `signatures.json` are covered too.
### Language and type checks
The right side of `:=` must be safe independently of the left side in OPA 1.19.0.
Bind inputs in another expression, or use `some k` followed by `v := obj[k]`.
OPA 1.22.0 rejects a `some … in` binding if its introduced variable appears in the collection
expression; use a separate collection reference such as `some x in input.items`.
OPA 1.21.0 rejects iteration and lookups on literal empty collections.
OPA 1.22.2 accepts `some x in []` and non-constant lookups on empty collections,
yielding no bindings; constant lookups such as `[][0]` still raise `rego_type_error`.
For emptiness checks, use `count(x) == 0`: comparing `{}` or `[]` with a value statically
known to be nonempty is a type error in OPA 1.21.0.
OPA 1.21.0 parses bare YAML `y`, `n`, `yes`, `no`, `on`, and `off` as strings in
`--data`, bundles, server configuration, and `yaml.unmarshal`. Use `true` and `false` for booleans.
### Filter, security, and artifact changes
Upgrade Compile API SQL-filter emitters to OPA 1.19.0 or later for the SQL injection fix.
OPA 1.23.0 rejects `startswith`, `endswith`, and `contains` for
`application/vnd.opa.sql.mysql+json` and multitarget requests including `mysql`.
Their earlier `LIKE` translation used case- and accent-insensitive matching under default MySQL collations.
Recheck custom path-based authorization when upgrading to OPA 1.21.2 or 1.22.0:
the Data API handler and basic authorization policies resolve encoded paths consistently.
OPA 1.22.0 deprecates `_static` binaries.
OPA 1.22.4 binaries and images include the Go HTTP/1 fix for CVE-2026-97054;
source builds need a Go toolchain carrying that fix.
### Go integration changes
OPA's router uses `net/http.ServeMux`; integrations using `gorilla/mux` APIs directly need to adapt.
`HTTPAuthPlugin.NewClient()` is cached once per REST client instance;
move per-request authentication and side effects to `Prepare()`.
OPA 1.15.0 required `WithContext` on `v1/logging.Logger`; OPA 1.15.1 makes it optional.
In OPA 1.23.0, `bundle.Reader` rejects directory-loader manifests using `SlashRooted` or
`Passthrough` paths. Custom directory-loader wrappers should forward `RootOffset() string`.
## Migrate legacy Rego and rolling deployments
Bundle consumers use a declared `rego_version` ahead of runtime compatibility mode.
Upgrade producers first and use `--v0-compatible` while v0.x consumers remain.
Use the same flag on v1.0 consumers loading unversioned bundles with legacy Rego.
```sh
opa build --v0-compatible ./policy
```
Use the OPA 1.0 formatter to migrate syntax, then strict checks to catch shadowed
imports and declarations or assignments using reserved `input` and `data` names.
```sh
opa fmt --write --v0-v1 ./policy
opa check --v0-v1 --strict ./policy
```
Preserve set and object shapes when rewriting heads:
```rego
package migration
# Was p.a { true }
p contains "a" if { true }
# Was q.a.b { true }
q.a.b if { true }
# Was r.a
r contains "a"
# Was s.a.b
s.a.b := true
```
Replace `any`, `all`, `re_match`, `net.cidr_overlap`, `set_diff`, `cast_array`,
`cast_set`, `cast_string`, `cast_boolean`, `cast_null`, and `cast_object` before migrating to Rego v1.
On v0.x producers that write versioned manifests, `opa build --v1-compatible` records `rego_version: 1`.
When v0.x consumers support `rego.v1` and select syntax by imports, add `import rego.v1` to each migrated module.
OPA 1.23.0 adds `--compatible=<version>` for CLI compatibility selection.
## Opt in to Rego v2
In OPA 1.22.0, `import rego.v2` enables `and`, `or`, and improved `not` semantics
together, implies `rego.v1` in a v0 module, and requires `rego_v2_import` capability support.
```rego
package example
import rego.v2
allow if input.user.admin or not (input.user.suspended or input.user.locked)
```
The opt-in negation semantics bring argument evaluation inside negation:
`not` succeeds if a nested expression is undefined.
Select bundle versions with `rego_version: 2` or `file_rego_versions`; Go callers can use `ast.RegoV2`.
The `rego_v2` capability also implies `template_strings` and `keywords_in_refs`.
## Compile filters and specialize policies
POST to `/v1/compile/<path>` with a SQL media type in `Accept`.
Use `compile.unknowns` annotations for values left for translation and supply known values in the request.
The evaluation reference includes the complete policy, request, and returned SQL example.
For Solr, OPA 1.23.0 accepts `application/vnd.opa.lucene.solr+json` to produce a query for `fq` or `q`.
Use the searched document as the single unknown and request this target on its own.
Declare multivalued fields with `schemas` annotations and match elements with expressions
such as `"a" in input.doc.tags`.
The Go Rego API and Compile API can opt in to nondeterministic built-ins during partial evaluation.
With that option enabled, `http.send` can run during specialization if its arguments are known.
OPA 1.21.0 treats `json.verify_schema` and `json.match_schema` as nondeterministic;
opt in if those calls should run during partial evaluation.
OPA 1.22.0 unrolls `every` over known collections when its body contains unknowns,
with a 32-element limit across nested `every` expressions.
The Compile API can translate the resulting conjunction for data filtering.
## Test, format, and inspect
Use a named parameterized test head such as `test_concat[name]`, binding the case name in its body.
`opa test` reports each named case and fails the rule if any case fails.
Tests run in parallel by default, with one worker per available CPU core; `--parallel=1` runs sequentially.
```sh
opa test . --parallel=1
opa test --fail-on-empty -r 'test_allow' ./policy
opa test --strict-builtin-errors ./policy
```
`--fail-on-empty` errors when no tests run, including when a name filter matches nothing.
OPA 1.23.0 supports strict built-in errors during tests and includes labels in `opa inspect -a ./bundle`.
`opa test --coverage` reports source ranges and tracks inline rule heads and conjunction expressions;
refresh coverage baselines and check consumers of the report.
OPA 1.23.0 applies `--drop-v0-imports` to piped or redirected source:
`opa fmt --drop-v0-imports < policy.rego`.
## Configure logs, labels, and tracing
`decision_logs.reporting.buffer_type: event` reduces lock contention under heavy load,
but relaxes the default buffer's memory-footprint guarantees.
`decision_logs.reporting.trigger: immediate` sends logs once the configured upload chunk size is reached;
the configured delay still bounds how long a partly filled chunk waits.
Masking paths address array elements by zero-based index.
OPA 1.22.0 supports array-rooted `input` and `result`, supplies `metrics` and `error`
to mask/drop policies, and applies SDK masking to the nondeterministic built-in cache.
Rule-label maps are merged and deduplicated in decision logs; more specific annotations win:
`subpackages` < `package` < `document` < `rule`.
In OPA 1.21.0, `rule_labels=true` adds merged labels to Data and Query API responses.
Use `server.logger_plugin` and `decision_logs.plugin` with `file_logger` for rotating JSON logs.
Set `distributed_tracing.type` to `http` for an HTTP collector, and use
`distributed_tracing.exclude_paths` to omit selected paths.
OPA can export Prometheus metrics over OTLP, with custom collector headers and resource attributes.
In OPA 1.22.0, `--log-level-request=debug` hides HTTP request/response entries at general `info` level.
## Built-ins and embedded evaluation
`strings.split_n(s, delimiter, n)` returns first fields for positive counts and last fields,
in original order, for negative counts; zero gives an empty array and oversized counts give all fields.
`array.flatten` combines nested arrays; OPA 1.13.1 fixes its single-item array handling.
`json.pointer_escape("a/b~c")` returns `"a~1b~0c"` for one reference token in OPA 1.23.0.
OPA 1.23.0 compares numeric values exactly beyond `float64` precision.
Use `EvalHTTPRoundTrip` per evaluation or `WithHTTPRoundTrip` per query to customize `http.send` transport.
The callback receives OPA's configured transport and returns the `http.RoundTripper` to use.
SDK callers can also customize transport for an individual `Decision`.
The Wasm evaluation target and SDK use pure-Go `wazero`, removing their cgo build dependency;
linear memory is allocated on the Go heap and appears in heap profiles.
In OPA 1.23.0, `Rego.Eval` closes its Wasm engine after evaluation,
and closing a prepared query closes the Wasm resolvers it loaded.