165 Commits

Author SHA1 Message Date
Stephan Renatus dc77f2e259 workflows: report benchmark regressions back to pull request
Let's see if this works, it's a bit experimental at this point.

The twist comparred to how it's been done in EOPA (for example) is that
we're running the benchmarks post-merge, and report back if at the end
we find a failing check. This way, the PR goes green without having to
wait for the benchmarks, but there's still a connection between PR and
benchmark.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-05-08 10:01:50 +02:00
Johan Fylling b6c3ac1860 ast: Enable future.keywords.not in default capabilities (#8609)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2026-05-06 14:32:33 +02:00
Stephan Renatus b16fdc6137 e2e/cli: add test for debug print() logging (#8567)
* e2e/cli: add test for debug `print()` logging

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>

* ci: add *.txtar to "golang_change_suffixes"


This is so that e2e/cli testscript definitions cause CI runs.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>

---------

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-04-27 14:00:07 +00:00
Charlie Egan 13a123beac build: Exclude domains that cause false positives (#8533)
Several external domains frequently timeout during link checking.
Fixes #8495

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
2026-04-20 14:17:05 +00:00
Charlie Egan a57f2ef42d cicd: Split link checker into docs & repo checks (#8492)
We have fixed most of the broken links! But,
https://github.com/open-policy-agent/opa/issues/8464 is mostly not useful now
as we are checking the docs site internal links which are already checked at
build time which is done in PRs.

This change makes two jobs, one for the repo, and one for the docs site. The
OPA domain is ignored for website checks.

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
2026-04-07 15:05:44 +01:00
Johan Fylling c850487e06 planner: Add not-body support to planner (#8458)
Fixes: #8392

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2026-03-31 11:30:22 +02:00
Johan Fylling 670d2e2556 ast, topdown: Add not AST node type (#8427)
Disabled by default. To enable, `not` future keyword must be present in capabilities and imported into Rego module.

Implements: #8391

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2026-03-30 18:12:57 +02:00
Philip Conrad 2165d44ad6 build/generate-extended-cases: Fix testcase loader to use json.Number. (#8429)
The testcase generator had a bug where very large numbers would be
parsed incorrectly, truncating the lower bits off their values.

This was discovered to be caused by the YAML library defaulting
to parsing all numeric values into floating point numbers, which
lose precision at larger sizes.

The fix was to provide the YAML unmarshaling function with the
appropriate equivalent of `(*json.Decoder).UseNumber()` at the
callsite. This causes the YAML library to use `json.Number`
types by default, just as we expect almost everywhere else in
Rego.

Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
2026-03-19 10:35:03 +01:00
Sebastian Spaink 1ac64ef1a5 Filter compliance test cases using capabilities file (#8418)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2026-03-12 22:23:23 +00:00
Johan Fylling acf81e85d6 Release v1.14.0 (#8379) 2026-02-26 16:21:02 +01:00
Philip Conrad 019086bc3c ci: Harden and update all GH Actions workflows.
This PR contains fixes for all findings by the static analysis
tool zizmor, and reduces the attack surface available in our
GH Actions workflows by a decent margin.

The most notable change: our post-tag workflow now does not
use the actions cache, to prevent cache poisoning attacks.
This will drive up release publishing times, but eliminates
an attack vector on those releases.

Other changes:
 - We also update all of our Slack alerting steps to use the
   official slackapi/slack-github-action project, instead of the
   archived project we were using before.
 - A new `yaml` change detection category to has been added
   to the `check-changes` job, allowing later jobs and steps
   in the pull-request workflow to run conditionally on
   YAML-based changes.
 - An explicit linting job that runs the zizmor Github Actions
   static analysis tool on the repo when YAML changes are
   detected.

Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
2026-02-23 07:00:32 +01:00
Sebastian Spaink 573070615c Add public method to extend the compliance test cases with IR plans (#8313)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2026-02-12 15:51:34 +00:00
SeanLedford bcd57a207c Decoupled the Rego job check from the Go job checks in the Github PR workflow (#8203)
Added coverage for the new Rego check

Signed-off-by: seanledford <s_ledford@apple.com>
2026-01-12 17:27:36 +00:00
Ville Vesilehto d7c03a8783 fix: format pr_check.rego with opa fmt (#8201)
File was not properly formatted, causing CI to fail.

Signed-off-by: Ville Vesilehto <ville@vesilehto.fi>
2026-01-09 21:49:41 +01:00
SeanLedford 73ea88a3ad build: Migrate PR check to OPA policy (#8183)
Signed-off-by: seanledford <s_ledford@apple.com>
2026-01-09 18:10:33 +01:00
Stephan Renatus d9ff3190d5 deps(build): bump wasmtime-go: v3 -> v37, crossbuild with zig
Due the way that wasmtime-go does its versioning, it seems to fly under
the radar of dependabot: that will never propose major version bumps, I
suppose.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2025-10-16 19:17:21 +02:00
Stephan Renatus 088e101ac0 build: bump go (1.24.6 -> 1.24.7) (#7881)
* build: bump go (1.24.6 -> 1.24.7)

https://groups.google.com/g/golang-announce/c/PtW9VW21NPs

* ci: run go stuff if .go-version changed
* Makefile: change debian base image

There is no 1.24.7-bullseye, because that distribution is EOL

* build: remove GOOS from Makefile call

Some change either in the debian trixie golang image, or in golang's
toolchain made this necessary: Prior to this commit, `GOOS` was set to
windows, causing a cross-build. We don't want a crossbuild for this
utility, we want to invoke the Linux binary (on the Linux host) to do
its job on a Windows binary (cross-built from the Linux host).

---------

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-09-04 14:44:57 +02:00
Stephan Renatus 184d1b553f ci: port binary tests to testscript
The assertions are stricter now, e.g. we're also checking that nothing
is emitted to stderr.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-08-29 17:57:50 +02:00
Johan Fylling a3e4851aa2 release: Adding Dockerfile for image used in *-patch build targets (#7864)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2025-08-27 16:41:56 +02:00
Philip Conrad 84b23ccedd bugfix: Add back default cmd.RootCommand definition. (#7811)
This commit fixes an issue when upgrading codebases to OPA v1.7.0.

In PR #7797, we introduced the ability to provide "branding"
information in OPA commands and help messages, which would
allow easier customized OPA distributions in the future.

However, this changeset removed the public symbol `cmd.RootCommand`,
and required refactoring to use `cmd.Command`, which breaks automated
upgrades, such as those done by Dependabot.

This PR adds back the missing symbol, with the original/default "OPA"
branding provided. This should allow existing codebases to upgrade
without requiring any code changes.

Signed-off-by: Philip Conrad <philip@chariot-chaser.net>
2025-07-31 12:55:34 -04:00
kevinstyra 94a953150a cmd: allow branding
This change allows users that build their own executable or "spin" of
OPA to give it a name, and have it reference itself properly in help
texts.

It's a vanity thing, but I think some people would appreciate it, hat
tip to the international association of pedants.

Signed-off-by: Stephan Renatus <stephan@styra.com>
Co-authored-by: kevinstyra <83973046+kevinstyra@users.noreply.github.com>
2025-07-24 11:33:23 +02:00
Anders Eknert 2963c82fde Use Regal for linting Rego (#7752)
Closing the circle here, or something.

Not a lot of Rego used in OPA yet, but some in examples and tests. The little
there is should be linted though, and it'd be good if any new addition of policies got
linted by default. But more than anything, the "ignore configuration" provided here
avoids having developers seeing thousands of issues reported by Regal when they
open the OPA project in VS Code or their editor of choice.

Someone might want to look into un-ignoring the doc directory at some point, as it's
probably a good idea to have the docs follow best practices.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-07-06 09:37:39 +00:00
Charlie Egan 45223def7e website: Disable cancel script (#7719)
This script is functioning correctly, but netlify can't stop sending
emails for cancelled build:

https://answers.netlify.com/t/deploy-notifications-cancel-vs-failure/37300
https://answers.netlify.com/t/differentiate-betweeen-cancel-and-failure-for-deployment-notifications/67054
https://answers.netlify.com/t/deploy-notification-cancel-vs-failure/88316

In order to avoid red-blindness, we are disabling the script so we get
emails only for failed builds.

Signed-off-by: Charlie Egan <charlie@styra.com>
2025-06-24 09:59:33 +01:00
Charlie Egan b0cd306a7f docs: Fix CLI documentation generation (#7600)
The new command is based on generating JSON for docusaurus consumption
rather than markdown. This is less error prone as manipulation of
markdown is better contained.

Signed-off-by: Charlie Egan <charlie@styra.com>
2025-05-20 11:21:10 +01:00
Charlie Egan d6b5659856 docs: Switch to new OPA website (#7592)
Some things added on this branch:
- icons and client logos at known paths
- some spam redirects
- some redirects for docs/latest/foo /docs/foo
- redirects for the two ‘moved’ pages (k8s and envoy intros)

I am going to be monitoring the traffic this week on Netlify to make
sure we have a good coverage with redirects where needed.
We also now prompt users to file issues directly from the 404 pages
which should help flag things we miss too.
2025-05-19 10:42:17 +00:00
Sebastian Spaink 804dcc1c98 feat: add version and icon to opa_windows_amd64.exe (#7501)
Signed-off-by: sspaink <sspaink@styra.com>
Co-authored-by: Philip Conrad <philip@chariot-chaser.net>
2025-04-10 07:41:59 -05:00
Anders Eknert afb30d3f9d Add gocritic linter, fix a bunch of stuff (#7377)
Brace yourselves! For there are many touched files here. No changes
in semantics however.

Spent a long time trying out the various optional rules gocritic
provides, and settled for a few of them. There are more I really
like, but that would take many hours to address across the codebase.

Perhaps others find gocritic too pedantic? If so, we can merge the
fixes without enabling the rule.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-24 16:28:41 +01:00
Anders Eknert 55e87e79ae Add perfsprint linter (#7334)
And update code to conform to the rule.

- Replace unnecessary fmt.Sprintf with string concatenation
- Replace fmt.Sprint with more efficient strconv.Itoa
- Replace static fmt.Errorf calls with more efficient errors.New

Thanks @srenatus for pushing me down this rabbit hole!

Signed-off-by: Anders Eknert <anders@styra.com>
2025-01-31 20:24:05 +01:00
Johan Fylling 563321d26b Rego v1 capabilities and keywords update (#7216)
* Separating v0- and v1 keywords
* Adding `rego_v1` capability feature

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-17 11:50:11 +01:00
Johan Fylling a179a24c48 v1 API
All packages, except for `cmd` and `internal`, have been moved into a new `v1` root package.

Old packages are kept for backwards-compatibility reasons. All contained code is replaced with simple type aliases and proxy functions to `v1` implementations.

Old packages default to the Rego v0 syntax, new `v1` packages default to the Rego v1 syntax.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:27:34 +01:00
Johan Fylling 7bb6dbe36b Preparing for v1 API
Moving (most) source to v1 root package to prepare for v0/v1 API separation.

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-12-12 15:09:03 +01:00
Stephan Renatus 55aa75df84 build: bump github.com/golang/glob, remove replace directive (#7056)
Just recently, glog introduced a fix for the potentially very expensive network
call on windows that had been troubling us before:

https://github.com/golang/glog/commit/97303146a4ffecf364d4300e07fca855d0062c43

It's become the v1.2.2 release.

The release is now in vendor, and the replacement has been removed.

Fixes #7024.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2024-09-24 12:16:02 +02:00
Andrea Peruffo 83f8dc636b Make it possible to only build wasm testcases
Signed-off-by: Andrea Peruffo <andrea.peruffo1982@gmail.com>
2024-08-14 11:55:25 -07:00
Ashutosh Narkar 8260697940 build: Update WASM Rego test generation setup (#6707)
This change updates the WASM Rego test generation docker
command to address CVE-2022-24765 in Git which could cause
it to execute arbitrary commands.

The error was seen when running the `make wasm-rego-test` target on
darwin/arm64.

Fixes: #6703

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2024-04-23 15:34:22 +02:00
Anders Eknert 92a4d1fb9e Add some docs on using env vars in place of CLI flags (#6631)
Not sure where to put this really as we don't have much in terms of docs
on the CLI outside of the generated ones. If there are more places where
this could be mentioned, let me know and I'll add it there too.

Signed-off-by: Anders Eknert <anders@styra.com>
2024-03-15 10:59:44 +01:00
Charlie Egan 35da78715d docs: Validate ecosystem keys (#6522)
At the moment we have some entries with . chars in their ids, this makes
the hugo page look up break, so now these are validated to be
sausage-case-values.

Signed-off-by: Charlie Egan <charlie@styra.com>
2024-01-11 13:42:43 +00:00
Ashutosh Narkar da306b68fd build: Migrate to GitHub CLI tool (#6329)
The `hub` tool is deprecated in favor of the GitHub CLI and
is removed from GitHub's action runner images.

Fixes: #6326

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-10-19 10:23:54 +02:00
Charlie Egan 9bf54788f5 [docs] Move OPA ecosystem pages to site top-level (#6198)
* We are having trouble managing the complexity of having ecosystem pages shown in the versioned area of the OPA docs site (see website: link ecosystem from edge #6170)
* We have invested in the OPA ecosystem data recently and it makes sense to make it more prominent.
* The data in the OPA Ecosystem is harder to use when nested in docs as some Hugo functions are unavailable to nested sections.

This PR implements a solution by:

* Pages that were under /docs/version/ecosystem, /docs/version/integrations etc have been moved to /ecosystem and /integrations.
* Redirects have been created for the old pages in the netlify config.

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-08-31 09:36:51 +01:00
Charlie Egan 1e4f120beb [docs] Update integrations, organisations and softwares to have pages (#6158)
This PR makes it possible to browse integrations, organizations and related softwares. Previously, these details were only available as modals on the ecosystem page.

There are also some changes to the policy enforcement on the docs content, the validation rules are much the same but have been updated to reflect that the content is stored in a new place. I have used some generated JSON in Hugo rather than using GitHub api requests to validate the files since it's A) faster, B) I think more simple, and C) easier to get Hugo to process the markdown frontmatter.

Much of the hackery in this PR (Hugo function partials to look up sets of files and get the data from them) is due to the fact that we can't use Hugo's native sections feature. All of our content is nested under docs, this means that all our pages are in the same section so custom lookups have been implemented as function partials instead to work around this.

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-08-17 16:09:33 +01:00
Johan Fylling 0b326a0f54 Updating release patch scripts to not include CR in output (#6069)
Fixes: #5784

Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2023-06-30 15:26:45 +02:00
Zoran Regvart 1ad399285b build: more SELinux labels for Docker volumes (#6061)
Ref #6054

Signed-off-by: Zoran Regvart <zoran@regvart.com>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 19:35:35 +02:00
Zoran Regvart a50c134f4f build: configure SELinux labels for Docker volumes (#6055)
When SELinux is enforced the mounted volumes to spun Docker containers
are not writable unless the `:z` or `:Z` flag is set[1].

This opts not to share the mounts by using `:Z`.

[1] https://docs.docker.com/storage/bind-mounts/#configure-the-selinux-label

Fixes #6054

Signed-off-by: Zoran Regvart <zoran@regvart.com>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 11:17:35 +02:00
Eng Zer Jun b3ae18d3a3 perf: avoid unnecessary byte/string conversion
We can use alternative functions/methods to avoid unnecessary
byte/string conversion calls.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2023-05-23 10:00:59 -07:00
Hari Kannan 56d6b9c334 opa inspect: fix prefix error when inspecting bundle from root (#5522)
This commit fixes an issue around Windows paths in `opa inspect`, and
updates the `build/binary-smoke-test.sh` script to check for the problem
in the future.

Fixes: #5503 

Signed-off-by: harikannan512 <harikannan512@gmail.com>
2023-01-24 14:19:45 -05:00
Anders Eknert d03a9ade6c Remove changelog maintainer mention filter (#5527)
But no need to mention when maintainers are issue reporters,
so keep that as is.

Signed-off-by: Anders Eknert <anders@styra.com>
2023-01-04 10:38:51 +01:00
Stephan Renatus 6f65add42b binary-smoke: fix typo, copy-edit script (#5518)
Small follow-up to #5508: typo and whitespace fix.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2023-01-03 10:08:26 +01:00
shm12 0e398fdcd7 opa inspect: Fix path of data namespaces on windows (#5508)
Instead of a hard-coded "/", we're now using os.PathSeparator to process
the file path. It's also cleaned before displaying.

Fixes part of #5503.

Signed-off-by: shm12 <shm.bia@gmail.com>
2023-01-03 09:53:14 +01:00
shm12 30356a7fc2 build: Fix wrong windows bundle tar files path separator (#5478)
Fix #5473.
 
Signed-off-by: shm12 <shm.bia@gmail.com>
2022-12-19 10:59:25 +01:00
Stephan Renatus 7c05205389 ast/visit: include LazyObject in walks (#5482)
In situations involving PE, it's possible that we walk over an AST that
contains objects taken from the store. With the lazy-objects
optimization, those objects had been neglected: the walker code only
cared for `*object`, not the `Object` interface, for performance reasons.

Now, we'll include the `Object` interface, which covers our lazy
objects, and thus include them in AST walks.

Fixes #5479.

* smoke test: update bundle to use some data

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-12-14 11:25:09 +01:00
Stephan Renatus e8828991f2 build: add CHANGELOG.md to website build triggers (#5456)
Before, the commit integrating the 0.46.2 and 0.47.1 patch releases failed to
trigger a website build.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2022-12-07 15:12:00 +01:00