Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package conftest for openSUSE:Factory checked in at 2026-04-02 17:43:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/conftest (Old) and /work/SRC/openSUSE:Factory/.conftest.new.21863 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "conftest" Thu Apr 2 17:43:57 2026 rev:37 rq:1344314 version:0.68.0 Changes: -------- --- /work/SRC/openSUSE:Factory/conftest/conftest.changes 2026-04-01 19:52:52.390724446 +0200 +++ /work/SRC/openSUSE:Factory/.conftest.new.21863/conftest.changes 2026-04-02 17:45:26.321893456 +0200 @@ -1,0 +2,18 @@ +Thu Apr 02 04:35:25 UTC 2026 - Johannes Kastl <[email protected]> + +- Update to version 0.68.0: + * New Features + - a604f55: feat(parser): Add nginx parser (#1289) (@jalseth) + * Bug Fixes + - 487a2e1: fix: Skip extensionless files that are not + recognized types (#1302) (@ricardbejarano) + * OPA Changes + - 472e4e3: build(deps): bump github.com/open-policy-agent/opa + from 1.14.1 to 1.15.1 (#1303) (@dependabot[bot]) + * Other Changes + - 6d521ef: build(deps): bump github.com/google/go-jsonnet from + 0.21.0 to 0.22.0 (#1299) (@dependabot[bot]) + - 2d5f1c2: build(deps): bump github.com/moby/buildkit from + 0.28.0 to 0.29.0 (#1306) (@dependabot[bot]) + +------------------------------------------------------------------- Old: ---- conftest-0.67.1.obscpio New: ---- conftest-0.68.0.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ conftest.spec ++++++ --- /var/tmp/diff_new_pack.EBW5YR/_old 2026-04-02 17:45:27.341935224 +0200 +++ /var/tmp/diff_new_pack.EBW5YR/_new 2026-04-02 17:45:27.341935224 +0200 @@ -17,7 +17,7 @@ Name: conftest -Version: 0.67.1 +Version: 0.68.0 Release: 0 Summary: Tool to write tests against structured configuration data License: Apache-2.0 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.EBW5YR/_old 2026-04-02 17:45:27.409938008 +0200 +++ /var/tmp/diff_new_pack.EBW5YR/_new 2026-04-02 17:45:27.413938173 +0200 @@ -4,19 +4,19 @@ <param name="scm">git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="versionrewrite-pattern">v(.*)</param> - <param name="revision">v0.67.1</param> + <param name="revision">v0.68.0</param> <param name="changesgenerate">enable</param> </service> <service name="set_version" mode="manual"> </service> - <service name="tar" mode="buildtime"/> + <service name="go_modules" mode="manual"> + </service> + <!-- services below are running at buildtime --> + <service name="tar" mode="buildtime"> + </service> <service name="recompress" mode="buildtime"> - <param name="file">conftest-*.tar</param> + <param name="file">*.tar</param> <param name="compression">gz</param> </service> - <service name="go_modules" mode="manual"> - <!-- CVE-2026-33747, remove once https://github.com/open-policy-agent/conftest/pull/1300 is merged --> - <param name="replace">github.com/moby/buildkit=github.com/moby/[email protected]</param> - </service> </services> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.EBW5YR/_old 2026-04-02 17:45:27.449939646 +0200 +++ /var/tmp/diff_new_pack.EBW5YR/_new 2026-04-02 17:45:27.457939974 +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">9cef5a296e82fc2b0c18a7b13a262fbd0e1eb115</param></service></servicedata> + <param name="changesrevision">2d5f1c266a5695698982394b4dc1a7d7b5084270</param></service></servicedata> (No newline at EOF) ++++++ conftest-0.67.1.obscpio -> conftest-0.68.0.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/docs/index.md new/conftest-0.68.0/docs/index.md --- old/conftest-0.67.1/docs/index.md 2026-03-23 23:59:51.000000000 +0100 +++ new/conftest-0.68.0/docs/index.md 2026-04-02 03:14:42.000000000 +0200 @@ -95,6 +95,7 @@ - INI - JSON - Jsonnet +- nginx - Property files (.properties) - SPDX - TextProto (Protocol Buffers) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/examples/nginx/nginx.conf new/conftest-0.68.0/examples/nginx/nginx.conf --- old/conftest-0.67.1/examples/nginx/nginx.conf 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.68.0/examples/nginx/nginx.conf 2026-04-02 03:14:42.000000000 +0200 @@ -0,0 +1,19 @@ +worker_processes 1; + +http { + server { + listen 80; + server_name example.com; + return 301 https://$host$request_uri; + } + + server { + listen 443 ssl; + server_name example.com; + + location / { + root /var/www/html; + index index.html; + } + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/examples/nginx/policy/deny.rego new/conftest-0.68.0/examples/nginx/policy/deny.rego --- old/conftest-0.67.1/examples/nginx/policy/deny.rego 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.68.0/examples/nginx/policy/deny.rego 2026-04-02 03:14:42.000000000 +0200 @@ -0,0 +1,33 @@ +package main + +import rego.v1 + +# Collect all server blocks nested inside http blocks. +server_blocks contains server if { + some directive in input.directives + directive.name == "http" + some server in directive.block.directives + server.name == "server" +} + +# A server listens without SSL if any listen directive does not include "ssl" as a parameter. +listens_without_ssl(server) if { + some directive in server.block.directives + directive.name == "listen" + not "ssl" in directive.parameters +} + +# A server redirects to HTTPS if it has a "return 301 https://..." directive. +redirects_to_https(server) if { + some directive in server.block.directives + directive.name == "return" + directive.parameters[0] == "301" + startswith(directive.parameters[1], "https://") +} + +deny contains msg if { + some server in server_blocks + listens_without_ssl(server) + not redirects_to_https(server) + msg := "Server listening without SSL must redirect to HTTPS" +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/examples/nginx/policy/deny_test.rego new/conftest-0.68.0/examples/nginx/policy/deny_test.rego --- old/conftest-0.67.1/examples/nginx/policy/deny_test.rego 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.68.0/examples/nginx/policy/deny_test.rego 2026-04-02 03:14:42.000000000 +0200 @@ -0,0 +1,104 @@ +package main + +import rego.v1 + +empty(value) if { + count(value) == 0 +} + +no_violations if { + empty(deny) +} + +# A config with only an SSL listener should have no violations. +test_ssl_listener if { + cfg := parse_config("nginx", ` + http { + server { + listen 443 ssl; + server_name example.com; + } + } + `) + no_violations with input as cfg +} + +# A server that redirects port 80 to HTTPS should have no violations. +test_port_80_redirects_to_https if { + cfg := parse_config("nginx", ` + http { + server { + listen 80; + server_name example.com; + return 301 https://$host$request_uri; + } + } + `) + no_violations with input as cfg +} + +# A server listening on port 80 without a redirect should be denied. +test_port_80_without_redirect if { + cfg := parse_config("nginx", ` + http { + server { + listen 80; + server_name example.com; + location / { + root /var/www/html; + } + } + } + `) + deny["Server listening without SSL must redirect to HTTPS"] with input as cfg +} + +# A non-HTTPS redirect (e.g. return 301 http://...) should still be denied. +test_port_80_redirects_to_http if { + cfg := parse_config("nginx", ` + http { + server { + listen 80; + server_name example.com; + return 301 http://other.example.com; + } + } + `) + deny["Server listening without SSL must redirect to HTTPS"] with input as cfg +} + +# A non-standard HTTP port (e.g. 8080) without a redirect should also be denied. +test_non_standard_port_without_redirect if { + cfg := parse_config("nginx", ` + http { + server { + listen 8080; + server_name example.com; + location / { + root /var/www/html; + } + } + } + `) + deny["Server listening without SSL must redirect to HTTPS"] with input as cfg +} + +# A non-standard HTTP port that redirects to HTTPS should have no violations. +test_non_standard_port_redirects_to_https if { + cfg := parse_config("nginx", ` + http { + server { + listen 8080; + server_name example.com; + return 301 https://$host$request_uri; + } + } + `) + no_violations with input as cfg +} + +# The sample nginx.conf uses a port-80-to-HTTPS redirect and should pass. +test_sample_config if { + cfg := parse_config_file("../nginx.conf") + no_violations with input as cfg +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/go.mod new/conftest-0.68.0/go.mod --- old/conftest-0.67.1/go.mod 2026-03-23 23:59:51.000000000 +0100 +++ new/conftest-0.68.0/go.mod 2026-04-02 03:14:42.000000000 +0200 @@ -12,16 +12,16 @@ github.com/go-akka/configuration v0.0.0-20200606091224-a002c0330665 github.com/go-ini/ini v1.67.0 github.com/google/go-cmp v0.7.0 - github.com/google/go-jsonnet v0.21.0 + github.com/google/go-jsonnet v0.22.0 github.com/hashicorp/go-getter v1.8.5 github.com/hashicorp/hcl v1.0.0 github.com/jstemmer/go-junit-report v1.0.0 github.com/logrusorgru/aurora v2.0.3+incompatible github.com/magiconair/properties v1.8.10 - github.com/moby/buildkit v0.28.0 + github.com/moby/buildkit v0.29.0 github.com/muhammadmuzzammil1998/jsonc v1.0.0 github.com/olekukonko/tablewriter v1.1.0 - github.com/open-policy-agent/opa v1.14.1 + github.com/open-policy-agent/opa v1.15.1 github.com/opencontainers/image-spec v1.1.1 github.com/owenrumney/go-sarif/v2 v2.3.3 github.com/shteou/go-ignore v0.3.1 @@ -30,6 +30,7 @@ github.com/spf13/viper v1.21.0 github.com/subosito/gotenv v1.6.0 github.com/tmccombs/hcl2json v0.6.7 + github.com/tufanbarisyildirim/gonginx v0.0.0-20260220081509-8e17ce617db3 github.com/tzrikka/xdg v1.3.2 golang.org/x/exp v0.0.0-20250911091902-df9299821621 google.golang.org/protobuf v1.36.11 @@ -54,25 +55,25 @@ github.com/agnivade/levenshtein v1.2.1 // indirect github.com/anchore/go-struct-converter v0.1.0 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect - github.com/aws/aws-sdk-go-v2 v1.41.1 // indirect - github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 // indirect - github.com/aws/aws-sdk-go-v2/config v1.32.9 // indirect - github.com/aws/aws-sdk-go-v2/credentials v1.19.9 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 // indirect - github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 // indirect + github.com/aws/aws-sdk-go-v2 v1.41.4 // indirect + github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 // indirect + github.com/aws/aws-sdk-go-v2/config v1.32.12 // indirect + github.com/aws/aws-sdk-go-v2/credentials v1.19.12 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 // indirect github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 // indirect github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20 // indirect github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17 // indirect github.com/aws/aws-sdk-go-v2/service/s3 v1.96.0 // indirect - github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.30.10 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.14 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 // indirect - github.com/aws/smithy-go v1.24.0 // indirect + github.com/aws/aws-sdk-go-v2/service/signin v1.0.8 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.30.13 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.41.9 // indirect + github.com/aws/smithy-go v1.24.2 // 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.3.0 // indirect @@ -90,7 +91,7 @@ github.com/go-jose/go-jose/v4 v4.1.3 // indirect github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect - github.com/go-viper/mapstructure/v2 v2.4.0 // indirect + github.com/go-viper/mapstructure/v2 v2.5.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.5 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -103,7 +104,7 @@ github.com/hashicorp/go-version v1.8.0 // indirect github.com/hashicorp/hcl/v2 v2.23.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/klauspost/compress v1.18.4 // indirect + github.com/klauspost/compress v1.18.5 // indirect github.com/lestrrat-go/blackmagic v1.0.4 // indirect github.com/lestrrat-go/dsig v1.0.0 // indirect github.com/lestrrat-go/dsig-secp256k1 v1.0.0 // indirect @@ -167,5 +168,5 @@ google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20 // indirect - google.golang.org/grpc v1.79.1 // indirect + google.golang.org/grpc v1.79.3 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/go.sum new/conftest-0.68.0/go.sum --- old/conftest-0.67.1/go.sum 2026-03-23 23:59:51.000000000 +0100 +++ new/conftest-0.68.0/go.sum 2026-04-02 03:14:42.000000000 +0200 @@ -54,44 +54,44 @@ github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0 h1:jfIu9sQUG6Ig+0+Ap1h4unLjW6YQJpKZVmUzxsD4E/Q= github.com/arbovm/levenshtein v0.0.0-20160628152529-48b4e1c0c4d0/go.mod h1:t2tdKJDJF9BV14lnkjHmOQgcvEKgtqs5a1N3LNdJhGE= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/aws/aws-sdk-go-v2 v1.41.1 h1:ABlyEARCDLN034NhxlRUSZr4l71mh+T5KAeGh6cerhU= -github.com/aws/aws-sdk-go-v2 v1.41.1/go.mod h1:MayyLB8y+buD9hZqkCW3kX1AKq07Y5pXxtgB+rRFhz0= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4 h1:489krEF9xIGkOaaX3CE/Be2uWjiXrkCH6gUX+bZA/BU= -github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.4/go.mod h1:IOAPF6oT9KCsceNTvvYMNHy0+kMF8akOjeDvPENWxp4= -github.com/aws/aws-sdk-go-v2/config v1.32.9 h1:ktda/mtAydeObvJXlHzyGpK1xcsLaP16zfUPDGoW90A= -github.com/aws/aws-sdk-go-v2/config v1.32.9/go.mod h1:U+fCQ+9QKsLW786BCfEjYRj34VVTbPdsLP3CHSYXMOI= -github.com/aws/aws-sdk-go-v2/credentials v1.19.9 h1:sWvTKsyrMlJGEuj/WgrwilpoJ6Xa1+KhIpGdzw7mMU8= -github.com/aws/aws-sdk-go-v2/credentials v1.19.9/go.mod h1:+J44MBhmfVY/lETFiKI+klz0Vym2aCmIjqgClMmW82w= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17 h1:I0GyV8wiYrP8XpA70g1HBcQO1JlQxCMTW9npl5UbDHY= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.17/go.mod h1:tyw7BOl5bBe/oqvoIeECFJjMdzXoa/dfVz3QQ5lgHGA= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17 h1:xOLELNKGp2vsiteLsvLPwxC+mYmO6OZ8PYgiuPJzF8U= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.17/go.mod h1:5M5CI3D12dNOtH3/mk6minaRwI2/37ifCURZISxA/IQ= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17 h1:WWLqlh79iO48yLkj1v3ISRNiv+3KdQoZ6JWyfcsyQik= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.17/go.mod h1:EhG22vHRrvF8oXSTYStZhJc1aUgKtnJe+aOiFEV90cM= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4 h1:WKuaxf++XKWlHWu9ECbMlha8WOEGm0OUEZqm4K/Gcfk= -github.com/aws/aws-sdk-go-v2/internal/ini v1.8.4/go.mod h1:ZWy7j6v1vWGmPReu0iSGvRiise4YI5SkR3OHKTZ6Wuc= +github.com/aws/aws-sdk-go-v2 v1.41.4 h1:10f50G7WyU02T56ox1wWXq+zTX9I1zxG46HYuG1hH/k= +github.com/aws/aws-sdk-go-v2 v1.41.4/go.mod h1:mwsPRE8ceUUpiTgF7QmQIJ7lgsKUPQOUl3o72QBrE1o= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5 h1:zWFmPmgw4sveAYi1mRqG+E/g0461cJ5M4bJ8/nc6d3Q= +github.com/aws/aws-sdk-go-v2/aws/protocol/eventstream v1.7.5/go.mod h1:nVUlMLVV8ycXSb7mSkcNu9e3v/1TJq2RTlrPwhYWr5c= +github.com/aws/aws-sdk-go-v2/config v1.32.12 h1:O3csC7HUGn2895eNrLytOJQdoL2xyJy0iYXhoZ1OmP0= +github.com/aws/aws-sdk-go-v2/config v1.32.12/go.mod h1:96zTvoOFR4FURjI+/5wY1vc1ABceROO4lWgWJuxgy0g= +github.com/aws/aws-sdk-go-v2/credentials v1.19.12 h1:oqtA6v+y5fZg//tcTWahyN9PEn5eDU/Wpvc2+kJ4aY8= +github.com/aws/aws-sdk-go-v2/credentials v1.19.12/go.mod h1:U3R1RtSHx6NB0DvEQFGyf/0sbrpJrluENHdPy1j/3TE= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20 h1:zOgq3uezl5nznfoK3ODuqbhVg1JzAGDUhXOsU0IDCAo= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.18.20/go.mod h1:z/MVwUARehy6GAg/yQ1GO2IMl0k++cu1ohP9zo887wE= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20 h1:CNXO7mvgThFGqOFgbNAP2nol2qAWBOGfqR/7tQlvLmc= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.4.20/go.mod h1:oydPDJKcfMhgfcgBUZaG+toBbwy8yPWubJXBVERtI4o= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20 h1:tN6W/hg+pkM+tf9XDkWUbDEjGLb+raoBMFsTodcoYKw= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.7.20/go.mod h1:YJ898MhD067hSHA6xYCx5ts/jEd8BSOLtQDL3iZsvbc= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6 h1:qYQ4pzQ2Oz6WpQ8T3HvGHnZydA72MnLuFK9tJwmrbHw= +github.com/aws/aws-sdk-go-v2/internal/ini v1.8.6/go.mod h1:O3h0IK87yXci+kg6flUKzJnWeziQUKciKrLjcatSNcY= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17 h1:JqcdRG//czea7Ppjb+g/n4o8i/R50aTBHkA7vu0lK+k= github.com/aws/aws-sdk-go-v2/internal/v4a v1.4.17/go.mod h1:CO+WeGmIdj/MlPel2KwID9Gt7CNq4M65HUfBW97liM0= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4 h1:0ryTNEdJbzUCEWkVXEXoqlXV72J5keC1GvILMOuD00E= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.4/go.mod h1:HQ4qwNZh32C3CBeO6iJLQlgtMzqeG17ziAA/3KDJFow= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7 h1:5EniKhLZe4xzL7a+fU3C2tfUN4nWIqlLesfrjkuPFTY= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.7/go.mod h1:x0nZssQ3qZSnIcePWLvcoFisRXJzcTVvYpAAdYX8+GI= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8 h1:Z5EiPIzXKewUQK0QTMkutjiaPVeVYXX7KIqhXu/0fXs= github.com/aws/aws-sdk-go-v2/service/internal/checksum v1.9.8/go.mod h1:FsTpJtvC4U1fyDXk7c71XoDv3HlRm8V3NiYLeYLh5YE= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17 h1:RuNSMoozM8oXlgLG/n6WLaFGoea7/CddrCfIiSA+xdY= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.17/go.mod h1:F2xxQ9TZz5gDWsclCtPQscGpP0VUOc8RqgFM3vDENmU= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20 h1:2HvVAIq+YqgGotK6EkMf+KIEqTISmTYh5zLpYyeTo1Y= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.13.20/go.mod h1:V4X406Y666khGa8ghKmphma/7C0DAtEQYhkq9z4vpbk= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17 h1:bGeHBsGZx0Dvu/eJC0Lh9adJa3M1xREcndxLNZlve2U= github.com/aws/aws-sdk-go-v2/service/internal/s3shared v1.19.17/go.mod h1:dcW24lbU0CzHusTE8LLHhRLI42ejmINN8Lcr22bwh/g= github.com/aws/aws-sdk-go-v2/service/s3 v1.96.0 h1:oeu8VPlOre74lBA/PMhxa5vewaMIMmILM+RraSyB8KA= github.com/aws/aws-sdk-go-v2/service/s3 v1.96.0/go.mod h1:5jggDlZ2CLQhwJBiZJb4vfk4f0GxWdEDruWKEJ1xOdo= -github.com/aws/aws-sdk-go-v2/service/signin v1.0.5 h1:VrhDvQib/i0lxvr3zqlUwLwJP4fpmpyD9wYG1vfSu+Y= -github.com/aws/aws-sdk-go-v2/service/signin v1.0.5/go.mod h1:k029+U8SY30/3/ras4G/Fnv/b88N4mAfliNn08Dem4M= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.10 h1:+VTRawC4iVY58pS/lzpo0lnoa/SYNGF4/B/3/U5ro8Y= -github.com/aws/aws-sdk-go-v2/service/sso v1.30.10/go.mod h1:yifAsgBxgJWn3ggx70A3urX2AN49Y5sJTD1UQFlfqBw= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.14 h1:0jbJeuEHlwKJ9PfXtpSFc4MF+WIWORdhN1n30ITZGFM= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.14/go.mod h1:sTGThjphYE4Ohw8vJiRStAcu3rbjtXRsdNB0TvZ5wwo= -github.com/aws/aws-sdk-go-v2/service/sts v1.41.6 h1:5fFjR/ToSOzB2OQ/XqWpZBmNvmP/pJ1jOWYlFDJTjRQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.41.6/go.mod h1:qgFDZQSD/Kys7nJnVqYlWKnh0SSdMjAi0uSwON4wgYQ= -github.com/aws/smithy-go v1.24.0 h1:LpilSUItNPFr1eY85RYgTIg5eIEPtvFbskaFcmmIUnk= -github.com/aws/smithy-go v1.24.0/go.mod h1:LEj2LM3rBRQJxPZTB4KuzZkaZYnZPnvgIhb4pu07mx0= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.8 h1:0GFOLzEbOyZABS3PhYfBIx2rNBACYcKty+XGkTgw1ow= +github.com/aws/aws-sdk-go-v2/service/signin v1.0.8/go.mod h1:LXypKvk85AROkKhOG6/YEcHFPoX+prKTowKnVdcaIxE= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.13 h1:kiIDLZ005EcKomYYITtfsjn7dtOwHDOFy7IbPXKek2o= +github.com/aws/aws-sdk-go-v2/service/sso v1.30.13/go.mod h1:2h/xGEowcW/g38g06g3KpRWDlT+OTfxxI0o1KqayAB8= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17 h1:jzKAXIlhZhJbnYwHbvUQZEB8KfgAEuG0dc08Bkda7NU= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.35.17/go.mod h1:Al9fFsXjv4KfbzQHGe6V4NZSZQXecFcvaIF4e70FoRA= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.9 h1:Cng+OOwCHmFljXIxpEVXAGMnBia8MSU6Ch5i9PgBkcU= +github.com/aws/aws-sdk-go-v2/service/sts v1.41.9/go.mod h1:LrlIndBDdjA/EeXeyNBle+gyCwTlizzW5ycgWnvIxkk= +github.com/aws/smithy-go v1.24.2 h1:FzA3bu/nt/vDvmnkg+R8Xl46gmzEDam6mZ1hzmwXFng= +github.com/aws/smithy-go v1.24.2/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= github.com/basgys/goxml2json v1.1.0 h1:4ln5i4rseYfXNd86lGEB+Vi652IsIXIvggKM/BhUKVw= github.com/basgys/goxml2json v1.1.0/go.mod h1:wH7a5Np/Q4QoECFIU8zTQlZwZkrilY0itPfecMw41Dw= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -173,8 +173,8 @@ github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/go-test/deep v1.0.7 h1:/VSMRlnY/JSyqxQUzQLKVMAskpY/NZKFA5j2P+0pP2M= github.com/go-test/deep v1.0.7/go.mod h1:QV8Hv/iy04NyLBxAdO9njL0iVPN1S4d/A3NVv1V36o8= -github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= -github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= +github.com/go-viper/mapstructure/v2 v2.5.0 h1:vM5IJoUAy3d7zRSVtIwQgBj7BiWtMPfmPEgAXnvj1Ro= +github.com/go-viper/mapstructure/v2 v2.5.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= github.com/gobwas/glob v0.2.3 h1:A4xDbljILXROh+kObIiy5kIaPYD8e96x1tgBhUI5J+Y= github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/goccy/go-json v0.10.5 h1:Fq85nIqj+gXn/S5ahsiTlK3TmC85qgirsdTP/+DeaC4= @@ -191,8 +191,8 @@ github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= -github.com/google/go-jsonnet v0.21.0 h1:43Bk3K4zMRP/aAZm9Po2uSEjY6ALCkYUVIcz9HLGMvA= -github.com/google/go-jsonnet v0.21.0/go.mod h1:tCGAu8cpUpEZcdGMmdOu37nh8bGgqubhI5v2iSk3KJQ= +github.com/google/go-jsonnet v0.22.0 h1:o0bOAIE+9SIfRZ7FXQPuta0mHLLE0AwbY/L5GTH5CH8= +github.com/google/go-jsonnet v0.22.0/go.mod h1:pLhKpu0/ODjL2Zev4y+CmCoHKAgONT1gSLQyriuYh9w= github.com/google/martian/v3 v3.3.3 h1:DIhPTQrbPkgs2yJYdXU/eNACCG5DVQjySNRNlflZ9Fc= github.com/google/martian/v3 v3.3.3/go.mod h1:iEPrYcgCF7jA9OtScMFQyAlZZ4YXTKEtJ1E6RWzmBA0= github.com/google/s2a-go v0.1.9 h1:LGD7gtMgezd8a/Xak7mEWL0PjoTQFvpRudN895yqKW0= @@ -215,6 +215,8 @@ github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/hcl/v2 v2.23.0 h1:Fphj1/gCylPxHutVSEOf2fBOh1VE4AuLV7+kbJf3qos= github.com/hashicorp/hcl/v2 v2.23.0/go.mod h1:62ZYHrXgPoX8xBnzl8QzbWq4dyDsDtfCRgIq1rbJEvA= +github.com/imega/luaformatter v0.0.0-20211025140405-86b0a68d6bef h1:RC993DdTIHNItsyLj79fgZNLzrf9tBN0GR6W5ZPms6s= +github.com/imega/luaformatter v0.0.0-20211025140405-86b0a68d6bef/go.mod h1:i2XCfvmO94HrEOQWllihhtPrkvNfuB2R2p/o6+OVnRU= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= @@ -223,8 +225,8 @@ github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/klauspost/compress v1.18.4 h1:RPhnKRAQ4Fh8zU2FY/6ZFDwTVTxgJ/EMydqSTzE9a2c= -github.com/klauspost/compress v1.18.4/go.mod h1:R0h/fSBs8DE4ENlcrlib3PsXS61voFxhIs2DeRhCvJ4= +github.com/klauspost/compress v1.18.5 h1:/h1gH5Ce+VWNLSWqPzOVn6XBO+vJbCNGvjoaGBFW2IE= +github.com/klauspost/compress v1.18.5/go.mod h1:cwPg85FWrGar70rWktvGQj8/hthj3wpl0PGDogxkrSQ= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= @@ -270,8 +272,8 @@ github.com/mitchellh/go-wordwrap v1.0.1 h1:TLuKupo69TCn6TQSyGxwI1EblZZEsQ0vMlAFQflz0v0= github.com/mitchellh/go-wordwrap v1.0.1/go.mod h1:R62XHJLzvMFRBbcrT7m7WgmE1eOyTSsCt+hzestvNj0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/moby/buildkit v0.28.0 h1:rKulfRRSduHJPNpLTk481fHElqN9tps0VUx8YV/5zsA= -github.com/moby/buildkit v0.28.0/go.mod h1:RCuOcj/bVsCriBG8NeFzRxjiCFQKnKP7KOVlNTS18t4= +github.com/moby/buildkit v0.29.0 h1:wxLEFbCOJntEDjSNNN2YWd8zxltZxT5muDQ0LzpbtpU= +github.com/moby/buildkit v0.29.0/go.mod h1:Dmv2FeDe34t75QuzeU87rBoZpAAkcpT5zeu4hXzmASc= github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0= github.com/moby/docker-image-spec v1.3.1/go.mod h1:eKmb5VW8vQEh/BAr2yvVNvuiJuY6UIocYsFu/DxxRpo= github.com/muhammadmuzzammil1998/jsonc v1.0.0 h1:8o5gBQn4ZA3NBA9DlTujCj2a4w0tqWrPVjDwhzkgTIs= @@ -284,8 +286,8 @@ github.com/olekukonko/ll v0.0.9/go.mod h1:En+sEW0JNETl26+K8eZ6/W4UQ7CYSrrgg/EdIYT2H8g= github.com/olekukonko/tablewriter v1.1.0 h1:N0LHrshF4T39KvI96fn6GT8HEjXRXYNDrDjKFDB7RIY= github.com/olekukonko/tablewriter v1.1.0/go.mod h1:5c+EBPeSqvXnLLgkm9isDdzR3wjfBkHR9Nhfp3NWrzo= -github.com/open-policy-agent/opa v1.14.1 h1:MhurLB9mSbXmojYFCmGbiC1Uagu1+aFAV4XVotDA86M= -github.com/open-policy-agent/opa v1.14.1/go.mod h1:B5gykwJ2l0g0wZS4ClCcpfSSEx51n4NHpTsWfuPwqnQ= +github.com/open-policy-agent/opa v1.15.1 h1:ZE4JaXsVUzDiHFSlOMBS3nJohR5BRGB/RNz6gTNugzE= +github.com/open-policy-agent/opa v1.15.1/go.mod h1:c6SN+7jSsUcKJLQc5P4yhwx8YYDRbjpAiGkBOTqxaa4= 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.1 h1:y0fUlFfIZhPF1W537XOLg0/fcx6zcHCJwooC2xJA040= @@ -369,10 +371,16 @@ github.com/tchap/go-patricia/v2 v2.3.3/go.mod h1:VZRHKAb53DLaG+nA9EaYYiaEx6YztwDlLElMsnSHD4k= github.com/terminalstatic/go-xsd-validate v0.1.6 h1:TenYeQ3eY631qNi1/cTmLH/s2slHPRKTTHT+XSHkepo= github.com/terminalstatic/go-xsd-validate v0.1.6/go.mod h1:18lsvYFofBflqCrvo1umpABZ99+GneNTw2kEEc8UPJw= +github.com/timtadh/data-structures v0.5.3 h1:F2tEjoG9qWIyUjbvXVgJqEOGJPMIiYn7U5W5mE+i/vQ= +github.com/timtadh/data-structures v0.5.3/go.mod h1:9R4XODhJ8JdWFEI8P/HJKqxuJctfBQw6fDibMQny2oU= +github.com/timtadh/lexmachine v0.2.2 h1:g55RnjdYazm5wnKv59pwFcBJHOyvTPfDEoz21s4PHmY= +github.com/timtadh/lexmachine v0.2.2/go.mod h1:GBJvD5OAfRn/gnp92zb9KTgHLB7akKyxmVivoYCcjQI= github.com/tmccombs/hcl2json v0.6.7 h1:RYKTs4kd/gzRsEiv7J3M2WQ7TYRYZVc+0H0pZdERkxA= github.com/tmccombs/hcl2json v0.6.7/go.mod h1:lJgBOOGDpbhjvdG2dLaWsqB4KBzul2HytfDTS3H465o= github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0 h1:2f304B10LaZdB8kkVEaoXvAMVan2tl9AiK4G0odjQtE= github.com/tonistiigi/go-csvvalue v0.0.0-20240814133006-030d3b2625d0/go.mod h1:278M4p8WsNh3n4a1eqiFcV2FGk7wE5fwUpUom9mK9lE= +github.com/tufanbarisyildirim/gonginx v0.0.0-20260220081509-8e17ce617db3 h1:ClWHRIz18WRVT3RD9y9uTwEWU9eEi+VYFEIumg05FLk= +github.com/tufanbarisyildirim/gonginx v0.0.0-20260220081509-8e17ce617db3/go.mod h1:ALbEe81QPWOZjDKCKNWodG2iqCMtregG8+ebQgjx2+4= github.com/tzrikka/xdg v1.3.2 h1:KhTyYLq58F0vs+Vw9uLMKw44qfEZDW5/ZQyCgTE9P2k= github.com/tzrikka/xdg v1.3.2/go.mod h1:qZP8butzr5W+sv0kS17GKvBnoUgKVty9fBo+W8LsnTY= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= @@ -492,8 +500,8 @@ google.golang.org/genproto/googleapis/api v0.0.0-20260203192932-546029d2fa20/go.mod h1:ZdbssH/1SOVnjnDlXzxDHK2MCidiqXtbYccJNzNYPEE= google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20 h1:Jr5R2J6F6qWyzINc+4AM8t5pfUz6beZpHp678GNrMbE= google.golang.org/genproto/googleapis/rpc v0.0.0-20260203192932-546029d2fa20/go.mod h1:j9x/tPzZkyxcgEFkiKEEGxfvyumM01BEtsW8xzOahRQ= -google.golang.org/grpc v1.79.1 h1:zGhSi45ODB9/p3VAawt9a+O/MULLl9dpizzNNpq7flY= -google.golang.org/grpc v1.79.1/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= +google.golang.org/grpc v1.79.3 h1:sybAEdRIEtvcD68Gx7dmnwjZKlyfuc61Dyo9pGXXkKE= +google.golang.org/grpc v1.79.3/go.mod h1:KmT0Kjez+0dde/v2j9vzwoAScgEPx/Bw1CYChhHLrHQ= google.golang.org/protobuf v1.36.11 h1:fV6ZwhNocDyBLK0dj+fg8ektcVegBBuEolpbTQyBNVE= google.golang.org/protobuf v1.36.11/go.mod h1:HTf+CrKn2C3g5S8VImy6tdcUvCska2kB7j23XfzDpco= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -504,6 +512,8 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= +gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= 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.6.0 h1:X4ELRsiGkrbeox69+9tzTu492FMUu7zJQW6eJU+I2oc= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/parser/nginx/nginx.go new/conftest-0.68.0/parser/nginx/nginx.go --- old/conftest-0.67.1/parser/nginx/nginx.go 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.68.0/parser/nginx/nginx.go 2026-04-02 03:14:42.000000000 +0200 @@ -0,0 +1,75 @@ +package nginx + +import ( + "encoding/json" + "fmt" + + gonginxconfig "github.com/tufanbarisyildirim/gonginx/config" + gonginxparser "github.com/tufanbarisyildirim/gonginx/parser" +) + +// Config represents a parsed nginx configuration. +type Config struct { + Directives []Directive `json:"directives"` +} + +// Directive represents a single nginx directive. +type Directive struct { + Name string `json:"name"` + Parameters []string `json:"parameters,omitempty"` + Block *Block `json:"block,omitempty"` +} + +// Block represents a block of directives. +type Block struct { + Directives []Directive `json:"directives"` +} + +// Parser is an nginx configuration parser. +type Parser struct{} + +// Unmarshal unmarshals nginx configuration files. +func (p *Parser) Unmarshal(b []byte, v any) error { + pr := gonginxparser.NewStringParser(string(b), gonginxparser.WithSkipComments()) + cfg, err := pr.Parse() + if err != nil { + return fmt.Errorf("parse nginx: %w", err) + } + + config := Config{Directives: convertDirectives(cfg.GetDirectives())} + j, err := json.Marshal(config) + if err != nil { + return fmt.Errorf("marshal nginx to json: %w", err) + } + + if err := json.Unmarshal(j, v); err != nil { + return fmt.Errorf("unmarshal nginx json: %w", err) + } + + return nil +} + +func convertDirectives(directives []gonginxconfig.IDirective) []Directive { + converted := make([]Directive, 0, len(directives)) + for _, d := range directives { + converted = append(converted, convertDirective(d)) + } + return converted +} + +func convertDirective(d gonginxconfig.IDirective) Directive { + params := make([]string, 0, len(d.GetParameters())) + for _, p := range d.GetParameters() { + params = append(params, p.String()) + } + + directive := Directive{ + Name: d.GetName(), + Parameters: params, + } + if block := d.GetBlock(); block != nil { + directive.Block = &Block{Directives: convertDirectives(block.GetDirectives())} + } + + return directive +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/parser/nginx/nginx_test.go new/conftest-0.68.0/parser/nginx/nginx_test.go --- old/conftest-0.67.1/parser/nginx/nginx_test.go 1970-01-01 01:00:00.000000000 +0100 +++ new/conftest-0.68.0/parser/nginx/nginx_test.go 2026-04-02 03:14:42.000000000 +0200 @@ -0,0 +1,112 @@ +package nginx + +import ( + "encoding/json" + "testing" + + "github.com/google/go-cmp/cmp" +) + +func TestNginxParser(t *testing.T) { + t.Parallel() + parser := &Parser{} + sample := ` +worker_processes 1; +http { + server { + listen 80; + server_name example.com; + location / { + root /var/www/html; + } + } +} +` + + var got Config + if err := parser.Unmarshal([]byte(sample), &got); err != nil { + t.Fatalf("parser should not have thrown an error: %v", err) + } + + want := Config{ + Directives: []Directive{ + {Name: "worker_processes", Parameters: []string{"1"}}, + { + Name: "http", + Block: &Block{ + Directives: []Directive{ + { + Name: "server", + Block: &Block{ + Directives: []Directive{ + {Name: "listen", Parameters: []string{"80"}}, + {Name: "server_name", Parameters: []string{"example.com"}}, + { + Name: "location", + Parameters: []string{"/"}, + Block: &Block{ + Directives: []Directive{ + {Name: "root", Parameters: []string{"/var/www/html"}}, + }, + }, + }, + }, + }, + }, + }, + }, + }, + }, + } + + if diff := cmp.Diff(want, got); diff != "" { + t.Errorf("mismatch (-want +got):\n%s", diff) + } +} + +func TestConfigMarshalJSON(t *testing.T) { + t.Parallel() + config := Config{ + Directives: []Directive{ + {Name: "worker_processes", Parameters: []string{"1"}}, + { + Name: "http", + Block: &Block{ + Directives: []Directive{ + { + Name: "server", + Block: &Block{ + Directives: []Directive{ + {Name: "listen", Parameters: []string{"80"}}, + {Name: "server_name", Parameters: []string{"example.com"}}, + }, + }, + }, + }, + }, + }, + }, + } + + want := `{"directives":[{"name":"worker_processes","parameters":["1"]},{"name":"http","block":{"directives":[{"name":"server","block":{"directives":[{"name":"listen","parameters":["80"]},{"name":"server_name","parameters":["example.com"]}]}}]}}]}` + + got, err := json.Marshal(config) + if err != nil { + t.Fatalf("unexpected error marshaling Config: %v", err) + } + + if diff := cmp.Diff(want, string(got)); diff != "" { + t.Errorf("mismatch (-want +got):\n%s", diff) + } +} + +func TestNginxParserInvalidConfig(t *testing.T) { + t.Parallel() + parser := &Parser{} + sample := `http {` + + var input any + if err := parser.Unmarshal([]byte(sample), &input); err == nil { + t.Error("expected error for invalid nginx config with unclosed block") + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/parser/parser.go new/conftest-0.68.0/parser/parser.go --- old/conftest-0.67.1/parser/parser.go 2026-03-23 23:59:51.000000000 +0100 +++ new/conftest-0.68.0/parser/parser.go 2026-04-02 03:14:42.000000000 +0200 @@ -10,11 +10,11 @@ "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/cyclonedx" "github.com/open-policy-agent/conftest/parser/docker" dotenv "github.com/open-policy-agent/conftest/parser/dotenv" "github.com/open-policy-agent/conftest/parser/edn" @@ -26,6 +26,7 @@ "github.com/open-policy-agent/conftest/parser/json" "github.com/open-policy-agent/conftest/parser/jsonc" "github.com/open-policy-agent/conftest/parser/jsonnet" + "github.com/open-policy-agent/conftest/parser/nginx" "github.com/open-policy-agent/conftest/parser/properties" "github.com/open-policy-agent/conftest/parser/spdx" "github.com/open-policy-agent/conftest/parser/textproto" @@ -50,6 +51,7 @@ JSON = "json" JSONC = "jsonc" JSONNET = "jsonnet" + NGINX = "nginx" PROPERTIES = "properties" SPDX = "spdx" TEXTPROTO = "textproto" @@ -98,6 +100,8 @@ return &jsonc.Parser{}, nil case JSONNET: return &jsonnet.Parser{}, nil + case NGINX: + return &nginx.Parser{}, nil case EDN: return &edn.Parser{}, nil case VCL: @@ -166,7 +170,7 @@ fileName := strings.ToLower(filepath.Base(path)) - fileExtension := "yml" + fileExtension := "" if len(filepath.Ext(path)) > 0 { fileExtension = strings.ToLower(filepath.Ext(path)[1:]) } @@ -199,6 +203,10 @@ return New(DOTENV) } + if fileName == "nginx.conf" { + return New(NGINX) + } + if slices.Contains(textproto.TextProtoFileExtensions, fileExtension) { return New(TEXTPROTO) } @@ -224,6 +232,7 @@ INI, JSON, JSONNET, + NGINX, PROPERTIES, SPDX, TEXTPROTO, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/conftest-0.67.1/parser/parser_test.go new/conftest-0.68.0/parser/parser_test.go --- old/conftest-0.67.1/parser/parser_test.go 2026-03-23 23:59:51.000000000 +0100 +++ new/conftest-0.68.0/parser/parser_test.go 2026-04-02 03:14:42.000000000 +0200 @@ -92,8 +92,13 @@ }, { "noextension", - &yaml.Parser{}, - false, + nil, + true, + }, + { + "LICENSE", + nil, + true, }, { ".gitignore", ++++++ conftest.obsinfo ++++++ --- /var/tmp/diff_new_pack.EBW5YR/_old 2026-04-02 17:45:28.117967000 +0200 +++ /var/tmp/diff_new_pack.EBW5YR/_new 2026-04-02 17:45:28.125967328 +0200 @@ -1,5 +1,5 @@ name: conftest -version: 0.67.1 -mtime: 1774306791 -commit: 9cef5a296e82fc2b0c18a7b13a262fbd0e1eb115 +version: 0.68.0 +mtime: 1775092482 +commit: 2d5f1c266a5695698982394b4dc1a7d7b5084270 ++++++ vendor.tar.gz ++++++ /work/SRC/openSUSE:Factory/conftest/vendor.tar.gz /work/SRC/openSUSE:Factory/.conftest.new.21863/vendor.tar.gz differ: char 13, line 1
