From d7ef7a17e034534e68faba8b23f23aa1bf56e354 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 8 Jan 2025 11:25:57 -0800 Subject: [PATCH] build(deps): bump github.com/open-policy-agent/opa from 0.70.0 to 1.0.0 (#5251) * build(deps): bump github.com/open-policy-agent/opa from 0.70.0 to 1.0.0 Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 0.70.0 to 1.0.0. - [Release notes](https://github.com/open-policy-agent/opa/releases) - [Changelog](https://github.com/open-policy-agent/opa/blob/main/CHANGELOG.md) - [Commits](https://github.com/open-policy-agent/opa/compare/v0.70.0...v1.0.0) --- updated-dependencies: - dependency-name: github.com/open-policy-agent/opa dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] * Adjust imports for opa v1.0.0 release, hold back evaluator version to v0 language --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Evan Anderson --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/engine/eval/rego/datasources.go | 6 +++--- internal/engine/eval/rego/eval.go | 10 +++++++--- internal/engine/eval/rego/lib.go | 6 +++--- internal/engine/eval/rego/result.go | 2 +- pkg/api/protobuf/go/minder/v1/validators.go | 6 ++++-- 7 files changed, 24 insertions(+), 18 deletions(-) diff --git a/go.mod b/go.mod index 04b28871d4..7a58ef67bf 100644 --- a/go.mod +++ b/go.mod @@ -52,7 +52,7 @@ require ( github.com/olekukonko/tablewriter v0.0.5 github.com/open-feature/go-sdk v1.13.1 github.com/open-feature/go-sdk-contrib/providers/go-feature-flag-in-process v0.1.0 - github.com/open-policy-agent/opa v0.70.0 + github.com/open-policy-agent/opa v1.0.0 github.com/openfga/go-sdk v0.6.3 github.com/openfga/openfga v1.8.3 github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c @@ -142,7 +142,7 @@ require ( github.com/containerd/containerd v1.7.24 // indirect github.com/containerd/containerd/api v1.7.19 // indirect github.com/containerd/continuity v0.4.5 // indirect - github.com/containerd/errdefs v0.3.0 // indirect + github.com/containerd/errdefs v1.0.0 // indirect github.com/containerd/fifo v1.1.0 // indirect github.com/containerd/log v0.1.0 // indirect github.com/containerd/platforms v0.2.1 // indirect diff --git a/go.sum b/go.sum index 2c5a2d30c5..0ca8d30a79 100644 --- a/go.sum +++ b/go.sum @@ -272,8 +272,8 @@ github.com/containerd/containerd/api v1.7.19 h1:VWbJL+8Ap4Ju2mx9c9qS1uFSB1OVYr5J github.com/containerd/containerd/api v1.7.19/go.mod h1:fwGavl3LNwAV5ilJ0sbrABL44AQxmNjDRcwheXDb6Ig= github.com/containerd/continuity v0.4.5 h1:ZRoN1sXq9u7V6QoHMcVWGhOwDFqZ4B9i5H6un1Wh0x4= github.com/containerd/continuity v0.4.5/go.mod h1:/lNJvtJKUQStBzpVQ1+rasXO1LAWtUQssk28EZvJ3nE= -github.com/containerd/errdefs v0.3.0 h1:FSZgGOeK4yuT/+DnF07/Olde/q4KBoMsaamhXxIMDp4= -github.com/containerd/errdefs v0.3.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= +github.com/containerd/errdefs v1.0.0 h1:tg5yIfIlQIrxYtu9ajqY42W3lpS19XqdxRQeEwYG8PI= +github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ/kCkyJ2k+M= github.com/containerd/fifo v1.1.0 h1:4I2mbh5stb1u6ycIABlBw9zgtlK8viPI9QkQNRQEEmY= github.com/containerd/fifo v1.1.0/go.mod h1:bmC4NWMbXlt2EZ0Hc7Fx7QzTFxgPID13eH0Qu+MAb2o= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= @@ -850,8 +850,8 @@ github.com/open-feature/go-sdk v1.13.1 h1:RJbS70eyi7Jd3Zm5bFnaahNKNDXn+RAVnctpGu github.com/open-feature/go-sdk v1.13.1/go.mod h1:O8r4mhgeRIsjJ0ZBXlnE0BtbT/79W44gQceR7K8KYgo= github.com/open-feature/go-sdk-contrib/providers/go-feature-flag-in-process v0.1.0 h1:EFIT5QBQ/T3lNVLmma69SNQbAWBgAl+EtcH0VfrdM7Y= github.com/open-feature/go-sdk-contrib/providers/go-feature-flag-in-process v0.1.0/go.mod h1:DpptytCB+FbUIoRjTGtSDEA82aojWC4MIxL8GOK26Rs= -github.com/open-policy-agent/opa v0.70.0 h1:B3cqCN2iQAyKxK6+GI+N40uqkin+wzIrM7YA60t9x1U= -github.com/open-policy-agent/opa v0.70.0/go.mod h1:Y/nm5NY0BX0BqjBriKUiV81sCl8XOjjvqQG7dXrggtI= +github.com/open-policy-agent/opa v1.0.0 h1:fZsEwxg1knpPvUn0YDJuJZBcbVg4G3zKpWa3+CnYK+I= +github.com/open-policy-agent/opa v1.0.0/go.mod h1:+JyoH12I0+zqyC1iX7a2tmoQlipwAEGvOhVJMhmy+rM= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.1.0 h1:8SG7/vwALn54lVB/0yZ/MMwhFrPYtpEHQb2IpWsCzug= diff --git a/internal/engine/eval/rego/datasources.go b/internal/engine/eval/rego/datasources.go index 78b9c8e26a..8e9398b925 100644 --- a/internal/engine/eval/rego/datasources.go +++ b/internal/engine/eval/rego/datasources.go @@ -8,9 +8,9 @@ import ( "fmt" "strings" - "github.com/open-policy-agent/opa/ast" - "github.com/open-policy-agent/opa/rego" - "github.com/open-policy-agent/opa/types" + "github.com/open-policy-agent/opa/v1/ast" + "github.com/open-policy-agent/opa/v1/rego" + "github.com/open-policy-agent/opa/v1/types" v1datasources "github.com/mindersec/minder/pkg/datasources/v1" "github.com/mindersec/minder/pkg/engine/v1/interfaces" diff --git a/internal/engine/eval/rego/eval.go b/internal/engine/eval/rego/eval.go index fd2a597360..0b2dabf0d7 100644 --- a/internal/engine/eval/rego/eval.go +++ b/internal/engine/eval/rego/eval.go @@ -10,8 +10,9 @@ import ( "os" "github.com/open-feature/go-sdk/openfeature" - "github.com/open-policy-agent/opa/rego" - "github.com/open-policy-agent/opa/topdown/print" + "github.com/open-policy-agent/opa/v1/ast" + "github.com/open-policy-agent/opa/v1/rego" + "github.com/open-policy-agent/opa/v1/topdown/print" "google.golang.org/protobuf/reflect/protoreflect" "google.golang.org/protobuf/types/known/structpb" @@ -124,7 +125,10 @@ func (e *Evaluator) Eval( obj := res.Object // Register options to expose functions - regoFuncOptions := []func(*rego.Rego){} + regoFuncOptions := []func(*rego.Rego){ + // TODO: figure out a Rego V1 migration path (https://github.com/mindersec/minder/issues/5262) + rego.SetRegoVersion(ast.RegoV0), + } // Initialize the built-in minder library rego functions regoFuncOptions = append(regoFuncOptions, instantiateRegoLib(ctx, e.featureFlags, res)...) diff --git a/internal/engine/eval/rego/lib.go b/internal/engine/eval/rego/lib.go index 77752e09d4..e7f3f2697e 100644 --- a/internal/engine/eval/rego/lib.go +++ b/internal/engine/eval/rego/lib.go @@ -20,9 +20,9 @@ import ( "github.com/go-git/go-billy/v5" billyutil "github.com/go-git/go-billy/v5/util" "github.com/open-feature/go-sdk/openfeature" - "github.com/open-policy-agent/opa/ast" - "github.com/open-policy-agent/opa/rego" - "github.com/open-policy-agent/opa/types" + "github.com/open-policy-agent/opa/v1/ast" + "github.com/open-policy-agent/opa/v1/rego" + "github.com/open-policy-agent/opa/v1/types" "github.com/stacklok/frizbee/pkg/replacer" "github.com/stacklok/frizbee/pkg/utils/config" "gopkg.in/yaml.v3" diff --git a/internal/engine/eval/rego/result.go b/internal/engine/eval/rego/result.go index d713aa2557..0e020e6db9 100644 --- a/internal/engine/eval/rego/result.go +++ b/internal/engine/eval/rego/result.go @@ -8,7 +8,7 @@ import ( "fmt" "strings" - "github.com/open-policy-agent/opa/rego" + "github.com/open-policy-agent/opa/v1/rego" "google.golang.org/protobuf/reflect/protoreflect" engerrors "github.com/mindersec/minder/internal/engine/errors" diff --git a/pkg/api/protobuf/go/minder/v1/validators.go b/pkg/api/protobuf/go/minder/v1/validators.go index ed41311872..5ed534ffc5 100644 --- a/pkg/api/protobuf/go/minder/v1/validators.go +++ b/pkg/api/protobuf/go/minder/v1/validators.go @@ -11,7 +11,7 @@ import ( "github.com/go-playground/validator/v10" "github.com/itchyny/gojq" - "github.com/open-policy-agent/opa/ast" + "github.com/open-policy-agent/opa/v1/ast" "github.com/mindersec/minder/internal/util" ) @@ -224,7 +224,9 @@ func (rego *RuleType_Definition_Eval_Rego) Validate() error { return fmt.Errorf("%w: rego definition is empty", ErrInvalidRuleTypeDefinition) } - _, err := ast.ParseModule("minder-ruletype-def.rego", rego.Def) + // TODO: figure out a Rego V1 migration path (https://github.com/mindersec/minder/issues/5262) + _, err := ast.ParseModuleWithOpts("minder-ruletype-def.rego", rego.Def, + ast.ParserOptions{RegoVersion: ast.RegoV0}) if err != nil { return fmt.Errorf("%w: rego definition is invalid: %s", ErrInvalidRuleTypeDefinition, err) }