pulumi / pulumi-policy-opa

A bridge enabling Pulumi CrossGuard to run OPA rules
12 stars 5 forks source link

Bump github.com/open-policy-agent/opa from 0.15.1 to 0.40.0 #12

Closed dependabot[bot] closed 2 years ago

dependabot[bot] commented 2 years ago

Bumps github.com/open-policy-agent/opa from 0.15.1 to 0.40.0.

Release notes

Sourced from github.com/open-policy-agent/opa's releases.

v0.40.0

This release contains a number of fixes and enhancements.

Metadata introspection

The rich metadata added in the v0.38.0 release can now be introspected from the policies themselves!

package example

METADATA

title: Edits by owner only

description: |

Only the owner is allowed to edit their data.

deny[{"allowed": false, "message": rego.metadata.rule().description}] { input.user != input.owner }

This snippet will evaluate to

[{
  "allowed": false,
  "message": "Only the owner is allowed to edit their data.\n"
}]

Both the rule's metadata can be accessed, via rego.metadata.rule(), and the entire chain of metadata attached to the rule via the various scopes that different metadata annotations can have, via rego.metadata.chain().

All the details can be found in the documentation of these new built-in functions.

Function mocking

It is now possible to mock functions in tests! Both built-in and non-built-in functions can be mocked:

package authz
import data.jwks.cert
import data.helpers.extract_token

allow { [true, _, _] = io.jwt.decode_verify(extract_token(input.headers), {"cert": cert, "iss": "corp.issuer.com"}) }

test_allow { allow with input.headers as [] with data.jwks.cert as "mock-cert" with io.jwt.decode_verify as [true, {}, {}] # mocked built-in with extract_token as "my-jwt" # mocked non-built-in }

For further information about policy testing with data and function mock, see the Policy Testing docs. All details about with can be found in its Policy Language section.

... (truncated)

Changelog

Sourced from github.com/open-policy-agent/opa's changelog.

0.40.0

This release contains a number of fixes and enhancements.

Metadata introspection

The rich metadata added in the v0.38.0 release can now be introspected from the policies themselves!

package example

METADATA

title: Edits by owner only

description: |

Only the owner is allowed to edit their data.

deny[{"allowed": false, "message": rego.metadata.rule().description}] { input.user != input.owner }

This snippet will evaluate to

[{
  "allowed": false,
  "message": "Only the owner is allowed to edit their data.\n"
}]

Both the rule's metadata can be accessed, via rego.metadata.rule(), and the entire chain of metadata attached to the rule via the various scopes that different metadata annotations can have, via rego.metadata.chain().

All the details can be found in the documentation of these new built-in functions.

Function mocking

It is now possible to mock functions in tests! Both built-in and non-built-in functions can be mocked:

package authz
import data.jwks.cert
import data.helpers.extract_token

allow { [true, _, _] = io.jwt.decode_verify(extract_token(input.headers), {"cert": cert, "iss": "corp.issuer.com"}) }

test_allow { allow with input.headers as [] with data.jwks.cert as "mock-cert" with io.jwt.decode_verify as [true, {}, {}] # mocked built-in

... (truncated)

Commits
  • b3c8d80 Prepare v0.40.0 Release (#4631)
  • 39125a0 downloader: support for downloading bundles from an OCI registry (#4558)
  • 2f6b417 format: keep whitespaces for multiple indented same-line withs (#4635)
  • 7e50293 ast+topdown+planner: replacement of non-built-in functions via 'with' (#4616)
  • 02c1c1e bundle/status: Include bundle type in status information
  • 654b245 docs: update version in kubernetes examples (#4627)
  • 8e79fc9 build(deps): bump github.com/fsnotify/fsnotify v1.5.2 -> v1.5.4 (#4628)
  • 4154d99 Dockerfile: add source annotation (#4626)
  • b481f00 topdown/net: require prefix length for IPv6 in net.cidr_merge (#4613)
  • eb94b73 website: add playground button to navbar (#4622)
  • Additional commits viewable in compare view


Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) - `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language - `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language - `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language - `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language You can disable automated security fix PRs for this repo from the [Security Alerts page](https://github.com/pulumi/pulumi-policy-opa/network/alerts).