From 31c41779b61e9279deea29c819bfe5f17b26bd5b Mon Sep 17 00:00:00 2001 From: David Desmarais-Michaud Date: Thu, 23 Mar 2023 12:29:59 -0400 Subject: [PATCH 1/3] update circle policy agent (#885) --- cmd/policy/policy_test.go | 28 +++++++++++----- .../meta-policy-subdir/meta-policy.rego | 2 +- cmd/policy/testdata/test1/meta.yml | 3 +- cmd/policy/testdata/test_policies/policy.rego | 2 +- .../testdata/test_policies/policy_test.yaml | 6 ++-- go.mod | 16 +++++----- go.sum | 32 +++++++++---------- 7 files changed, 52 insertions(+), 37 deletions(-) diff --git a/cmd/policy/policy_test.go b/cmd/policy/policy_test.go index f83135c0e..cf98e1a10 100644 --- a/cmd/policy/policy_test.go +++ b/cmd/policy/policy_test.go @@ -711,7 +711,7 @@ func TestMakeDecisionCommand(t *testing.T) { "input": "test: config\n", "metadata": map[string]interface{}{ "project_id": "test-project-id", - "branch": "main", + "vcs": map[string]any{"branch": "main"}, }, }) @@ -868,12 +868,15 @@ func TestRawOPAEvaluationCommand(t *testing.T) { { Name: "successfully performs raw opa evaluation for policy FILE provided locally, input and metadata", Args: []string{ - "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--metafile", - "./testdata/test1/meta.yml", "--input", "./testdata/test0/config.yml", + "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", + "--metafile", "./testdata/test1/meta.yml", + "--input", "./testdata/test0/config.yml", }, ExpectedOutput: `{ "meta": { - "branch": "main", + "vcs": { + "branch": "main" + }, "project_id": "test-project-id" }, "org": { @@ -890,8 +893,10 @@ func TestRawOPAEvaluationCommand(t *testing.T) { { Name: "successfully performs raw opa evaluation for policy FILE provided locally, input, metadata and query", Args: []string{ - "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--metafile", - "./testdata/test1/meta.yml", "--input", "./testdata/test0/config.yml", "--query", "data.org.enable_rule", + "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", + "--metafile", "./testdata/test1/meta.yml", + "--input", "./testdata/test0/config.yml", + "--query", "data.org.enable_rule", }, ExpectedOutput: `[ "enabled" @@ -911,7 +916,9 @@ func TestRawOPAEvaluationCommand(t *testing.T) { cmd, stdout, _ := makeCMD() - cmd.SetArgs(append(tc.Args, "--policy-base-url", svr.URL)) + args := append(tc.Args, "--policy-base-url", svr.URL) + + cmd.SetArgs(args) err := cmd.Execute() if tc.ExpectedErr == "" { @@ -920,7 +927,12 @@ func TestRawOPAEvaluationCommand(t *testing.T) { assert.ErrorContains(t, err, tc.ExpectedErr) return } - assert.Equal(t, stdout.String(), tc.ExpectedOutput) + + var actual, expected any + assert.NilError(t, json.Unmarshal(stdout.Bytes(), &actual)) + assert.NilError(t, json.Unmarshal([]byte(tc.ExpectedOutput), &expected)) + + assert.DeepEqual(t, actual, expected) }) } } diff --git a/cmd/policy/testdata/test0/subdir/meta-policy-subdir/meta-policy.rego b/cmd/policy/testdata/test0/subdir/meta-policy-subdir/meta-policy.rego index 3553e4c74..6b22fb441 100644 --- a/cmd/policy/testdata/test0/subdir/meta-policy-subdir/meta-policy.rego +++ b/cmd/policy/testdata/test0/subdir/meta-policy-subdir/meta-policy.rego @@ -1,5 +1,5 @@ package org policy_name["meta_policy_test"] -enable_rule["enabled"] { data.meta.branch == "main" } +enable_rule["enabled"] { data.meta.vcs.branch == "main" } enable_rule["disabled"] { data.meta.project_id != "test-project-id" } diff --git a/cmd/policy/testdata/test1/meta.yml b/cmd/policy/testdata/test1/meta.yml index ed8d9bde4..89cabab0a 100644 --- a/cmd/policy/testdata/test1/meta.yml +++ b/cmd/policy/testdata/test1/meta.yml @@ -1,2 +1,3 @@ project_id: test-project-id -branch: main +vcs: + branch: main diff --git a/cmd/policy/testdata/test_policies/policy.rego b/cmd/policy/testdata/test_policies/policy.rego index 2499ff857..be57316cd 100644 --- a/cmd/policy/testdata/test_policies/policy.rego +++ b/cmd/policy/testdata/test_policies/policy.rego @@ -4,4 +4,4 @@ policy_name["test"] enable_rule["fail_if_not_main"] -fail_if_not_main = "branch must be main!" { data.meta.branch != "main" } +fail_if_not_main = "branch must be main!" { data.meta.vcs.branch != "main" } diff --git a/cmd/policy/testdata/test_policies/policy_test.yaml b/cmd/policy/testdata/test_policies/policy_test.yaml index 5d93f32df..e351025c9 100644 --- a/cmd/policy/testdata/test_policies/policy_test.yaml +++ b/cmd/policy/testdata/test_policies/policy_test.yaml @@ -1,6 +1,7 @@ test_main: meta: - branch: main + vcs: + branch: main decision: &root_decision status: PASS enabled_rules: @@ -8,7 +9,8 @@ test_main: test_feature: meta: - branch: feature + vcs: + branch: feature decision: <<: *root_decision status: SOFT_FAIL diff --git a/go.mod b/go.mod index 0133b1211..4b3ee6084 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/CircleCI-Public/circleci-cli require ( github.com/AlecAivazis/survey/v2 v2.1.1 - github.com/CircleCI-Public/circle-policy-agent v0.0.564 + github.com/CircleCI-Public/circle-policy-agent v0.0.583 github.com/Masterminds/semver v1.4.2 github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de github.com/blang/semver v3.5.1+incompatible @@ -35,6 +35,7 @@ require ( github.com/charmbracelet/lipgloss v0.5.0 github.com/erikgeiser/promptkit v0.7.0 github.com/hexops/gotextdiff v1.0.3 + github.com/stretchr/testify v1.8.2 golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb ) @@ -52,7 +53,7 @@ require ( github.com/go-git/gcfg v1.5.0 // indirect github.com/go-git/go-billy/v5 v5.0.0 // indirect github.com/gobwas/glob v0.2.3 // indirect - github.com/golang/protobuf v1.5.2 // indirect + github.com/golang/protobuf v1.5.3 // indirect github.com/google/go-cmp v0.5.9 // indirect github.com/hinshun/vt10x v0.0.0-20220301184237-5011da428d02 // indirect github.com/imdario/mergo v0.3.12 // indirect @@ -71,13 +72,12 @@ require ( github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.12.0 // indirect github.com/nxadm/tail v1.4.8 // indirect - github.com/open-policy-agent/opa v0.49.0 // indirect + github.com/open-policy-agent/opa v0.50.2 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.9.0 // indirect github.com/sergi/go-diff v1.1.0 // indirect - github.com/stretchr/testify v1.8.2 // indirect github.com/tchap/go-patricia/v2 v2.3.1 // indirect github.com/xanzy/ssh-agent v0.2.1 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect @@ -85,10 +85,10 @@ require ( github.com/yashtewari/glob-intersection v0.1.0 // indirect github.com/yazgazan/jaydiff v0.3.1 // indirect golang.org/x/crypto v0.3.0 // indirect - golang.org/x/net v0.7.0 // indirect - golang.org/x/sys v0.5.0 // indirect - golang.org/x/term v0.5.0 // indirect - golang.org/x/text v0.7.0 // indirect + golang.org/x/net v0.8.0 // indirect + golang.org/x/sys v0.6.0 // indirect + golang.org/x/term v0.6.0 // indirect + golang.org/x/text v0.8.0 // indirect google.golang.org/protobuf v1.28.1 // indirect gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect gopkg.in/warnings.v0 v0.1.2 // indirect diff --git a/go.sum b/go.sum index ebcbb5ce8..284582ffd 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/AlecAivazis/survey/v2 v2.1.1 h1:LEMbHE0pLj75faaVEKClEX1TM4AJmmnOh9eim github.com/AlecAivazis/survey/v2 v2.1.1/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0Ttd6q3Vl2fahjk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CircleCI-Public/circle-policy-agent v0.0.564 h1:i7CkwfUVL9fItTc1X9evcCgwmuiRsTOODcCmYrByu7s= -github.com/CircleCI-Public/circle-policy-agent v0.0.564/go.mod h1:oySWkeJOAnvT56DRaGL0n2lHmeCEFwrhGg0Bvj9jiI8= +github.com/CircleCI-Public/circle-policy-agent v0.0.583 h1:c4Q48txEoO182l77CjSWGNhRHUUPOwlbm/mr/LG+nBs= +github.com/CircleCI-Public/circle-policy-agent v0.0.583/go.mod h1:zD3HRb1jYVe8wnbQz5UPF/Ol1lEsDxC47v3NysIY9Fw= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= @@ -65,7 +65,7 @@ github.com/briandowns/spinner v1.18.1/go.mod h1:mQak9GHqbspjC/5iUx3qMlIho8xBS/pp github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= -github.com/cespare/xxhash/v2 v2.1.2 h1:YRXhKfTDauu4ajMg1TPgFO5jnlC2HCbmLXMcTG5cbYE= +github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/charmbracelet/bubbles v0.11.0 h1:fBLyY0PvJnd56Vlu5L84JJH6f4axhgIJ9P3NET78f0Q= github.com/charmbracelet/bubbles v0.11.0/go.mod h1:bbeTiXwPww4M031aGi8UK2HT9RDWoiNibae+1yCMtcc= github.com/charmbracelet/bubbletea v0.21.0 h1:f3y+kanzgev5PA916qxmDybSHU3N804uOnKnhRPXTcI= @@ -103,7 +103,7 @@ github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/flynn/go-shlex v0.0.0-20150515145356-3f9db97f8568/go.mod h1:xEzjJPgXI435gkrCt3MPfRiAkVrwSbHsst4LCFVfpJc= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= -github.com/foxcpp/go-mockdns v0.0.0-20210729171921-fb145fc6f897 h1:E52jfcE64UG42SwLmrW0QByONfGynWuzBvm86BoB9z8= +github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= @@ -154,8 +154,9 @@ github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvq github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= -github.com/golang/protobuf v1.5.2 h1:ROPKBNFfQgOUMifHyP+KYbvpjbdoFNs+aK7DXlji0Tw= github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= +github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= +github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= 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= @@ -279,8 +280,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.17.0 h1:9Luw4uT5HTjHTN8+aNcSThgH1vdXnmdJ8xIfZ4wyTRE= github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/open-policy-agent/opa v0.49.0 h1:TIlpCT1B5FSm8Dqo/a4t23gKmHkQysC3+7W77F99P4k= -github.com/open-policy-agent/opa v0.49.0/go.mod h1:WTLWtu498/QNTDkiHx76Xj7jaJUPvLJAPtdMkCcst0w= +github.com/open-policy-agent/opa v0.50.2 h1:iD2kKLFkflgSCTMtrC/3jLmOQ7IWyDXMg6+VQA0tSC0= +github.com/open-policy-agent/opa v0.50.2/go.mod h1:9jKfDk0L5b9rnhH4M0nq10cGHbYOxqygxzTT3dsvhec= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -323,7 +324,6 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= @@ -425,8 +425,8 @@ golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= -golang.org/x/net v0.7.0 h1:rJrUqqhjsgNp7KqAIc25s9pZnjU7TUcSY7HcVZjdn1g= -golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -489,21 +489,21 @@ golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220615213510-4f61da869c0c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.5.0 h1:MUK/U/4lj1t1oPg0HfuXDN/Z1wv31ZJ/YcPiGccS4DU= -golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= -golang.org/x/term v0.5.0 h1:n2a8QNdAb0sZNpU9R1ALUXBbY+w51fCQDN+7EdxNBsY= -golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0 h1:clScbb1cHjoCkyRbWwBEUZ5H/tIFu5TAXIqaZD0Gcjw= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.7.0 h1:4BRB4x83lYWy72KwLD/qYDuTu7q9PjSagHvijDw7cLo= -golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= From dae03ee99e681c30b1cb7b781e03709bcdfee538 Mon Sep 17 00:00:00 2001 From: Sagar Gupta Date: Tue, 28 Mar 2023 11:40:17 -0400 Subject: [PATCH 2/3] [SNC-102] Add meta flag to config policies decisions (#891) --- cmd/policy/policy.go | 51 ++++++---- cmd/policy/policy_test.go | 92 ++++++++++++++++++- .../testdata/policy/decide-expected-usage.txt | 1 + .../testdata/policy/eval-expected-usage.txt | 1 + 4 files changed, 122 insertions(+), 23 deletions(-) diff --git a/cmd/policy/policy.go b/cmd/policy/policy.go index 3a47ea2f1..c2d989156 100644 --- a/cmd/policy/policy.go +++ b/cmd/policy/policy.go @@ -261,6 +261,7 @@ This group of commands allows the management of polices to be verified against b var ( inputPath string policyPath string + meta string metaFile string ownerID string context string @@ -284,15 +285,9 @@ This group of commands allows the management of polices to be verified against b return fmt.Errorf("failed to read input file: %w", err) } - var metadata map[string]interface{} - if metaFile != "" { - raw, err := os.ReadFile(metaFile) - if err != nil { - return fmt.Errorf("failed to read meta file: %w", err) - } - if err := yaml.Unmarshal(raw, &metadata); err != nil { - return fmt.Errorf("failed to decode meta content: %w", err) - } + metadata, err := readMetadata(meta, metaFile) + if err != nil { + return fmt.Errorf("failed to read metadata: %w", err) } decision, err := func() (*cpa.Decision, error) { @@ -324,6 +319,7 @@ This group of commands allows the management of polices to be verified against b cmd.Flags().StringVar(&ownerID, "owner-id", "", "the id of the policy's owner") cmd.Flags().StringVar(&context, "context", "config", "policy context for decision") cmd.Flags().StringVar(&inputPath, "input", "", "path to input file") + cmd.Flags().StringVar(&meta, "meta", "", "decision metadata (json string)") cmd.Flags().StringVar(&metaFile, "metafile", "", "decision metadata file") cmd.Flags().BoolVar(&strict, "strict", false, "return non-zero status code for decision resulting in HARD_FAIL") @@ -335,7 +331,7 @@ This group of commands allows the management of polices to be verified against b }() eval := func() *cobra.Command { - var inputPath, metaFile, query string + var inputPath, meta, metaFile, query string cmd := &cobra.Command{ Short: "perform raw opa evaluation locally", Use: "eval ", @@ -346,15 +342,9 @@ This group of commands allows the management of polices to be verified against b return fmt.Errorf("failed to read input file: %w", err) } - var metadata map[string]interface{} - if metaFile != "" { - raw, err := os.ReadFile(metaFile) - if err != nil { - return fmt.Errorf("failed to read meta file: %w", err) - } - if err := yaml.Unmarshal(raw, &metadata); err != nil { - return fmt.Errorf("failed to decode meta content: %w", err) - } + metadata, err := readMetadata(meta, metaFile) + if err != nil { + return fmt.Errorf("failed to read metadata: %w", err) } decision, err := getPolicyEvaluationLocally(policyPath, input, metadata, query) @@ -373,6 +363,7 @@ This group of commands allows the management of polices to be verified against b } cmd.Flags().StringVar(&inputPath, "input", "", "path to input file") + cmd.Flags().StringVar(&meta, "meta", "", "decision metadata (json string)") cmd.Flags().StringVar(&metaFile, "metafile", "", "decision metadata file") cmd.Flags().StringVar(&query, "query", "data", "policy decision query") @@ -510,6 +501,28 @@ This group of commands allows the management of polices to be verified against b return cmd } +func readMetadata(meta string, metaFile string) (map[string]interface{}, error) { + var metadata map[string]interface{} + if meta != "" && metaFile != "" { + return nil, fmt.Errorf("use either --meta or --metafile flag, but not both") + } + if meta != "" { + if err := json.Unmarshal([]byte(meta), &metadata); err != nil { + return nil, fmt.Errorf("failed to decode meta content: %w", err) + } + } + if metaFile != "" { + raw, err := os.ReadFile(metaFile) + if err != nil { + return nil, fmt.Errorf("failed to read meta file: %w", err) + } + if err := yaml.Unmarshal(raw, &metadata); err != nil { + return nil, fmt.Errorf("failed to decode metafile content: %w", err) + } + } + return metadata, nil +} + // prettyJSONEncoder takes a writer and returns a new json encoder with indent set to two space characters func prettyJSONEncoder(dst io.Writer) *json.Encoder { enc := json.NewEncoder(dst) diff --git a/cmd/policy/policy_test.go b/cmd/policy/policy_test.go index cf98e1a10..0c833c241 100644 --- a/cmd/policy/policy_test.go +++ b/cmd/policy/policy_test.go @@ -698,7 +698,29 @@ func TestMakeDecisionCommand(t *testing.T) { ExpectedOutput: "{\n \"status\": \"PASS\"\n}\n", }, { - Name: "sends expected request with metadata", + Name: "sends expected request with meta", + Args: []string{"decide", "--owner-id", "test-owner", "--input", "./testdata/test1/test.yml", "--context", "custom", "--meta", `{"project_id": "test-project-id","vcs": {"branch": "main"}}`}, + ServerHandler: func(w http.ResponseWriter, r *http.Request) { + assert.Equal(t, r.Method, "POST") + assert.Equal(t, r.URL.Path, "/api/v1/owner/test-owner/context/custom/decision") + + var payload map[string]interface{} + assert.NilError(t, json.NewDecoder(r.Body).Decode(&payload)) + + assert.DeepEqual(t, payload, map[string]interface{}{ + "input": "test: config\n", + "metadata": map[string]interface{}{ + "project_id": "test-project-id", + "vcs": map[string]any{"branch": "main"}, + }, + }) + + _, _ = io.WriteString(w, `{"status":"PASS"}`) + }, + ExpectedOutput: "{\n \"status\": \"PASS\"\n}\n", + }, + { + Name: "sends expected request with metafile", Args: []string{"decide", "--owner-id", "test-owner", "--input", "./testdata/test1/test.yml", "--context", "custom", "--metafile", "./testdata/test1/meta.yml"}, ServerHandler: func(w http.ResponseWriter, r *http.Request) { assert.Equal(t, r.Method, "POST") @@ -749,6 +771,11 @@ func TestMakeDecisionCommand(t *testing.T) { Args: []string{"decide", "./testdata/no_such_file.rego", "--input", "./testdata/test1/test.yml"}, ExpectedErr: "failed to make decision: failed to load policy files: failed to walk root: ", }, + { + Name: "fails if both meta and metafile are provided", + Args: []string{"decide", "./testdata/test0/policy.rego", "--input", "./testdata/test1/test.yml", "--meta", "{}", "--metafile", "somefile"}, + ExpectedErr: "failed to read metadata: use either --meta or --metafile flag, but not both", + }, { Name: "successfully performs decision for policy FILE provided locally", Args: []string{"decide", "./testdata/test0/policy.rego", "--input", "./testdata/test0/config.yml"}, @@ -797,7 +824,21 @@ func TestMakeDecisionCommand(t *testing.T) { ExpectedErr: "policy decision status: ERROR", }, { - Name: "successfully performs decision with metadata for policy FILE provided locally", + Name: "successfully performs decision with meta for policy FILE provided locally", + Args: []string{ + "decide", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--meta", + `{"project_id": "test-project-id","vcs": {"branch": "main"}}`, "--input", "./testdata/test0/config.yml", + }, + ExpectedOutput: `{ + "status": "PASS", + "enabled_rules": [ + "enabled" + ] +} +`, + }, + { + Name: "successfully performs decision with metafile for policy FILE provided locally", Args: []string{ "decide", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--metafile", "./testdata/test1/meta.yml", "--input", "./testdata/test0/config.yml", @@ -866,7 +907,37 @@ func TestRawOPAEvaluationCommand(t *testing.T) { ExpectedErr: "failed to make decision: failed to load policy files: failed to walk root: ", }, { - Name: "successfully performs raw opa evaluation for policy FILE provided locally, input and metadata", + Name: "fails if both meta and metafile are provided", + Args: []string{"eval", "./testdata/test0/policy.rego", "--input", "./testdata/test1/test.yml", "--meta", "{}", "--metafile", "somefile"}, + ExpectedErr: "failed to read metadata: use either --meta or --metafile flag, but not both", + }, + { + Name: "successfully performs raw opa evaluation for policy FILE provided locally, input and meta", + Args: []string{ + "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", + "--meta", `{"project_id": "test-project-id","vcs": {"branch": "main"}}`, + "--input", "./testdata/test0/config.yml", + }, + ExpectedOutput: `{ + "meta": { + "vcs": { + "branch": "main" + }, + "project_id": "test-project-id" + }, + "org": { + "enable_rule": [ + "enabled" + ], + "policy_name": [ + "meta_policy_test" + ] + } +} +`, + }, + { + Name: "successfully performs raw opa evaluation for policy FILE provided locally, input and metafile", Args: []string{ "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--metafile", "./testdata/test1/meta.yml", @@ -891,7 +962,20 @@ func TestRawOPAEvaluationCommand(t *testing.T) { `, }, { - Name: "successfully performs raw opa evaluation for policy FILE provided locally, input, metadata and query", + Name: "successfully performs raw opa evaluation for policy FILE provided locally, input, meta and query", + Args: []string{ + "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", + "--meta", `{"project_id": "test-project-id","vcs": {"branch": "main"}}`, + "--input", "./testdata/test0/config.yml", + "--query", "data.org.enable_rule", + }, + ExpectedOutput: `[ + "enabled" +] +`, + }, + { + Name: "successfully performs raw opa evaluation for policy FILE provided locally, input, metafile and query", Args: []string{ "eval", "./testdata/test0/subdir/meta-policy-subdir/meta-policy.rego", "--metafile", "./testdata/test1/meta.yml", diff --git a/cmd/policy/testdata/policy/decide-expected-usage.txt b/cmd/policy/testdata/policy/decide-expected-usage.txt index cd6f3bf3e..20307a876 100644 --- a/cmd/policy/testdata/policy/decide-expected-usage.txt +++ b/cmd/policy/testdata/policy/decide-expected-usage.txt @@ -7,6 +7,7 @@ policy decide ./policies --input ./.circleci/config.yml Flags: --context string policy context for decision (default "config") --input string path to input file + --meta string decision metadata (json string) --metafile string decision metadata file --owner-id string the id of the policy's owner --strict return non-zero status code for decision resulting in HARD_FAIL diff --git a/cmd/policy/testdata/policy/eval-expected-usage.txt b/cmd/policy/testdata/policy/eval-expected-usage.txt index 68624f672..9f4e23364 100644 --- a/cmd/policy/testdata/policy/eval-expected-usage.txt +++ b/cmd/policy/testdata/policy/eval-expected-usage.txt @@ -6,6 +6,7 @@ policy eval ./policies --input ./.circleci/config.yml Flags: --input string path to input file + --meta string decision metadata (json string) --metafile string decision metadata file --query string policy decision query (default "data") From 8b2a4d0a5ffbfb298d785ca8d39d5807cddf37da Mon Sep 17 00:00:00 2001 From: David Desmarais-Michaud Date: Wed, 29 Mar 2023 10:46:43 -0400 Subject: [PATCH 3/3] udpated circle-policy-agent to v0.0.608 (#892) --- go.mod | 6 ++---- go.sum | 16 ++++------------ 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 4b3ee6084..c73f2c9a2 100644 --- a/go.mod +++ b/go.mod @@ -2,7 +2,7 @@ module github.com/CircleCI-Public/circleci-cli require ( github.com/AlecAivazis/survey/v2 v2.1.1 - github.com/CircleCI-Public/circle-policy-agent v0.0.583 + github.com/CircleCI-Public/circle-policy-agent v0.0.608 github.com/Masterminds/semver v1.4.2 github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de github.com/blang/semver v3.5.1+incompatible @@ -36,7 +36,7 @@ require ( github.com/erikgeiser/promptkit v0.7.0 github.com/hexops/gotextdiff v1.0.3 github.com/stretchr/testify v1.8.2 - golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb + golang.org/x/exp v0.0.0-20230321023759-10a507213a29 ) require ( @@ -64,7 +64,6 @@ require ( github.com/lucasb-eyer/go-colorful v1.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect - github.com/mb0/diff v0.0.0-20131118162322-d8d9a906c24d // indirect github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/muesli/ansi v0.0.0-20211031195517-c9f0611b6c70 // indirect @@ -83,7 +82,6 @@ require ( github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect github.com/yashtewari/glob-intersection v0.1.0 // indirect - github.com/yazgazan/jaydiff v0.3.1 // indirect golang.org/x/crypto v0.3.0 // indirect golang.org/x/net v0.8.0 // indirect golang.org/x/sys v0.6.0 // indirect diff --git a/go.sum b/go.sum index 284582ffd..8591b37e6 100644 --- a/go.sum +++ b/go.sum @@ -35,8 +35,8 @@ github.com/AlecAivazis/survey/v2 v2.1.1 h1:LEMbHE0pLj75faaVEKClEX1TM4AJmmnOh9eim github.com/AlecAivazis/survey/v2 v2.1.1/go.mod h1:9FJRdMdDm8rnT+zHVbvQT2RTSTLq0Ttd6q3Vl2fahjk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= -github.com/CircleCI-Public/circle-policy-agent v0.0.583 h1:c4Q48txEoO182l77CjSWGNhRHUUPOwlbm/mr/LG+nBs= -github.com/CircleCI-Public/circle-policy-agent v0.0.583/go.mod h1:zD3HRb1jYVe8wnbQz5UPF/Ol1lEsDxC47v3NysIY9Fw= +github.com/CircleCI-Public/circle-policy-agent v0.0.608 h1:3Bhimsdrhwiz2J7ssx90vVH5o8dviZb5+pWUzuMg9E0= +github.com/CircleCI-Public/circle-policy-agent v0.0.608/go.mod h1:EJlgvMigkiPmhzRJrnqzucVtIYB0TlbNzaSAB2gEL9Q= github.com/Masterminds/semver v1.4.2 h1:WBLTQ37jOCzSLtXNdoo8bNM8876KhNqOKvrlGITgsTc= github.com/Masterminds/semver v1.4.2/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y= github.com/Netflix/go-expect v0.0.0-20180615182759-c93bf25de8e8 h1:xzYJEypr/85nBpB11F9br+3HUrpgb+fcm5iADzXXYEw= @@ -227,12 +227,10 @@ github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= @@ -245,8 +243,6 @@ github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRC github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU= github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/mb0/diff v0.0.0-20131118162322-d8d9a906c24d h1:eAS2t2Vy+6psf9LZ4T5WXWsbkBt3Tu5PWekJy5AGyEU= -github.com/mb0/diff v0.0.0-20131118162322-d8d9a906c24d/go.mod h1:3YMHqrw2Qu3Liy82v4QdAG17e9k91HZ7w3hqlpWqhDo= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b h1:j7+1HpAFS1zy5+Q4qx1fWh90gTKwiN4QCGoY9TWyyO4= github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE= github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= @@ -340,8 +336,6 @@ github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 h1:EzJWgHo github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/yashtewari/glob-intersection v0.1.0 h1:6gJvMYQlTDOL3dMsPF6J0+26vwX9MB8/1q3uAdhmTrg= github.com/yashtewari/glob-intersection v0.1.0/go.mod h1:LK7pIC3piUjovexikBbJ26Yml7g8xa5bsjfx2v1fwok= -github.com/yazgazan/jaydiff v0.3.1 h1:5vUlbCCRm8LNckEZhMkU3GjZk1RQZxA/+XuOYrqkhvI= -github.com/yazgazan/jaydiff v0.3.1/go.mod h1:9AvhZxcMJX51L4eQdw7Wi2mhC8i3HQo0HRvftL0VROw= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -352,7 +346,6 @@ go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= -golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190219172222-a4c6cb3142f2/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -373,8 +366,8 @@ golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u0 golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb h1:PaBZQdo+iSDyHT053FjUCgZQ/9uqVwPOcl7KSWhKn6w= -golang.org/x/exp v0.0.0-20230213192124-5e25df0256eb/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug= +golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -445,7 +438,6 @@ golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=