Commit Graph

360 Commits

Author SHA1 Message Date
Sebastian Spaink 8e2f1807ac config: validate configuration with Rego and warn on unknown options (#8891)
Part of #2745

Like most of his ideas, @anderseknert's suggestion to use Rego to
replace the `validateAndInjectDefaults` functions throughout the
codebase is another winner.

This PR starts the migration by replacing the top-level
`validateAndInjectDefaults` in `v1/config/config.go` with an embedded
policy, `validate.rego`. The policy injects the top-level defaults
(`default_decision`, `default_authorization_decision`, `labels`) and
reports unrecognized configuration options, so a typo such as
`decision_log` instead of `decision_logs` is logged as a warning at
startup rather than silently ignored.

It's evaluated in `ParseConfig` using the low-level `ast`/`topdown`
packages rather than the top-level `rego` package. This keeps `config`
off the heavy `rego → bundle → …` dependency web (which would otherwise
create import cycles as more packages' tests reach `config`), and we
don't need any of the `rego` package's conveniences here — it's one
module compiled once and a single query. The Rego unit tests run in CI
via `build/run-rego-tests.sh` (and locally with `make rego-test`).

This sets the foundation for the other plugin
`validateAndInjectDefaults` functions to migrate to Rego as well; where
the logic isn't too complicated it should be a fairly easy replacement.
At the moment all known keys live in `validate.rego` under `_specs` to
support the "warn on unrecognized options" check, but the
plugin-specific entries can move closer to each plugin as it migrates.
It would also be nice for `_specs` to be auto-generated somehow in the
future.

Supporting extension of config validation with custom policies is
something I'd like to follow up with, so keeping #2745 open for now.

I also think these policies could be reusable with
[java-opa-sdk](https://github.com/open-policy-agent/java-opa-sdk) 👀

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2026-07-15 11:16:03 -05:00
Sebastian Spaink f6092b9ce4 add --format flag for proto/JSON plan bundles (#8825)
This change adds a new flag for emitting plan bundles in the new protobuf wire format. `opa build --format=json|proto`. With `--format=proto`, the bundle contains `/plan.pb` and `/.manifest.pb` in place of `/plan.json`and `/.manifest`. Bundle Reader auto-detects both forms; mixed-format bundles are rejected at read, merge, and write time.

Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2026-07-06 12:50:33 -05:00
Stephan Renatus 9c83b9948a wasm: replace wasmtime-go with wazero (#8815)
The change replaces bytecodealliance/wasmtime-go/v44 (CGo) with
tetratelabs/wazero (pure Go)

- CGo eliminated — wazero is pure Go, so the whole internal/wasm/sdk
runtime no longer needs a C toolchain/cross-compilation story.
- The "env glue module" trick (glue.go) is the right solution to
wazero's constraint that a HostModuleBuilder can't export memory.
- Process-wide CompilationCache (sync.OnceValue): each unique policy is
compiled once per process, and discarded/re-instantiated VMs are cheap.
- Simplification in vm.go — dropping the ~25 closure fields (evalOneOff,
eval, heapPtrGet, …) in favor of mod.ExportedFunction(name) + a generic
call/callVoid/callOrCancel
- All tests pass (incl. internal/wasm/sdk/internal/wasm,
internal/wasm/sdk/opa). evalCompat for ABI 1.1 is retained.


----------

```
                                │ bf2bb5261c13d2710058             │
                                │    sec/op    │   sec/op     vs base                │
WASMColdStartTargets/topdown-16    112.8µ ± 1%   113.3µ ± 1%        ~ (p=0.512 n=15)
WASMColdStartTargets/wasm-16      10.850m ± 1%   2.906m ± 1%  -73.22% (p=0.000 n=15)
geomean                            1.107m        573.9µ       -48.14%

benchmark \ host                local:tags=opa_wasm
                                            vs base
WASMColdStartTargets/topdown                      ~
WASMColdStartTargets/wasm                   -73.22%

```
```

            │ bf2bb5261c13d2710058             │
            │   sec/op    │   sec/op     vs base                │
WasmRego-16   4.976µ ± 1%   3.546µ ± 3%  -28.74% (p=0.000 n=15)

            │ bf2bb5261c13d2710058               │
            │     B/op     │     B/op       vs base                 │
WasmRego-16   2.276Ki ± 0%   13.260Ki ± 0%  +482.50% (p=0.000 n=15)

            │ bf2bb5261c13d2710058             │
            │  allocs/op  │ allocs/op   vs base                │
WasmRego-16    46.00 ± 0%   33.00 ± 0%  -28.26% (p=0.000 n=15)

benchmark \ host    local:tags=opa_wasm
                                vs base
WasmRego                        -28.74%
```

> [!NOTE]
> When running benchmarks here, be aware that the memory previously used
was invisible to the benchmark machinery -- it was on the other side of
the CGo divide 🙈

Fixes #7557.

---------

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-06-26 17:40:03 +02:00
Stephan Renatus cb94b005f5 build: go install -> go install tool to control checksums
This is slightly more control, avoiding a supply chain risk.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-05-12 12:31:04 +02:00
Stephan Renatus 6f113ba009 ci: golangci-lint bump to v2.12.2 (#8623)
https://github.com/golangci/golangci-lint/releases/tag/v2.12.2

Mostly because I couldn't make sense of the failures in
https://github.com/open-policy-agent/opa/pull/8622

---------

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-05-08 13:15:11 +02:00
Sebastian Spaink f645d91097 Remove edge releases (#8615)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2026-05-07 08:47:15 -05:00
Stephan Renatus 598e5cb439 e2e/cli: start CLI E2E tests (#8545)
Using the lovely testscript package with a couple of helpers.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-04-22 08:40:05 +00:00
Stephan Renatus 0d7e509613 ci: bump golangci-lint (v2.9.0), fix issues
https://github.com/golangci/golangci-lint/releases/tag/v2.9.0

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-02-12 08:42:05 +01:00
Anders Eknert d0350b326e Add array.flatten built-in function (#8232)
Originally meant to be `array.concat_n`, but this name is better
as the behavior of this function differs from `array.concat` —
namely that `array.flatten` accepts any type of valued in the
input array. Only arrays are however flattened, and the rest
are appended directly to the flattened output.

Note that this function only flattens at the topmost level of
the input array — not recursively! A cursory look
at a few other languages suggest a single level is the common case.
But if others feel we should flstten more, I'm happy to make an update.

The C code for a Wasm implementstion here is cowboy coded, and
I did not manage to run the tests on my machine due to some
`docker` <-> `container` differences. I mostly just imitated
the existing code in the array category. I doubt it'll work
on the first try, but only CI can judge me.

Also:
- Remove `opa fmt` step from the Rego CI step, as this is done by
  Regal anyway a little later in the list of tasks.
- Replace some hard-coded `docker` names in the `Makefile` with `$(DOCKER)`
- Added name of built-in function missing to the unsupportedBuiltinErr
  error, as it has happened a few times now that I've used `:=` in a
  query, and had no clue what built-in it referred to.

Fixes #8226

Signed-off-by: Anders Eknert <anders.eknert@apple.com>
2026-01-27 21:46:11 +00:00
dependabot[bot] fc03d9c7f8 build(deps): bump the e2e-prisma group in /e2e/api/compile/prisma with 2 updates (#8171)
* build(deps): bump the e2e-prisma group

Bumps the e2e-prisma group in /e2e/api/compile/prisma with 2 updates: [@prisma/client](https://github.com/prisma/prisma/tree/HEAD/packages/client) and [prisma](https://github.com/prisma/prisma/tree/HEAD/packages/cli).


Updates `@prisma/client` from 6.19.0 to 7.2.0
- [Release notes](https://github.com/prisma/prisma/releases)
- [Commits](https://github.com/prisma/prisma/commits/7.2.0/packages/client)

Updates `prisma` from 6.19.0 to 7.2.0
- [Release notes](https://github.com/prisma/prisma/releases)
- [Commits](https://github.com/prisma/prisma/commits/7.2.0/packages/cli)

---
updated-dependencies:
- dependency-name: "@prisma/client"
  dependency-version: 7.2.0
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: e2e-prisma
- dependency-name: prisma
  dependency-version: 7.2.0
  dependency-type: direct:development
  update-type: version-update:semver-major
  dependency-group: e2e-prisma
...

Signed-off-by: dependabot[bot] <support@github.com>

* e2e/prisma: manual upgrade for prisma 7

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stephan Renatus <stephan.renatus@gmail.com>
2026-01-08 15:49:47 +01:00
Charlie Egan 6601188c64 runtime: Correct naming & docs for version checking (#8191)
* runtime: Correct naming of version checking code

Rename telemetry functionality to version checking to accurately reflect
current behavior following
https://github.com/open-policy-agent/opa/pull/7756.

The system only checks GitHub releases for version updates without sending
any data about the OPA instance and so the privacy docs have been updated too.

Signed-off-by: Charlie Egan <charlie_egan@apple.com>

* Make WithTelemetryGatherers a no-op

Deprecate WithTelemetryGatherers since telemetry gathering has been removed.
The function now returns a no-op to maintain API compatibility without
breaking existing code that might uses it.

Signed-off-by: Charlie Egan <charlie_egan@apple.com>

---------

Signed-off-by: Charlie Egan <charlie_egan@apple.com>
2026-01-08 10:25:38 +00:00
Stephan Renatus 02ce64bc2b workflows/pull-request: don't build tag build in container
The GO_FLAGS setup through recursive Make invocations is a hassle, and we don't
use the resulting binaries anyways -- we just want to see that the build works.
We get that from a plain, on-the-runner build sans docker, too.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-12-08 16:53:18 +01:00
Stephan Renatus ba6824774e download: fix when compiling with tag opa_no_oci
The Makefile adjustments were needed to have the test compile actually work in CI.
Previously, it was just believed to work...

Fixes #8070.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-12-08 16:53:18 +01:00
Anders Eknert e03ac2f200 Bump golangci-lint, more gocritic linters (#8052)
- Bump golangci-lint -> 2.6.2
- Fix all `deprecatedComment` "notices should be in a dedicated paragraph, separated from the rest" reports
- Enable `appendCombine` and fix all "appendCombine: can combine chain of X appends into one" notices
- Enable `preferFprint` and fix the few reported issues
- Fix various issues reported only once or twice, like `zeroByteRepeat`

Signed-off-by: Anders Eknert <anders.eknert@apple.com>
2025-11-17 11:08:39 +01:00
dependabot[bot] f3ed541204 build(deps): bump github.com/containerd/containerd/v2 from 2.1.4 to 2.1.5 (#8025)
* build(deps): bump github.com/containerd/containerd/v2

Bumps [github.com/containerd/containerd/v2](https://github.com/containerd/containerd) from 2.1.4 to 2.1.5.
- [Release notes](https://github.com/containerd/containerd/releases)
- [Changelog](https://github.com/containerd/containerd/blob/main/RELEASES.md)
- [Commits](https://github.com/containerd/containerd/compare/v2.1.4...v2.1.5)

---
updated-dependencies:
- dependency-name: github.com/containerd/containerd/v2
  dependency-version: 2.1.5
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* make: add `go mod tidy` to e2e-prep target

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

---------

Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-11-10 09:32:22 +01:00
Stephan Renatus 9b1e7745db Makefile: include linux/arm64 in DOCKER_PLATFORMS
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-10-31 10:57:25 +01:00
Sebastian Spaink d87fe315c3 fix "Post Merge": add generate step for windows build
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2025-10-18 08:13:49 +02: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 ea8afef531 build: non-static images for linux/arm64
Previously, we excluded this because github had no arm64 runners,
and our maintainers had no access to arm64 machines. These days,
both is no longer a problem.

If we do this, you can finally pull openpolicyagent/opa:latest on
macos/arm64 without a platform warning (and emulation). Before,
you had to resort to using :latest-static, which is somewhat non-
intuitive.

Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-10-16 10:34:05 +02:00
Stephan Renatus 4ab2ac0c61 Port Compile API extensions from EOPA (#7887)
* server: port compile API

Also adds e2e tests: These include coverage for ucast in the prisma
setting, and thus require some JS runtime.

* e2e: selectively skip e2e Compile API tests

...for macos runs, and for the go-compat suites.

* server: accept timer_rego_external_resolve_ns metrics with value 0

When running the tests in a loop for a while, I would see values of 0ns
for this metric. However, comparing with its non-zero values, which are
often 41 or 42ns, it seems like this is just not happening in this code
path. So if "almost nothing" actually goes below 1ns, it's OK.

* e2e: split dep-heavy e2e tests into their own go module
* Makefile: export DOCKER_RUNNING (make e2e read it)

---------

Co-authored-by: Philip Conrad <philip@chariot-chaser.net>
Signed-off-by: Stephan Renatus <stephan.renatus@gmail.com>
2025-09-22 12:11:06 +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
Sebastian Spaink 8c0079f551 Bump golangci-lint to v2.4.0 (#7878)
Signed-off-by: Sebastian Spaink <sebastianspaink@gmail.com>
2025-09-03 15:21:30 -05: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
Charlie Egan 3546780664 website: Use latest release rather than edge (#7781)
Signed-off-by: Charlie Egan <charlie@styra.com>
2025-07-31 15:14:30 +00: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
Charlie Egan f3cb38dc05 docs: Remove live blocks (#7572)
These are no longer being used and are dependent on an old version of
node to work.

I have disabled the generation to allow the new docs site to be built. I
thought it made sense to remove all things relating to live blocks since
we have no plans to support them now anyway.

Signed-off-by: Charlie Egan <charlie@styra.com>
2025-05-12 12:41:57 +01:00
Charlie Egan 53ab5b7a80 docs: Deploy a new OPA website under /new (#7534)
* New site v1

Signed-off-by: Charlie Egan <charlie@styra.com>

* Add feature and language pages

Signed-off-by: Charlie Egan <charlie@styra.com>

* tidy data generation

Signed-off-by: Charlie Egan <charlie@styra.com>

* Import docs

Signed-off-by: Charlie Egan <charlie@styra.com>

* WIP

Signed-off-by: Charlie Egan <charlie@styra.com>

* Update content d65888c14f

Signed-off-by: Charlie Egan <charlie@styra.com>

* Refactor site to support any base path

Signed-off-by: Charlie Egan <charlie@styra.com>

* Use base URL for nav icons

Signed-off-by: Charlie Egan <charlie@styra.com>

* Refactor locations of community and support logos

Signed-off-by: Charlie Egan <charlie@styra.com>

* More asset refactoring

Signed-off-by: Charlie Egan <charlie@styra.com>

* Move k8s docs into correct location

Signed-off-by: Charlie Egan <charlie@styra.com>

* Build the sidebar

Signed-off-by: Charlie Egan <charlie@styra.com>

* Fix CLI formatting

Signed-off-by: Charlie Egan <charlie@styra.com>

* Fix broken links

Signed-off-by: Charlie Egan <charlie@styra.com>

* Tidy nav with some dividers

Signed-off-by: Charlie Egan <charlie@styra.com>

* Deploy under /new

Signed-off-by: Charlie Egan <charlie@styra.com>

* Deploy new site on preview too

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Link to OPA repo for GH nav link

Signed-off-by: Charlie Egan <charlie@styra.com>

* Updates to homepage

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Add a logo grid to homepage

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update homepage to have improved layout

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update homepage rego example

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update homepage logo list

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update PlaygroundExample to used ?? operator

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Add a simple search

We might want to come back to this later to make the results better but
this is as good as the current search.

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Add a docs archive page

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Revise homepage content and use demo video

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: correct archive version list

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Only support light mode

This is something we can come back to when we have time to review the
graphics for multi mode

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Link is available by default

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Remove blue hero color, and use smaller logo grid

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Correct ecosystem feature links

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Drop loadEcosystem

This is no longer needed as ecosystem pages are now loaded like other
pages (no special asset handling).

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update content to f308f61

This branch duplicates content to reformat some of it for the new site.
This commit ports in some of the new changes.

https://github.com/open-policy-agent/opa/compare/f7b002e17...f308f612b

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update slack logos

Use one with a transparent background instead.

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Use styled components, clear custom css

This keeps custom css to a minimum. Used for side by side and for hiding
the codeAPI text.

Signed-off-by: Charlie Egan <charlie@styra.com>

* docs: Update archive to show 1.4.2 release

Signed-off-by: Charlie Egan <charlie@styra.com>

---------

Signed-off-by: Charlie Egan <charlie@styra.com>
2025-05-12 10:36:10 +01:00
Sebastian Spaink 8424eea2a3 fix: remove resource.syso after building windows binary (#7507)
Signed-off-by: sspaink <sspaink@styra.com>
2025-04-10 10:06:39 -05: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 58c7d7aff2 Bump golangci-lint -> 1.64.5 (#7374)
Also:
- Replace deprecated tenv linter with usetesting, and address
  the issues it reported (nice!)

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-19 10:29:17 +01:00
Anders Eknert bfd09256b2 Add make test-short task (#7364)
By tagging the worst offenders, we can make use of `go test -short` to
avoid them for a quicker dev-test cycle. Compare:

```
make test       200.69s user 209.81s system 170% cpu 4:01.20 total
```
```
make test-short  70.32s user  29.17s system 350% cpu 28.367 total
```

From 4 minutes down to under 30 seconds. The short tests can either
be run with `go test -short ./...` or `make test-short`.

We'll still run the full test suite in CI, naturally.

Also:
- Remove section on benchmarking that linked to a no longer used resource.

Signed-off-by: Anders Eknert <anders@styra.com>
2025-02-14 14:27:47 +01:00
Ashutosh Narkar 00cc7ae275 Prepare v1.0.0 release
Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
Co-authored-by: Johan Fylling <johan.dev@fylling.se>
Co-authored-by: Stephan Renatus <stephan@styra.com>
2024-12-20 13:14:34 -08: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 20885fe4a9 golangci: bump version, addess all new findings
The previous version has been failing without any good reason for me,
so let's try this.

About the version pick: It's not the latest version (v1.62.0 at the
moment), because that would introduce a new revive rule,
redeclares-builtin-id, and that flags every variable called `min` or
`max` in the code base. I had started addressing these, but they were
just too many.

The new issues related to this version are mostly that it complains
whenever it finds a non-static string that makes its way into a printf-
like function. However, that's a common pattern in some place here, so
I've sprinkled some nolint:govet on it.

Signed-off-by: Stephan Renatus <stephan@styra.com>
2024-11-14 20:36:50 +01:00
Stephan Renatus 31120ce137 build: use chainguard images from dockerhub (#6830)
Signed-off-by: Stephan Renatus <stephan@styra.com>
2024-06-25 11:09:56 +02:00
Johan Fylling 5464b005e8 Bumping golangci-lint to v1.59.1 (#6817)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2024-06-19 15:13:43 +02: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
Philip Conrad 63e1877c48 linters+testdata: Reformat all yaml testcases for linting. (#6511)
This commit adds a config for yamllint, mass-reformats all of
the existing Yaml testcases to pass linting, and adds a Yaml
linting job to the pull-request Github Actions workflow. A few 
careful exceptions and ignores were added to the linter's
config to allow keeping our existing Yaml files with minimal
reformatting.

Signed-off-by: Philip Conrad <philipaconrad@gmail.com>
2024-01-10 13:16:01 -05:00
Fabio Coatti 73ed588077 Allow custom GOFLAGS (#6459)
In some cases it would be useful to specify custom GOFLAGS.
So, add the logic in Makefile and set the previous static value as default (-buildmode=exe)

closes #6458
Signed-off-by: Fabio Coatti <fabio.coatti@gmail.com>
2023-12-08 11:59:13 +01:00
Torin Sandall 85886a5ce4 chore: Disable verbose output in wasm-sdk-e2e-test (#6434)
The output is extremely noisy and there does not seem to be a good
reason for it to be enabled all of the time.

Signed-off-by: Torin Sandall <torin@styra.com>
2023-11-25 08:11:37 +01:00
Ashutosh Narkar eade10ae0e build: Remove rootless image variant
All published OPA images now run with a non-root uid/gid.
The uid:gid is set to 1000:1000 for all images. As a result
there is no longer a need for the --rootless image variant
hence it will not be published as part of future releases.
This change is in line with container security best practices.
OPA can still be run with root privileges by explicitly setting the user,
either with the --user argument for docker run, or by specifying
the securityContext in the Kubernetes Pod specification.

Fixes: #4295

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-11-02 08:55:09 -07:00
Johan Fylling d062d5f356 Prepare v0.55.0 development (#6066)
Signed-off-by: Johan Fylling <johan.dev@fylling.se>
2023-06-29 21:37:47 +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
Stephan Renatus 372293e79f build: use -bullseye golang image (#6063)
Signed-off-by: Stephan Renatus <stephan@styra.com>
2023-06-29 16:03:17 +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
Ashutosh Narkar 917bc9ce7b Disable provenance attestations in buildx
Buildx version >=0.10 generates a new OCI format
with support for provenance. As a result the
following error is generated on M1/M2 while inspecting
the manifest

> OCI manifest found, but accept header does not support OCI manifests

The suggested fix is to temporarily disable provenance.

Fixes: #5877

Signed-off-by: Ashutosh Narkar <anarkar4387@gmail.com>
2023-06-27 16:31:30 -07:00
Charlie Egan 2ade22958a Update to glibc-dynamic image (#6049)
cc-dynamic has been deprecated.

https://github.com/chainguard-images/images/blame/main/images/cc-dynamic/README.md#L23

Fixes https://github.com/open-policy-agent/opa/issues/6037

Needs https://github.com/chainguard-images/images/pull/937 before
merging.

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-06-26 14:51:29 +01:00
Charlie Egan 2f8c0cda7c Update debug build base images to remove openssl (#5787)
This completes the work started in https://github.com/open-policy-agent/opa/pull/5540

Fixes https://github.com/open-policy-agent/opa/issues/5544

We can't use distroless since they don't have a nossl cc image: https://github.com/GoogleContainerTools/distroless/issues/1210

Chainguard have added this (-dev rather than :debug) to their image collection: https://github.com/chainguard-images/images/issues/187

Following advice here, using their busybox is the best replacement for `gcr.io/distroless/static:debug` https://github.com/chainguard-images/images/pull/368#issuecomment-1478221177

Signed-off-by: Charlie Egan <charlie@styra.com>
2023-03-23 15:58:32 +00:00