build(deps): bump github.com/open-policy-agent/opa from 1.2.0 to 1.3.0

Bumps [github.com/open-policy-agent/opa](https://github.com/open-policy-agent/opa) from 1.2.0 to 1.3.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/v1.2.0...v1.3.0)

---
updated-dependencies:
- dependency-name: github.com/open-policy-agent/opa
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
This commit is contained in:
dependabot[bot]
2025-04-02 12:36:26 +00:00
committed by GitHub
parent 2609d0e589
commit 0636d906ac
26 changed files with 4973 additions and 55 deletions

2
go.mod
View File

@@ -62,7 +62,7 @@ require (
github.com/onsi/ginkgo v1.16.5
github.com/onsi/ginkgo/v2 v2.23.3
github.com/onsi/gomega v1.36.3
github.com/open-policy-agent/opa v1.2.0
github.com/open-policy-agent/opa v1.3.0
github.com/opencloud-eu/reva/v2 v2.29.1
github.com/orcaman/concurrent-map v1.0.0
github.com/owncloud/libre-graph-api-go v1.0.5-0.20240829135935-80dc00d6f5ea

14
go.sum
View File

@@ -258,8 +258,8 @@ github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS3
github.com/deepmap/oapi-codegen v1.3.11/go.mod h1:suMvK7+rKlx3+tpa8ByptmvoXbAV70wERKTOGH3hLp0=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I=
github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE=
github.com/dgraph-io/badger/v4 v4.5.1 h1:7DCIXrQjo1LKmM96YD+hLVJ2EEsyyoWxJfpdd56HLps=
github.com/dgraph-io/badger/v4 v4.5.1/go.mod h1:qn3Be0j3TfV4kPbVoK0arXCD1/nr1ftth6sbL5jxdoA=
github.com/dgraph-io/badger/v4 v4.6.0 h1:acOwfOOZ4p1dPRnYzvkVm7rUk2Y21TgPVepCy5dJdFQ=
github.com/dgraph-io/badger/v4 v4.6.0/go.mod h1:KSJ5VTuZNC3Sd+YhvVjk2nYua9UZnnTr/SkXvdtiPgI=
github.com/dgraph-io/ristretto v0.2.0 h1:XAfl+7cmoUDWW/2Lx8TGZQjjxIQ2Ley9DSf52dru4WE=
github.com/dgraph-io/ristretto v0.2.0/go.mod h1:8uBHCU/PBV4Ag0CJrP47b9Ofby5dqWNh4FicAdoqFNU=
github.com/dgraph-io/ristretto/v2 v2.1.0 h1:59LjpOJLNDULHh8MC4UaegN52lC4JnO2dITsie/Pa8I=
@@ -504,8 +504,8 @@ github.com/gomodule/redigo v1.9.2 h1:HrutZBLhSIU8abiSfW8pj8mPhOyMYjZT/wcA4/L9L9s
github.com/gomodule/redigo v1.9.2/go.mod h1:KsU3hiK/Ay8U42qpaJk+kuNa3C+spxapWpM+ywhcgtw=
github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ=
github.com/google/flatbuffers v24.12.23+incompatible h1:ubBKR94NR4pXUCY/MUsRVzd9umNW7ht7EG9hHfS9FX8=
github.com/google/flatbuffers v24.12.23+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/flatbuffers v25.2.10+incompatible h1:F3vclr7C3HpB1k9mxCGRMXq6FdUalZ6H/pNX4FP1v0Q=
github.com/google/flatbuffers v25.2.10+incompatible/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8=
github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M=
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
@@ -863,8 +863,8 @@ github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7J
github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo=
github.com/onsi/gomega v1.36.3 h1:hID7cr8t3Wp26+cYnfcjR6HpJ00fdogN6dqZ1t6IylU=
github.com/onsi/gomega v1.36.3/go.mod h1:8D9+Txp43QWKhM24yyOBEdpkzN8FvJyAwecBgsU4KU0=
github.com/open-policy-agent/opa v1.2.0 h1:88NDVCM0of1eO6Z4AFeL3utTEtMuwloFmWWU7dRV1z0=
github.com/open-policy-agent/opa v1.2.0/go.mod h1:30euUmOvuBoebRCcJ7DMF42bRBOPznvt0ACUMYDUGVY=
github.com/open-policy-agent/opa v1.3.0 h1:zVvQvQg+9+FuSRBt4LgKNzJwsWl/c85kD5jPozJTydY=
github.com/open-policy-agent/opa v1.3.0/go.mod h1:t9iPNhaplD2qpiBqeudzJtEX3fKHK8zdA29oFvofAHo=
github.com/opencloud-eu/reva/v2 v2.29.1 h1:SgB2zn8d/3UWwFiJ0pUs85aDKJJ36JoKnyRM+iW+VoI=
github.com/opencloud-eu/reva/v2 v2.29.1/go.mod h1:+nkCU7w6E6cyNSsKRYj1rb0cCI7QswEQ7KOPljctebM=
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
@@ -1177,6 +1177,8 @@ go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0 h1:1fTNlAIJZGWLP5FVu0f
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.35.0/go.mod h1:zjPK58DtkqQFn+YUMbx0M2XV3QgKU0gS9LeGohREyK4=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0 h1:m639+BofXTvcY1q8CGs4ItwQarYtJPOWmVobfM1HpVI=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.35.0/go.mod h1:LjReUci/F4BUyv+y4dwnq3h/26iNOeC3wAIqgvTIZVo=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0 h1:xJ2qHD0C1BeYVTLLR9sX12+Qb95kfeD/byKj6Ky1pXg=
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.35.0/go.mod h1:u5BF1xyjstDowA1R5QAO9JHzqK+ublenEW/dyqTjBVk=
go.opentelemetry.io/otel/metric v1.35.0 h1:0znxYu2SNyuMSQT4Y9WDWej0VpcsxkuklLa4/siN90M=
go.opentelemetry.io/otel/metric v1.35.0/go.mod h1:nKVFgxBZ2fReX6IlyW28MgZojkoAkJGaE8CpgeAU3oE=
go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY=

File diff suppressed because it is too large Load Diff

View File

@@ -2363,6 +2363,10 @@ func rewrittenVar(vars map[ast.Var]ast.Var, k ast.Var) ast.Var {
return rw
}
func dont() ([][]*ast.Rule, []ir.Operand, int, bool) {
return nil, nil, 0, false
}
// optimizeLookup returns a set of rulesets and required statements planning
// the locals (strings) needed with the used local variables, and the index
// into ref's parth that is still to be planned; if the passed ref's vars
@@ -2379,9 +2383,6 @@ func rewrittenVar(vars map[ast.Var]ast.Var, k ast.Var) ast.Var {
// var actually matched_ -- so we don't know which subtree to evaluate
// with the results.
func (p *Planner) optimizeLookup(t *ruletrie, ref ast.Ref) ([][]*ast.Rule, []ir.Operand, int, bool) {
dont := func() ([][]*ast.Rule, []ir.Operand, int, bool) {
return nil, nil, 0, false
}
if t == nil {
p.debugf("no optimization of %s: trie is nil", ref)
return dont()
@@ -2409,6 +2410,10 @@ outer:
opt = true
// take all children, they might match
for _, node := range nodes {
if nr := node.Rules(); len(nr) > 0 {
p.debugf("no optimization of %s: node with rules (%v)", ref, refsOfRules(nr))
return dont()
}
for _, child := range node.Children() {
if node := node.Get(child); node != nil {
nextNodes = append(nextNodes, node)
@@ -2416,8 +2421,12 @@ outer:
}
}
case ast.String:
// take all children that either match or have a var key
// take all children that either match or have a var key // TODO(sr): Where's the code for the second part, having a var key?
for _, node := range nodes {
if nr := node.Rules(); len(nr) > 0 {
p.debugf("no optimization of %s: node with rules (%v)", ref, refsOfRules(nr))
return dont()
}
if node := node.Get(r); node != nil {
nextNodes = append(nextNodes, node)
}
@@ -2436,10 +2445,20 @@ outer:
// let us break, too.
all := 0
for _, node := range nodes {
all += node.ChildrenCount()
if i < len(ref)-1 {
// Look ahead one term to only count those children relevant to your planned ref.
switch ref[i+1].Value.(type) {
case ast.Var:
all += node.ChildrenCount()
default:
if relChildren := node.Get(ref[i+1].Value); relChildren != nil {
all++
}
}
}
}
if all == 0 {
p.debugf("ref %s: all nodes have 0 children, break", ref[0:index+1])
p.debugf("ref %s: all nodes have 0 relevant children, break", ref[0:index+1])
break
}
@@ -2548,3 +2567,11 @@ func (p *Planner) isFunction(r ast.Ref) bool {
func op(v ir.Val) ir.Operand {
return ir.Operand{Value: v}
}
func refsOfRules(rs []*ast.Rule) []string {
refs := make([]string, len(rs))
for i := range rs {
refs[i] = rs[i].Head.Ref().String()
}
return refs
}

View File

@@ -280,7 +280,7 @@ func buildAuthorizationHeader(credentialStr, signedHeadersStr, signingSignature
return parts.String()
}
func (s *httpSigner) buildCanonicalHeaders(host string, rule v4Internal.Rule, header http.Header, length int64) (signed http.Header, signedHeaders, canonicalHeadersStr string) {
func (*httpSigner) buildCanonicalHeaders(host string, rule v4Internal.Rule, header http.Header, length int64) (signed http.Header, signedHeaders, canonicalHeadersStr string) {
signed = make(http.Header)
const hostHeader = "host"

View File

@@ -288,7 +288,7 @@ func (x ExportDescriptorType) String() string {
}
// Kind returns the function import type kind.
func (i FunctionImport) Kind() ImportDescriptorType {
func (FunctionImport) Kind() ImportDescriptorType {
return FunctionImportType
}
@@ -297,7 +297,7 @@ func (i FunctionImport) String() string {
}
// Kind returns the memory import type kind.
func (i MemoryImport) Kind() ImportDescriptorType {
func (MemoryImport) Kind() ImportDescriptorType {
return MemoryImportType
}
@@ -306,7 +306,7 @@ func (i MemoryImport) String() string {
}
// Kind returns the table import type kind.
func (i TableImport) Kind() ImportDescriptorType {
func (TableImport) Kind() ImportDescriptorType {
return TableImportType
}
@@ -315,7 +315,7 @@ func (i TableImport) String() string {
}
// Kind returns the global import type kind.
func (i GlobalImport) Kind() ImportDescriptorType {
func (GlobalImport) Kind() ImportDescriptorType {
return GlobalImportType
}

View File

@@ -3030,7 +3030,7 @@ func (qc *queryCompiler) resolveRefs(qctx *QueryContext, body Body) (Body, error
return resolveRefsInBody(globals, ignore, body), nil
}
func (qc *queryCompiler) rewriteComprehensionTerms(_ *QueryContext, body Body) (Body, error) {
func (*queryCompiler) rewriteComprehensionTerms(_ *QueryContext, body Body) (Body, error) {
gen := newLocalVarGenerator("q", body)
f := newEqualityFactory(gen)
node, err := rewriteComprehensionTerms(f, body)
@@ -3040,13 +3040,13 @@ func (qc *queryCompiler) rewriteComprehensionTerms(_ *QueryContext, body Body) (
return node.(Body), nil
}
func (qc *queryCompiler) rewriteDynamicTerms(_ *QueryContext, body Body) (Body, error) {
func (*queryCompiler) rewriteDynamicTerms(_ *QueryContext, body Body) (Body, error) {
gen := newLocalVarGenerator("q", body)
f := newEqualityFactory(gen)
return rewriteDynamics(f, body), nil
}
func (qc *queryCompiler) rewriteExprTerms(_ *QueryContext, body Body) (Body, error) {
func (*queryCompiler) rewriteExprTerms(_ *QueryContext, body Body) (Body, error) {
gen := newLocalVarGenerator("q", body)
return rewriteExprTermsInBody(gen, body), nil
}

View File

@@ -60,6 +60,9 @@ const (
// RecursionErr indicates recursion was found during compilation.
RecursionErr = "rego_recursion_error"
// FormatErr indicates an error occurred during formatting.
FormatErr = "rego_format_error"
)
// IsError returns true if err is an AST error with code.

View File

@@ -541,7 +541,7 @@ func NullTerm() *Term {
}
// Equal returns true if the other term Value is also Null.
func (null Null) Equal(other Value) bool {
func (Null) Equal(other Value) bool {
switch other.(type) {
case Null:
return true
@@ -552,7 +552,7 @@ func (null Null) Equal(other Value) bool {
// Compare compares null to other, return <0, 0, or >0 if it is less than, equal to,
// or greater than other.
func (null Null) Compare(other Value) int {
func (Null) Compare(other Value) int {
if _, ok := other.(Null); ok {
return 0
}
@@ -560,7 +560,7 @@ func (null Null) Compare(other Value) int {
}
// Find returns the current value or a not found error.
func (null Null) Find(path Ref) (Value, error) {
func (Null) Find(path Ref) (Value, error) {
if len(path) == 0 {
return NullValue, nil
}
@@ -568,7 +568,7 @@ func (null Null) Find(path Ref) (Value, error) {
}
// Hash returns the hash code for the Value.
func (null Null) Hash() int {
func (Null) Hash() int {
return 0
}
@@ -577,7 +577,7 @@ func (Null) IsGround() bool {
return true
}
func (null Null) String() string {
func (Null) String() string {
return "null"
}
@@ -3036,7 +3036,7 @@ func (c Call) Compare(other Value) int {
}
// Find returns the current value or a not found error.
func (c Call) Find(Ref) (Value, error) {
func (Call) Find(Ref) (Value, error) {
return nil, errFindNotFound
}

View File

@@ -226,7 +226,7 @@ func (u *unifier) unifyAll(a Var, b Value) {
}
}
func (u *unifier) varVisitor() *VarVisitor {
func (*unifier) varVisitor() *VarVisitor {
return NewVarVisitor().WithParams(VarVisitorParams{
SkipRefHead: true,
SkipObjectKeys: true,

View File

@@ -411,6 +411,11 @@ func (w *writer) writePackage(pkg *ast.Package, comments []*ast.Comment) []*ast.
// Omit head as all packages have the DefaultRootDocument prepended at parse time.
path := make(ast.Ref, len(pkg.Path)-1)
if len(path) == 0 {
w.errs = append(w.errs, ast.NewError(ast.FormatErr, pkg.Location, "invalid package path: %s", pkg.Path))
return comments
}
path[0] = ast.VarTerm(string(pkg.Path[1].Value.(ast.String)))
copy(path[1:], pkg.Path[2:])
@@ -432,9 +437,19 @@ func (w *writer) writeComments(comments []*ast.Comment) {
}
func (w *writer) writeRules(rules []*ast.Rule, comments []*ast.Comment) []*ast.Comment {
for _, rule := range rules {
for i, rule := range rules {
comments = w.insertComments(comments, rule.Location)
comments = w.writeRule(rule, false, comments)
if i < len(rules)-1 && w.groupableOneLiner(rule) {
next := rules[i+1]
if w.groupableOneLiner(next) && next.Location.Row == rule.Location.Row+1 {
// Current rule and the next are both groupable one-liners, and
// adjacent in the original policy (i.e. no extra newlines between them).
continue
}
}
w.blankLine()
}
return comments
@@ -442,6 +457,18 @@ func (w *writer) writeRules(rules []*ast.Rule, comments []*ast.Comment) []*ast.C
var expandedConst = ast.NewBody(ast.NewExpr(ast.InternedBooleanTerm(true)))
func (w *writer) groupableOneLiner(rule *ast.Rule) bool {
// Location required to determine if two rules are adjacent in the policy.
// If not, we respect line breaks between rules.
if len(rule.Body) > 1 || rule.Default || rule.Location == nil {
return false
}
partialSetException := w.fmtOpts.contains || rule.Head.Value != nil
return (w.fmtOpts.regoV1 || w.fmtOpts.ifs) && partialSetException
}
func (w *writer) writeRule(rule *ast.Rule, isElse bool, comments []*ast.Comment) []*ast.Comment {
if rule == nil {
return comments
@@ -463,14 +490,14 @@ func (w *writer) writeRule(rule *ast.Rule, isElse bool, comments []*ast.Comment)
comments = w.writeHead(rule.Head, rule.Default, isExpandedConst, comments)
// this excludes partial sets UNLESS `contains` is used
partialSetException := w.fmtOpts.contains || rule.Head.Value != nil
if len(rule.Body) == 0 || isExpandedConst {
w.endLine()
return comments
}
// this excludes partial sets UNLESS `contains` is used
partialSetException := w.fmtOpts.contains || rule.Head.Value != nil
if (w.fmtOpts.regoV1 || w.fmtOpts.ifs) && partialSetException {
w.write(" if")
if len(rule.Body) == 1 {
@@ -924,7 +951,7 @@ func (w *writer) writeRefStringPath(s ast.String) {
}
}
func (w *writer) formatVar(v ast.Var) string {
func (*writer) formatVar(v ast.Var) string {
if v.IsWildcard() {
return ast.Wildcard.String()
}

View File

@@ -106,7 +106,7 @@ const (
Unused
)
func (a *Policy) String() string {
func (*Policy) String() string {
return "Policy"
}

View File

@@ -6,6 +6,7 @@ package ir
import (
"encoding/json"
"fmt"
"reflect"
)
@@ -50,7 +51,11 @@ func (a *Operand) UnmarshalJSON(bs []byte) error {
if err := json.Unmarshal(bs, &typed); err != nil {
return err
}
x := valFactories[typed.Type]()
f, ok := valFactories[typed.Type]
if !ok {
return fmt.Errorf("unrecognized value type %q", typed.Type)
}
x := f()
if err := json.Unmarshal(typed.Value, &x); err != nil {
return err
}
@@ -77,7 +82,11 @@ type rawTypedStmt struct {
}
func (raw rawTypedStmt) Unmarshal() (Stmt, error) {
x := stmtFactories[raw.Type]()
f, ok := stmtFactories[raw.Type]
if !ok {
return nil, fmt.Errorf("unrecognized statement type %q", raw.Type)
}
x := f()
if err := json.Unmarshal(raw.Stmt, &x); err != nil {
return nil, err
}
@@ -119,6 +128,7 @@ var stmtFactories = map[string]func() Stmt{
"IsArrayStmt": func() Stmt { return &IsArrayStmt{} },
"IsObjectStmt": func() Stmt { return &IsObjectStmt{} },
"IsDefinedStmt": func() Stmt { return &IsDefinedStmt{} },
"IsSetStmt": func() Stmt { return &IsSetStmt{} },
"IsUndefinedStmt": func() Stmt { return &IsUndefinedStmt{} },
"ArrayAppendStmt": func() Stmt { return &ArrayAppendStmt{} },
"ObjectInsertStmt": func() Stmt { return &ObjectInsertStmt{} },

View File

@@ -178,7 +178,7 @@ func (m *metrics) Clear() {
m.counters = map[string]Counter{}
}
func (m *metrics) formatKey(name string, metrics interface{}) string {
func (*metrics) formatKey(name string, metrics interface{}) string {
switch metrics.(type) {
case Timer:
return "timer_" + name + "_ns"

View File

@@ -376,7 +376,7 @@ func (ap *oauth2ClientCredentialsAuthPlugin) createAuthJWT(ctx context.Context,
return &jwt, nil
}
func (ap *oauth2ClientCredentialsAuthPlugin) mapKMSAlgToSign(alg string) (string, error) {
func (*oauth2ClientCredentialsAuthPlugin) mapKMSAlgToSign(alg string) (string, error) {
switch alg {
case "ECDSA_SHA_256":
return "ES256", nil
@@ -758,7 +758,7 @@ func (ap *clientTLSAuthPlugin) NewClient(c Config) (*http.Client, error) {
return client, nil
}
func (ap *clientTLSAuthPlugin) Prepare(_ *http.Request) error {
func (*clientTLSAuthPlugin) Prepare(_ *http.Request) error {
return nil
}

View File

@@ -69,7 +69,7 @@ type awsEnvironmentCredentialService struct {
logger logging.Logger
}
func (cs *awsEnvironmentCredentialService) credentials(context.Context) (aws.Credentials, error) {
func (*awsEnvironmentCredentialService) credentials(context.Context) (aws.Credentials, error) {
var creds aws.Credentials
creds.AccessKey = os.Getenv(accessKeyEnvVar)
if creds.AccessKey == "" {

View File

@@ -24,7 +24,7 @@ type TargetPluginEval interface {
Eval(context.Context, *EvalContext, ast.Value) (ast.Value, error)
}
func (r *Rego) targetPlugin(tgt string) TargetPlugin {
func (*Rego) targetPlugin(tgt string) TargetPlugin {
for _, p := range targetPlugins {
if p.IsTarget(tgt) {
return p

View File

@@ -1985,7 +1985,7 @@ func (r *Rego) parseInput() (ast.Value, error) {
return r.parseRawInput(r.rawInput, r.metrics)
}
func (r *Rego) parseRawInput(rawInput *interface{}, m metrics.Metrics) (ast.Value, error) {
func (*Rego) parseRawInput(rawInput *interface{}, m metrics.Metrics) (ast.Value, error) {
var input ast.Value
if rawInput == nil {
@@ -2615,7 +2615,7 @@ func (r *Rego) rewriteQueryToCaptureValue(_ ast.QueryCompiler, query ast.Body) (
return query, nil
}
func (r *Rego) rewriteQueryForPartialEval(_ ast.QueryCompiler, query ast.Body) (ast.Body, error) {
func (*Rego) rewriteQueryForPartialEval(_ ast.QueryCompiler, query ast.Body) (ast.Body, error) {
if len(query) != 1 {
return nil, errors.New("partial evaluation requires single ref (not multiple expressions)")
}
@@ -2641,7 +2641,7 @@ func (r *Rego) rewriteQueryForPartialEval(_ ast.QueryCompiler, query ast.Body) (
// this wouldn't be done, except for handling queries with the `Partial` API
// where rewriting them can substantially simplify the result, and it is unlikely
// that the caller would need expression values.
func (r *Rego) rewriteEqualsForPartialQueryCompile(_ ast.QueryCompiler, query ast.Body) (ast.Body, error) {
func (*Rego) rewriteEqualsForPartialQueryCompile(_ ast.QueryCompiler, query ast.Body) (ast.Body, error) {
doubleEq := ast.Equal.Ref()
unifyOp := ast.Equality.Ref()
ast.WalkExprs(query, func(x *ast.Expr) bool {

View File

@@ -325,7 +325,7 @@ func (c *cache) unsafeDelete(k ast.Value) {
c.l.Remove(cacheItem.keyElement)
}
func (c *cache) unsafeClone(value InterQueryCacheValue) (InterQueryCacheValue, error) {
func (*cache) unsafeClone(value InterQueryCacheValue) (InterQueryCacheValue, error) {
return value.Clone()
}

View File

@@ -209,7 +209,7 @@ func (p *CopyPropagator) Apply(query ast.Body) ast.Body {
// plugBindings applies the binding list and union-find to x. This process
// removes as many variables as possible.
func (p *CopyPropagator) plugBindings(pctx *plugContext, expr *ast.Expr) *ast.Expr {
func (*CopyPropagator) plugBindings(pctx *plugContext, expr *ast.Expr) *ast.Expr {
xform := bindingPlugTransform{
pctx: pctx,
@@ -244,7 +244,7 @@ func (t bindingPlugTransform) Transform(x interface{}) (interface{}, error) {
}
}
func (t bindingPlugTransform) plugBindingsVar(pctx *plugContext, v ast.Var) ast.Value {
func (bindingPlugTransform) plugBindingsVar(pctx *plugContext, v ast.Var) ast.Value {
var result ast.Value = v
@@ -274,7 +274,7 @@ func (t bindingPlugTransform) plugBindingsVar(pctx *plugContext, v ast.Var) ast.
return b
}
func (t bindingPlugTransform) plugBindingsRef(pctx *plugContext, v ast.Ref) ast.Ref {
func (bindingPlugTransform) plugBindingsRef(pctx *plugContext, v ast.Ref) ast.Ref {
// Apply union-find to remove redundant variables from input.
if root, ok := pctx.uf.Find(v[0].Value); ok {

View File

@@ -3216,7 +3216,7 @@ func (q vcKeyScope) Hash() int {
return hash
}
func (q vcKeyScope) IsGround() bool {
func (vcKeyScope) IsGround() bool {
return false
}

View File

@@ -1197,7 +1197,7 @@ func (c *interQueryCacheData) toCacheValue() (*interQueryCacheValue, error) {
return &interQueryCacheValue{Data: b}, nil
}
func (c *interQueryCacheData) SizeInBytes() int64 {
func (*interQueryCacheData) SizeInBytes() int64 {
return 0
}

View File

@@ -199,7 +199,7 @@ func (l *legacyTracer) Enabled() bool {
return l.t.Enabled()
}
func (l *legacyTracer) Config() TraceConfig {
func (*legacyTracer) Config() TraceConfig {
return TraceConfig{
PlugLocalVars: true, // For backwards compatibility old tracers will plug local variables
}
@@ -241,7 +241,7 @@ func (b *BufferTracer) TraceEvent(evt Event) {
}
// Config returns the Tracers standard configuration
func (b *BufferTracer) Config() TraceConfig {
func (*BufferTracer) Config() TraceConfig {
return TraceConfig{PlugLocalVars: true}
}

View File

@@ -109,7 +109,7 @@ func unwrap(t Type) Type {
}
}
func (t Null) String() string {
func (Null) String() string {
return typeNull
}

View File

@@ -11,7 +11,7 @@ import (
)
// Version is the canonical version of OPA.
var Version = "1.2.0"
var Version = "1.3.0"
// GoVersion is the version of Go this was built with
var GoVersion = runtime.Version()

2
vendor/modules.txt vendored
View File

@@ -1099,7 +1099,7 @@ github.com/onsi/gomega/matchers/support/goraph/edge
github.com/onsi/gomega/matchers/support/goraph/node
github.com/onsi/gomega/matchers/support/goraph/util
github.com/onsi/gomega/types
# github.com/open-policy-agent/opa v1.2.0
# github.com/open-policy-agent/opa v1.3.0
## explicit; go 1.23.6
github.com/open-policy-agent/opa/ast
github.com/open-policy-agent/opa/ast/json