Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package conftest for openSUSE:Factory checked in at 2023-06-13 16:10:42 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/conftest (Old) and /work/SRC/openSUSE:Factory/.conftest.new.15902 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conftest" Tue Jun 13 16:10:42 2023 rev:7 rq:1092791 version:0.43.1 Changes: -------- --- /work/SRC/openSUSE:Factory/conftest/conftest.changes 2023-05-08 17:24:59.736947664 +0200 +++ /work/SRC/openSUSE:Factory/.conftest.new.15902/conftest.changes 2023-06-13 16:10:46.219331501 +0200 @@ -1,0 +2,18 @@ +Mon Jun 12 20:08:18 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.43.1: + * build(deps): bump github.com/open-policy-agent/opa from 0.53.0 + to 0.53.1 (#833) + * build: Bump hashicorp/go-getter to v1.7.1 (#825) + +------------------------------------------------------------------- +Mon Jun 12 20:01:35 UTC 2023 - ka...@b1-systems.de + +- Update to version 0.43.0: + * build(deps): bump github.com/open-policy-agent/opa from 0.52.0 + to 0.53.0 (#830) + * feat: Add textproto support (#828) + * build(deps): bump alpine from 3.17.3 to 3.18.0 (#827) + * docs: typo (#826) + +------------------------------------------------------------------- Old: ---- conftest-0.42.1.obscpio New: ---- conftest-0.43.1.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ conftest.spec ++++++ --- /var/tmp/diff_new_pack.mNMcwd/_old 2023-06-13 16:10:47.291337825 +0200 +++ /var/tmp/diff_new_pack.mNMcwd/_new 2023-06-13 16:10:47.295337849 +0200 @@ -17,7 +17,7 @@ Name: conftest -Version: 0.42.1 +Version: 0.43.1 Release: 0 Summary: Tool to write tests against structured configuration data License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.mNMcwd/_old 2023-06-13 16:10:47.335338085 +0200 +++ /var/tmp/diff_new_pack.mNMcwd/_new 2023-06-13 16:10:47.335338085 +0200 @@ -4,7 +4,7 @@ <param name="scm">git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">v0.42.1</param> + <param name="revision">v0.43.1</param> <param name="changesgenerate">enable</param> </service> <service name="set_version" mode="disabled"> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.mNMcwd/_old 2023-06-13 16:10:47.359338226 +0200 +++ /var/tmp/diff_new_pack.mNMcwd/_new 2023-06-13 16:10:47.363338249 +0200 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/open-policy-agent/conftest.git</param> - <param name="changesrevision">af6a868708642dcf7863012c115a671606bde9cd</param></service></servicedata> + <param name="changesrevision">1f00a2e2e4c140f5271524bfc156b8eca39a4f7a</param></service></servicedata> (No newline at EOF) ++++++ conftest-0.42.1.obscpio -> conftest-0.43.1.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/Dockerfile new/conftest-0.43.1/Dockerfile --- old/conftest-0.42.1/Dockerfile 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/Dockerfile 2023-06-07 07:02:24.000000000 +0200 @@ -51,7 +51,7 @@ WORKDIR /examples ## RELEASE ## -FROM alpine:3.17.3 +FROM alpine:3.18.0 # Install git for protocols that depend on it when using conftest pull RUN apk add --no-cache git diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/acceptance.bats new/conftest-0.43.1/acceptance.bats --- old/conftest-0.42.1/acceptance.bats 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/acceptance.bats 2023-06-07 07:02:24.000000000 +0200 @@ -489,3 +489,14 @@ [[ "$output" =~ "built-in error" ]] } +@test "TextProto policy returns expected results" { + run ./conftest test --proto-file-dirs=examples/textproto/protos -p examples/textproto/policy examples/textproto/ + [ "$status" -eq 1 ] + [[ "$output" =~ "2 tests, 1 passed, 0 warnings, 1 failure, 0 exceptions" ]] +} + +@test "TextProto policy fails when the proto messages could not be resolved" { + run ./conftest test -p examples/textproto/policy examples/textproto/ + [ "$status" -eq 1 ] + [[ "$output" =~ "look up message type" ]] +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/docs/index.md new/conftest-0.43.1/docs/index.md --- old/conftest-0.42.1/docs/index.md 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/docs/index.md 2023-06-07 07:02:24.000000000 +0200 @@ -78,6 +78,7 @@ * Jsonnet * Property files (.properties) * SPDX +* TextProto (Protocol Buffers) * TOML * VCL * XML @@ -269,4 +270,4 @@ } ``` -This is much more elagant if you have lots of tests and are unit-testing them. Unfortunately you need to do a bit more book-keeping with the `no_violations` rule, but a future feature may make that easier to implement. +This is much more elegant if you have lots of tests and are unit-testing them. Unfortunately you need to do a bit more book-keeping with the `no_violations` rule, but a future feature may make that easier to implement. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/examples/textproto/fail.textproto new/conftest-0.43.1/examples/textproto/fail.textproto --- old/conftest-0.42.1/examples/textproto/fail.textproto 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/examples/textproto/fail.textproto 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,4 @@ +# proto-message: conftest.testing.TestMessage + +name: "fail" +number: 9000 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/examples/textproto/pass.textproto new/conftest-0.43.1/examples/textproto/pass.textproto --- old/conftest-0.42.1/examples/textproto/pass.textproto 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/examples/textproto/pass.textproto 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,4 @@ +# proto-message: conftest.testing.TestMessage + +name: "pass" +number: 9001 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/examples/textproto/policy/over_9000.rego new/conftest-0.43.1/examples/textproto/policy/over_9000.rego --- old/conftest-0.42.1/examples/textproto/policy/over_9000.rego 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/examples/textproto/policy/over_9000.rego 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,6 @@ +package main + +deny[{"msg": msg}] { + input.number <= 9000 + msg := sprintf("%s: Power level must be over 9000", [input.name]) +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/examples/textproto/protos/test.proto new/conftest-0.43.1/examples/textproto/protos/test.proto --- old/conftest-0.42.1/examples/textproto/protos/test.proto 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/examples/textproto/protos/test.proto 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,9 @@ +syntax = "proto3"; + +package conftest.testing; + +message TestMessage { + string name = 1; + int32 number = 2; + bool truthy = 3; +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/go.mod new/conftest-0.43.1/go.mod --- old/conftest-0.42.1/go.mod 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/go.mod 2023-06-07 07:02:24.000000000 +0200 @@ -8,10 +8,12 @@ github.com/CycloneDX/cyclonedx-go v0.4.0 github.com/KeisukeYamashita/go-vcl v0.4.0 github.com/basgys/goxml2json v1.1.0 + github.com/bufbuild/protocompile v0.5.1 github.com/cpuguy83/dockercfg v0.3.1 github.com/ghodss/yaml v1.0.0 github.com/go-akka/configuration v0.0.0-20200606091224-a002c0330665 github.com/go-ini/ini v1.67.0 + github.com/google/go-cmp v0.5.9 github.com/google/go-jsonnet v0.18.0 github.com/hashicorp/go-getter v1.7.1 github.com/hashicorp/hcl v1.0.0 @@ -20,7 +22,7 @@ github.com/magiconair/properties v1.8.5 github.com/moby/buildkit v0.11.5 github.com/olekukonko/tablewriter v0.0.5 - github.com/open-policy-agent/opa v0.52.0 + github.com/open-policy-agent/opa v0.53.1 github.com/opencontainers/image-spec v1.1.0-rc2 github.com/pkg/errors v0.9.1 github.com/shteou/go-ignore v0.3.1 @@ -29,9 +31,11 @@ github.com/spf13/viper v1.10.0 github.com/subosito/gotenv v1.2.0 github.com/tmccombs/hcl2json v0.3.1 + golang.org/x/exp v0.0.0-20230519143937-03e91628a987 + google.golang.org/protobuf v1.30.0 muzzammil.xyz/jsonc v1.0.0 olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 - oras.land/oras-go/v2 v2.0.2 + oras.land/oras-go/v2 v2.2.0 ) require ( @@ -45,24 +49,28 @@ github.com/agnivade/levenshtein v1.1.1 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/aws/aws-sdk-go v1.44.258 // indirect + github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bitly/go-simplejson v0.5.0 // indirect + github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/cockroachdb/apd/v2 v2.0.1 // indirect github.com/containerd/typeurl v1.0.2 // indirect github.com/docker/docker v23.0.0-rc.1+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect github.com/golang/protobuf v1.5.3 // indirect github.com/google/flatbuffers v22.9.29+incompatible // indirect - github.com/google/go-cmp v0.5.9 // indirect github.com/google/s2a-go v0.1.3 // indirect github.com/google/uuid v1.3.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect github.com/googleapis/gax-go/v2 v2.8.0 // indirect + github.com/gorilla/mux v1.8.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect @@ -71,6 +79,7 @@ github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.16.5 // indirect github.com/mattn/go-runewidth v0.0.14 // indirect + github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect @@ -78,14 +87,17 @@ github.com/mpvl/unique v0.0.0-20150818121801-cbe035fff7de // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml v1.9.5 // indirect + github.com/prometheus/client_golang v1.15.1 // indirect + github.com/prometheus/client_model v0.3.0 // indirect + github.com/prometheus/common v0.42.0 // indirect + github.com/prometheus/procfs v0.9.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rivo/uniseg v0.4.2 // indirect - github.com/sirupsen/logrus v1.9.0 // indirect + github.com/sirupsen/logrus v1.9.2 // indirect github.com/spf13/afero v1.6.0 // indirect github.com/spf13/cast v1.4.1 // indirect github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/pflag v1.0.5 // indirect - github.com/stretchr/testify v1.8.2 // indirect github.com/tchap/go-patricia/v2 v2.3.1 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect @@ -93,10 +105,13 @@ github.com/yashtewari/glob-intersection v0.1.0 // indirect github.com/zclconf/go-cty v1.8.1 // indirect go.opencensus.io v0.24.0 // indirect + go.opentelemetry.io/otel v1.14.0 // indirect + go.opentelemetry.io/otel/sdk v1.14.0 // indirect + go.opentelemetry.io/otel/trace v1.14.0 // indirect golang.org/x/crypto v0.8.0 // indirect - golang.org/x/net v0.9.0 // indirect + golang.org/x/net v0.10.0 // indirect golang.org/x/oauth2 v0.7.0 // indirect - golang.org/x/sync v0.1.0 // indirect + golang.org/x/sync v0.2.0 // indirect golang.org/x/sys v0.8.0 // indirect golang.org/x/text v0.9.0 // indirect golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect @@ -104,7 +119,6 @@ google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect google.golang.org/grpc v1.55.0 // indirect - google.golang.org/protobuf v1.30.0 // indirect gopkg.in/ini.v1 v1.66.2 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/go.sum new/conftest-0.43.1/go.sum --- old/conftest-0.42.1/go.sum 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/go.sum 2023-06-07 07:02:24.000000000 +0200 @@ -225,18 +225,23 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d h1:xDfNPAt8lFiC1UJrqV3uuy861HCTo708pDMbjHHdCas= github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ00z/TKoufEY6K/a0k6AhaJrQKdFe6OfVXsa4= github.com/bitly/go-simplejson v0.5.0 h1:6IH+V8/tVMab511d5bn4M7EwGXZf9Hj6i2xSwkNEM+Y= github.com/bitly/go-simplejson v0.5.0/go.mod h1:cXHtHw4XUPsvGaxgjIAn8PhEWG9NfngEKAMDJEczWVA= github.com/bradleyjkemp/cupaloy/v2 v2.6.0 h1:knToPYa2xtfg42U3I6punFEjaGFKWQRXJwj0JTv4mTs= github.com/bradleyjkemp/cupaloy/v2 v2.6.0/go.mod h1:bm7JXdkRd4BHJk9HpwqAI8BoAY1lps46Enkdqw6aRX0= +github.com/bufbuild/protocompile v0.5.1 h1:mixz5lJX4Hiz4FpqFREJHIXLfaLBntfaJv1h+/jS+Qg= +github.com/bufbuild/protocompile v0.5.1/go.mod h1:G5iLmavmF4NsYtpZFvE3B/zFch2GIY8+wjsYLR/lc40= github.com/bytecodealliance/wasmtime-go/v3 v3.0.2 h1:3uZCA/BLTIu+DqCfguByNMJa2HVHpXvjfy0Dy7g6fuA= +github.com/cenkalti/backoff/v4 v4.2.0 h1:HN5dHm3WBOgndBH6E8V0q2jIYIR3s9yglV8k/+MN3u4= 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 v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= +github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= @@ -298,6 +303,7 @@ github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.10.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= +github.com/felixge/httpsnoop v1.0.3 h1:s/nj+GCswXYzN5v2DpNMuMQYe+0DDwt5WVCU6CWBdXk= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/foxcpp/go-mockdns v1.0.0 h1:7jBqxd3WDWwi/6WhDvacvH1XsN3rOLXyHM1uhvIx6FI= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= @@ -315,6 +321,11 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-test/deep v1.0.3 h1:ZrJSEWsXzPOxaZnFteGEfooLba+ju3FYIbOrS+rQd68= github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= @@ -430,11 +441,15 @@ github.com/googleapis/gax-go/v2 v2.8.0 h1:UBtEZqx1bjXtOQ5BVTkuYghXrr3N4V123VKJK67vJZc= github.com/googleapis/gax-go/v2 v2.8.0/go.mod h1:4orTrqY6hXxxaUL4LHIPl6lGo8vAE38/qKbhSAKP6QI= github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= +github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= +github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.7.0 h1:BZHcxBETFHIdVyhyEfOvn/RdU/QGdLI4y34qQGjGWO0= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= @@ -501,6 +516,7 @@ github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= +github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.1.43 h1:JKfpVSCB84vrAmHzyrsxB5NAr5kLoMXZArPSw7Qlgyg= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= @@ -520,8 +536,8 @@ github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= -github.com/open-policy-agent/opa v0.52.0 h1:Rv3F+VCDqsufaiYy/3S9/Iuk0yfcREK4iZmWbNsKZjA= -github.com/open-policy-agent/opa v0.52.0/go.mod h1:2n99s7WY/BXZUWUOq10JdTgK+G6XM4FYGoe7kQ5Vg0s= +github.com/open-policy-agent/opa v0.53.1 h1:APN8iA7Txgel13kSkc6S8dbUulydiPojXt6iyubmB7Q= +github.com/open-policy-agent/opa v0.53.1/go.mod h1:j3wl8FqSz/+u33Scl72Ms2wxkZx4yZPdqSCrOqBqdsA= 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-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= @@ -539,17 +555,21 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_golang v1.15.0 h1:5fCgGYogn0hFdhyhLbw7hEsWxufKtY9klyvdNfFlFhM= +github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI= +github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= +github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= +github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI= +github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY= github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc h1:gSVONBi2HWMFXCa9jFdYvYk7IwW/mTLxWOF7rXS4LO0= github.com/protocolbuffers/txtpbfmt v0.0.0-20201118171849-f6a6b3f636fc/go.mod h1:KbKfKPy2I6ecOIGA9apfheFv14+P3RSmmQvshofQyMY= @@ -573,8 +593,8 @@ github.com/shteou/go-ignore v0.3.1/go.mod h1:hMVyBe+qt5/Z11W/Fxxf86b5SuL8kM29xNWLYob9Vos= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= -github.com/sirupsen/logrus v1.9.0/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= +github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/spdx/gordf v0.0.0-20201111095634-7098f93598fb/go.mod h1:uKWaldnbMnjsSAXRurWqqrdyZen1R7kxl8TkmWk2OyM= @@ -615,7 +635,6 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8= -github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/tchap/go-patricia/v2 v2.3.1 h1:6rQp39lgIYZ+MHmdEq4xzuk1t7OdC35z/xm0BGhTkes= @@ -663,7 +682,19 @@ go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.37.0 h1:yt2NKzK7Vyo6h0+X8BA4FpreZQTlVEIarnsBP/H5mzs= +go.opentelemetry.io/otel v1.14.0 h1:/79Huy8wbf5DnIPhemGB+zEPVwnN6fuQybr/SRXa6hM= +go.opentelemetry.io/otel v1.14.0/go.mod h1:o4buv+dJzx8rohcUeRmWUZhqupFvzWis188WlggnNeU= +go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.14.0 h1:/fXHZHGvro6MVqV34fJzDhi7sHGpX3Ej/Qjmfn003ho= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.14.0 h1:TKf2uAs2ueguzLaxOCBXNpHxfO/aC7PAdDsSH0IbeRQ= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.14.0 h1:ap+y8RXX3Mu9apKVtOkM6WSFESLM8K3wNQyOU8sWHcc= +go.opentelemetry.io/otel/metric v0.34.0 h1:MCPoQxcg/26EuuJwpYN1mZTeCYAUGx8ABxfW07YkjP8= +go.opentelemetry.io/otel/sdk v1.14.0 h1:PDCppFRDq8A1jL9v6KMI6dYesaq+DFcDZvjsoGvxGzY= +go.opentelemetry.io/otel/sdk v1.14.0/go.mod h1:bwIC5TjrNG6QDCHNWvW4HLHtUQ4I+VQDsnjhvyZCALM= +go.opentelemetry.io/otel/trace v1.14.0 h1:wp2Mmvj41tDsyAJXiWDWpfNsOiIyd38fy85pyKcFq/M= +go.opentelemetry.io/otel/trace v1.14.0/go.mod h1:8avnQLK+CG77yNLUae4ea2JDQ6iT+gozhnZjy/rw9G8= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= +go.opentelemetry.io/proto/otlp v0.19.0 h1:IVN6GR+mhC4s5yfcTbmzHYODqvWAp3ZedA2SJPI1Nnw= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= @@ -692,6 +723,8 @@ 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-20210126221216-84987778548c/go.mod h1:I6l2HNBLBZEcrOoCpyKLdY2lHoRZ8lI4x60KMCQDft4= +golang.org/x/exp v0.0.0-20230519143937-03e91628a987 h1:3xJIFvzUFbu4ls0BTBYcgbCGhA63eAOEMxIHugyXJqA= +golang.org/x/exp v0.0.0-20230519143937-03e91628a987/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w= 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= @@ -773,8 +806,8 @@ golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM= -golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns= +golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= +golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= 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= @@ -816,8 +849,8 @@ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o= -golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= +golang.org/x/sync v0.2.0/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-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1230,8 +1263,8 @@ muzzammil.xyz/jsonc v1.0.0/go.mod h1:rFv8tUUKe+QLh7v02BhfxXEf4ZHhYD7unR93HL/1Uvo= olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3 h1:slmdOY3vp8a7KQbHkL+FLbvbkgMqmXojpFUO/jENuqQ= olympos.io/encoding/edn v0.0.0-20201019073823-d3554ca0b0a3/go.mod h1:oVgVk4OWVDi43qWBEyGhXgYxt7+ED4iYNpTngSLX2Iw= -oras.land/oras-go/v2 v2.0.2 h1:3aSQdJ7EUC0ft2e9PjJB9Jzastz5ojPA4LzZ3Q4YbUc= -oras.land/oras-go/v2 v2.0.2/go.mod h1:PWnWc/Kyyg7wUTUsDHshrsJkzuxXzreeMd6NrfdnFSo= +oras.land/oras-go/v2 v2.2.0 h1:E1fqITD56Eg5neZbxBtAdZVgDHD6wBabJo6xESTcQyo= +oras.land/oras-go/v2 v2.2.0/go.mod h1:pXjn0+KfarspMHHNR3A56j3tgvr+mxArHuI8qVn59v8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/internal/commands/test.go new/conftest-0.43.1/internal/commands/test.go --- old/conftest-0.42.1/internal/commands/test.go 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/internal/commands/test.go 2023-06-07 07:02:24.000000000 +0200 @@ -96,6 +96,7 @@ "output", "parser", "policy", + "proto-file-dirs", "capabilities", "trace", "strict", @@ -181,5 +182,7 @@ cmd.Flags().StringSliceP("namespace", "n", []string{"main"}, "Test policies in a specific namespace") cmd.Flags().StringSliceP("data", "d", []string{}, "A list of paths from which data for the rego policies will be recursively loaded") + cmd.Flags().StringSlice("proto-file-dirs", []string{}, "A list of directories containing Protocol Buffer definitions") + return &cmd } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/internal/commands/verify.go new/conftest-0.43.1/internal/commands/verify.go --- old/conftest-0.42.1/internal/commands/verify.go 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/internal/commands/verify.go 2023-06-07 07:02:24.000000000 +0200 @@ -68,7 +68,18 @@ Short: "Verify Rego unit tests", Long: verifyDesc, PreRunE: func(cmd *cobra.Command, args []string) error { - flagNames := []string{"data", "no-color", "output", "policy", "trace", "report", "quiet", "junit-hide-message", "capabilities"} + flagNames := []string{ + "data", + "no-color", + "output", + "policy", + "trace", + "report", + "quiet", + "junit-hide-message", + "capabilities", + "proto-file-dirs", + } for _, name := range flagNames { if err := viper.BindPFlag(name, cmd.Flags().Lookup(name)); err != nil { return fmt.Errorf("bind flag: %w", err) @@ -133,5 +144,7 @@ cmd.Flags().StringSliceP("data", "d", []string{}, "A list of paths from which data for the rego policies will be recursively loaded") cmd.Flags().StringSliceP("policy", "p", []string{"policy"}, "Path to the Rego policy files directory") + cmd.Flags().StringSlice("proto-file-dirs", []string{}, "A list of directories containing Protocol Buffer definitions") + return &cmd } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/parser/parser.go new/conftest-0.43.1/parser/parser.go --- old/conftest-0.42.1/parser/parser.go 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/parser/parser.go 2023-06-07 07:02:24.000000000 +0200 @@ -4,12 +4,15 @@ "bufio" "fmt" "io" + "io/fs" "os" "path/filepath" "sort" "strings" "github.com/open-policy-agent/conftest/parser/cyclonedx" + "github.com/spf13/viper" + "golang.org/x/exp/slices" "github.com/open-policy-agent/conftest/parser/cue" "github.com/open-policy-agent/conftest/parser/docker" @@ -25,6 +28,7 @@ "github.com/open-policy-agent/conftest/parser/jsonnet" "github.com/open-policy-agent/conftest/parser/properties" "github.com/open-policy-agent/conftest/parser/spdx" + "github.com/open-policy-agent/conftest/parser/textproto" "github.com/open-policy-agent/conftest/parser/toml" "github.com/open-policy-agent/conftest/parser/vcl" "github.com/open-policy-agent/conftest/parser/xml" @@ -48,6 +52,7 @@ JSONNET = "jsonnet" PROPERTIES = "properties" SPDX = "spdx" + TEXTPROTO = "textproto" TOML = "toml" VCL = "vcl" XML = "xml" @@ -102,11 +107,46 @@ return &cyclonedx.Parser{}, nil case DOTENV: return &dotenv.Parser{}, nil + case TEXTPROTO: + parser := &textproto.Parser{} + if dirs := viper.GetStringSlice("proto-file-dirs"); len(dirs) > 0 { + files, err := findFilesWithExt(dirs, ".proto") + if err != nil { + return nil, fmt.Errorf("find proto files: %w", err) + } + if err := parser.LoadProtoFiles(files); err != nil { + return nil, fmt.Errorf("load protos: %w", err) + } + } + + return parser, nil default: return nil, fmt.Errorf("unknown parser: %v", parser) } } +func findFilesWithExt(dirs []string, ext string) ([]string, error) { + var files []string + for _, dir := range dirs { + err := filepath.Walk(dir, func(path string, info fs.FileInfo, err error) error { + if err != nil { + return err + } + if info.IsDir() { + return nil + } + if strings.HasSuffix(info.Name(), ext) { + files = append(files, path) + } + return nil + }) + if err != nil { + return nil, fmt.Errorf("walk dir %q: %w", dir, err) + } + } + return files, nil +} + // NewFromPath returns a file parser based on the file type // that exists at the given path. func NewFromPath(path string) (Parser, error) { @@ -152,6 +192,10 @@ return New(DOTENV) } + if slices.Contains(textproto.TextProtoFileExtensions, fileExtension) { + return New(TEXTPROTO) + } + parser, err := New(fileExtension) if err != nil { return nil, fmt.Errorf("new: %w", err) @@ -175,6 +219,7 @@ JSONNET, PROPERTIES, SPDX, + TEXTPROTO, TOML, VCL, XML, @@ -188,11 +233,8 @@ // FileSupported returns true if the file at the given path is // a file that can be parsed. func FileSupported(path string) bool { - if _, err := NewFromPath(path); err != nil { - return false - } - - return true + _, err := NewFromPath(path) + return err == nil } // ParseConfigurations parses and returns the configurations from the given diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/parser/parser_test.go new/conftest-0.43.1/parser/parser_test.go --- old/conftest-0.42.1/parser/parser_test.go 2023-05-08 02:53:25.000000000 +0200 +++ new/conftest-0.43.1/parser/parser_test.go 2023-06-07 07:02:24.000000000 +0200 @@ -10,6 +10,7 @@ "github.com/open-policy-agent/conftest/parser/ignore" "github.com/open-policy-agent/conftest/parser/json" "github.com/open-policy-agent/conftest/parser/jsonc" + "github.com/open-policy-agent/conftest/parser/textproto" "github.com/open-policy-agent/conftest/parser/yaml" ) @@ -119,6 +120,11 @@ &dotenv.Parser{}, false, }, + { + "foo.textproto", + &textproto.Parser{}, + false, + }, } for _, testCase := range testCases { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/parser/textproto/textproto.go new/conftest-0.43.1/parser/textproto/textproto.go --- old/conftest-0.42.1/parser/textproto/textproto.go 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/parser/textproto/textproto.go 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,150 @@ +// Package textproto provides an interface to parse Protocol Buffers in their +// textual format. +// +// https://protobuf.dev/reference/protobuf/textformat-spec/ +package textproto + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "io" + "os" + "regexp" + + protoparser "github.com/bufbuild/protocompile/parser" + "github.com/bufbuild/protocompile/reporter" + "google.golang.org/protobuf/encoding/protojson" + "google.golang.org/protobuf/encoding/prototext" + "google.golang.org/protobuf/reflect/protodesc" + "google.golang.org/protobuf/reflect/protoreflect" + "google.golang.org/protobuf/reflect/protoregistry" + "google.golang.org/protobuf/types/dynamicpb" +) + +// TextProtoFileExtensions is the list of all file extensions associated with +// textproto files. +var TextProtoFileExtensions = []string{"textproto", "textpb"} + +var ( + msgTypeRegexp = regexp.MustCompile(`#\s+proto-message:\s+([a-zA-Z0-9\.]+)`) + marshaller = protojson.MarshalOptions{ + UseProtoNames: true, // Keep field names 1-to-1 with proto field definitions. + } + globalFiles = protoregistry.GlobalFiles // Alias for convenience. + globalTypes = protoregistry.GlobalTypes // Alias for convenience. +) + +// Parser provides methods to parse textproto files. +type Parser struct{} + +// LoadProtoFiles loads Protocol Buffer definitions so that the textproto files +// can be parsed correctly. +func (p *Parser) LoadProtoFiles(filePaths []string) error { + if len(filePaths) == 0 { + return fmt.Errorf("must supply at least one file path") + } + if err := loadFiles(filePaths); err != nil { + return fmt.Errorf("load messages from files: %w", err) + } + return nil +} + +// Unmarshal unmarshals a textproto file. +func (p *Parser) Unmarshal(data []byte, v any) error { + ty, err := extractMsgType(data) + if err != nil { + return fmt.Errorf("extract proto message type: %w", err) + } + desc, err := globalTypes.FindMessageByName(protoreflect.FullName(ty)) + if err != nil { + return fmt.Errorf("look up message type %q: %w", ty, err) + } + msg, ok := desc.Zero().(protoreflect.ProtoMessage) + if !ok { + return fmt.Errorf("could not assert ProtoMessage for %q", ty) + } + if err := prototext.Unmarshal(data, msg); err != nil { + return fmt.Errorf("unmarshal textproto: %w", err) + } + + by, err := marshaller.Marshal(msg) + if err != nil { + return fmt.Errorf("marshal JSON: %w", err) + } + if err := json.Unmarshal(by, v); err != nil { + return fmt.Errorf("unmarshal JSON: %w", err) + } + + return nil +} + +func loadFiles(paths []string) error { + for _, path := range paths { + if err := loadFile(path); err != nil { + return fmt.Errorf("load proto file %s: %w", path, err) + } + } + return nil +} + +func loadFile(path string) error { + fh, err := os.OpenFile(path, os.O_RDONLY, os.ModePerm) + if err != nil { + return fmt.Errorf("open file: %w", err) + } + defer fh.Close() + return load(path, fh) +} + +func load(fileName string, r io.Reader) error { + // Only load each file once. + if _, err := globalFiles.FindFileByPath(fileName); err == nil { + return nil + } + + handler := reporter.NewHandler(nil) + node, err := protoparser.Parse(fileName, r, handler) + if err != nil { + return fmt.Errorf("parse proto: %w", err) + } + res, err := protoparser.ResultFromAST(node, true /* validate */, handler) + if err != nil { + return fmt.Errorf("convert from AST: %w", err) + } + fd, err := protodesc.NewFile(res.FileDescriptorProto(), globalFiles) + if err != nil { + return fmt.Errorf("convert to FileDescriptor: %w", err) + } + if err := globalFiles.RegisterFile(fd); err != nil { + return fmt.Errorf("register file: %w", err) + } + for i := 0; i < fd.Messages().Len(); i++ { + msg := fd.Messages().Get(i) + if err := globalTypes.RegisterMessage(dynamicpb.NewMessageType(msg)); err != nil { + return fmt.Errorf("register message %q: %w", msg.FullName(), err) + } + } + for i := 0; i < fd.Extensions().Len(); i++ { + ext := fd.Extensions().Get(i) + if err := globalTypes.RegisterExtension(dynamicpb.NewExtensionType(ext)); err != nil { + return fmt.Errorf("register extension %q: %w", ext.FullName(), err) + } + } + + return nil +} + +func extractMsgType(data []byte) (string, error) { + s := bufio.NewScanner(bytes.NewReader(data)) + for s.Scan() { + matches := msgTypeRegexp.FindStringSubmatch(s.Text()) + if len(matches) == 0 { + continue + } + return matches[1], nil + } + + return "", fmt.Errorf("file does not contain necessary proto-message comment") +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.42.1/parser/textproto/textproto_test.go new/conftest-0.43.1/parser/textproto/textproto_test.go --- old/conftest-0.42.1/parser/textproto/textproto_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.43.1/parser/textproto/textproto_test.go 2023-06-07 07:02:24.000000000 +0200 @@ -0,0 +1,106 @@ +package textproto + +import ( + "strings" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestUnmarshal(t *testing.T) { + t.Parallel() + + const ( + testProtoDef = ` +syntax = "proto3"; +package conftest.prototext; + +enum AnOption { + OPTION_UNDEFIED = 0; + OPTION_GOOD = 1; + OPTION_GREAT = 2; +} + +message TestMessage { + string name = 1; + int32 number = 2; + bool truthy = 3; + AnOption option = 4; +} +` + testTextProto = ` +# proto-message: conftest.prototext.TestMessage + +name: "foobarbaz" +number: 123123123 +truthy: true +option: OPTION_GOOD +` + ) + + if err := load("test_file.proto", strings.NewReader(testProtoDef)); err != nil { + t.Fatalf("Load test proto: %v", err) + } + + testCases := []struct { + desc string + input string + want map[string]any + wantErr bool + }{ + { + desc: "valid case", + input: testTextProto, + want: map[string]any{ + "name": "foobarbaz", + "number": float64(123123123), + "truthy": true, + "option": "OPTION_GOOD", + }, + }, + { + desc: "omitted fields are OK", + input: "# proto-message: conftest.prototext.TestMessage\nnumber: 123123123", + want: map[string]any{ + "number": float64(123123123), + }, + }, + { + desc: "missing proto-message raises error", + input: "number: 123123123", + wantErr: true, + want: make(map[string]any), + }, + { + desc: "unknown proto-message raises error", + input: strings.ReplaceAll(testTextProto, "conftest", "another_package"), + wantErr: true, + want: make(map[string]any), + }, + { + desc: "known but invalid message raises an error", + input: strings.ReplaceAll(testTextProto, "conftest.prototext.TestMessage", "google.protobuf.FieldDescriptorProto"), + wantErr: true, + want: make(map[string]any), + }, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.desc, func(t *testing.T) { + t.Parallel() + + parser := &Parser{} + got := make(map[string]any) + + err := parser.Unmarshal([]byte(tc.input), &got) + if err == nil && tc.wantErr || err != nil && !tc.wantErr { + t.Errorf("unexpected error state, got %v", err) + return + } + if diff := cmp.Diff(tc.want, got); diff != "" { + t.Errorf("unexpected diff (+got, -want):\n%s", diff) + } + }) + } +} ++++++ conftest.obsinfo ++++++ --- /var/tmp/diff_new_pack.mNMcwd/_old 2023-06-13 16:10:47.551339359 +0200 +++ /var/tmp/diff_new_pack.mNMcwd/_new 2023-06-13 16:10:47.555339383 +0200 @@ -1,5 +1,5 @@ name: conftest -version: 0.42.1 -mtime: 1683507205 -commit: af6a868708642dcf7863012c115a671606bde9cd +version: 0.43.1 +mtime: 1686114144 +commit: 1f00a2e2e4c140f5271524bfc156b8eca39a4f7a ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/conftest/vendor.tar.gz /work/SRC/openSUSE:Factory/.conftest.new.15902/vendor.tar.gz differ: char 5, line 1