OPA v0.46.1 #297
srenatus
announced in
Announcements
OPA v0.46.1
#297
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
This is bugfix release to resolve an issue in the release pipeline. Everything else is
the same as 0.46.0, which contains a mix of bugfixes, optimizations, and new features:
New language feature: refs in rule heads
With this version of OPA, we can use a shorthand for defining deeply-nested structures
in Rego:
Before, we had to use multiple packages, and hence multiple files to define a structure
like this:
Now, we can define those rules in single package (and file):
Note that in this example, the use of the future keyword
if
is mandatoryfor backwards-compatibility: without it,
get.allowed
would be interpretedas
get["allowed"]
, a definition of a partial set rule.Currently, variables may only appear in the last part of the rule head:
The valid rule defines this structure:
To define a nested key-value pair, we would use
Multi-value rules (previously referred to as "partial set rules") that are
nested like this need to use
contains
future keyword, to differentiate themfrom the "last part is a variable" case mentioned just above:
This rule defines the same structure, but with multiple values instead of a key:
To ensure that it's safe to build OPA policies for older OPA versions, a new
capabilities field was introduced: "features". It's a free-form string array:
If this key is not present, the compiler will reject ref-heads. This could be
case when building bundles for older OPA version using their capabilities.
Entrypoint annotations in rule metadata
It is now possible to annotate a rule with
entrypoint: true
, and it willautomatically be picked up by the tooling that expected
--entrypoint
(-e
)parameters before.
For example, to build this rego policy into a wasm module, you had to pass
an entrypoint:
package test allow { input.x }
opa build --target wasm --entrypoint test/allow policy.rego
With the annotation:
opa build --target wasm policy.rego
The places where entrypoints are taken from metadata are:
opa eval
Knowing a module's entrypoints can also help in different analysis tasks.
New Built-in Functon:
graphql.schema_is_valid
The new built-in allows checking schemas:
Requested by @olegroom.
New Built-in Functon:
net.cidr_is_valid
The new built-in function allows checking if a string is a valid CIDR.
Authored by @ricardomaraschini.
Tooling, SDK, and Runtime
opa build
: exit with failure on empty signing key (#4972) authored by @Joffref reported by @caldwecropa exec
: add--fail
and--fail-defined
flags (#5007) authored by @byronic reported by @phantlantisopa exec
: convert slashes of explicit bundles (Windows) (#5134) reported by @peterchenaddedopa test
: check coverage limit range[0, 100]
(#5284) authored by @hzliangbin reported by @aholmisopa build
+opa check
: respect capabilities for parsing, i.e. future keywords (#5323) reported by @TheLunaticScripteropa bench --e2e
: support providing OPA config (#4899)opa eval
: new explain mode,--explain=debug
, that includes unifcations in traces (authored by @jaspervdj)Decision logs: Allow rule-based dropping of decision log entries (#3945) authored by @mariusblarsen and @iamatwork
Decision Logs: Include the
req_id
attribute in the decision logs (#5006) reported and authored by @humbertoc-silvaPlugins: export OpenTelemetry TracerProvider for use in plugins (authored by @vinhph0906)
Compiler + Topdown
graph.reachable_path
: fix issue with missing subpaths (#4666) authored by @fredallen-wkhttp.send
: Ensureforce_cache
attribute ignoresDate
header (#4960) reported by @bartandaccwith
: Allow replacing functions with rules (#5299)Evaluation: Skip default functions in full extent (#5202) reported by @ericjkao
Evaluation: capture more cases of conflicts in function evaluation (#5272)
Rule Indexing: fix incorrect results from indexing
glob.match
even if output is captured (#5283)Planner: various correctness fixes: #5271, #5265, #5252
Builtins: Refactor registration functions and signatures (authored by @philipaconrad)
Compiler: Speed up typechecker when working with Refs (authored by @philipaconrad)
Trace: add
UnifyOp
to tracer events (authored by @jaspervdj)Documentation
semver
examplesWebsite + Ecosystem
Miscellaneous
Code Cleanup:
ioutil
functionst.Setenv
in testst.TempDir
to create temporary test directory (authored by @Juneezee)unconvert
andtenv
internal/strvals: port helm strvals fix (CLI --set arguments), reported by @pjbgf, helm fix authored by @mattfarina
Wasm: Update README
Dependency bumps, notably:
👉 Release page
Beta Was this translation helpful? Give feedback.
All reactions