diff --git a/filepath_windows.go b/filepath_windows.go index aa70955e9..de233e2b7 100644 --- a/filepath_windows.go +++ b/filepath_windows.go @@ -22,6 +22,7 @@ import ( // are special file paths that require the use of syscall.FullPath // to handle correctly. // Just call stdlib's implementation which uses that function. +// file_server's hide relies on it stripping trailing dots and spaces as Win32 opens do. func FastAbs(path string) (string, error) { return filepath.Abs(path) } diff --git a/go.mod b/go.mod index fd6bfe155..cca9cc808 100644 --- a/go.mod +++ b/go.mod @@ -16,15 +16,15 @@ require ( github.com/dunglas/go-urlpattern v1.0.0 github.com/dunglas/httpsfv v1.1.1 github.com/dustin/go-humanize v1.1.0 - github.com/go-chi/chi/v5 v5.4.0 + github.com/go-chi/chi/v5 v5.5.0 github.com/google/uuid v1.6.0 - github.com/klauspost/compress v1.20.1 + github.com/klauspost/compress v1.20.3 github.com/klauspost/cpuid/v2 v2.4.0 github.com/mholt/acmez/v3 v3.1.7 - github.com/prometheus/client_golang v1.24.1 + github.com/prometheus/client_golang v1.25.0 github.com/quic-go/quic-go v0.63.0 github.com/quic-go/webtransport-go v0.13.0 - github.com/smallstep/certificates v0.30.2 + github.com/smallstep/certificates v0.30.3-0.20261105213751-6d5a251fbe01 github.com/smallstep/nosql v0.8.0 github.com/smallstep/truststore v0.13.0 github.com/spf13/cobra v1.10.2 @@ -37,27 +37,27 @@ require ( go.opentelemetry.io/contrib/exporters/autoexport v0.71.0 go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.71.0 go.opentelemetry.io/contrib/propagators/autoprop v0.71.0 - go.opentelemetry.io/otel v1.46.0 - go.opentelemetry.io/otel/sdk v1.46.0 - go.opentelemetry.io/otel/sdk/metric v1.46.0 - go.step.sm/crypto v0.91.0 + go.opentelemetry.io/otel v1.47.0 + go.opentelemetry.io/otel/sdk v1.47.0 + go.opentelemetry.io/otel/sdk/metric v1.47.0 + go.step.sm/crypto v0.92.0 go.uber.org/automaxprocs v1.6.0 go.uber.org/zap v1.28.0 go.uber.org/zap/exp v0.3.0 - golang.org/x/crypto v0.57.0 + golang.org/x/crypto v0.58.0 golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d - golang.org/x/net v0.60.0 - golang.org/x/sync v0.23.0 - golang.org/x/term v0.46.0 + golang.org/x/net v0.62.0 + golang.org/x/sync v0.24.0 + golang.org/x/term v0.47.0 golang.org/x/time v0.16.0 gopkg.in/yaml.v3 v3.0.1 ) require ( cel.dev/expr v0.25.3 // indirect - cloud.google.com/go/auth v0.23.3 // indirect - cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect - cloud.google.com/go/compute/metadata v0.9.1 // indirect + cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a // indirect + cloud.google.com/go/auth/oauth2adapt v0.3.0 // indirect + cloud.google.com/go/compute/metadata v0.10.0 // indirect dario.cat/mergo v1.0.2 // indirect filippo.io/bigmod v0.1.0 // indirect github.com/antlr4-go/antlr/v4 v4.13.1 // indirect @@ -66,15 +66,14 @@ require ( github.com/cenkalti/backoff/v5 v5.0.3 // indirect github.com/coreos/go-oidc/v3 v3.21.0 // indirect github.com/dlclark/regexp2/v2 v2.8.0 // indirect - github.com/fxamacker/cbor/v2 v2.9.4 // indirect - github.com/go-jose/go-jose/v3 v3.0.5 // indirect - github.com/go-jose/go-jose/v4 v4.1.6 // indirect + github.com/fxamacker/cbor/v2 v2.10.0 // indirect + github.com/go-jose/go-jose/v4 v4.1.9 // indirect github.com/google/certificate-transparency-go v1.3.3 // indirect github.com/google/go-tpm v0.9.8 // indirect github.com/google/go-tspi v0.3.0 // indirect - github.com/google/s2a-go v0.1.10 // indirect - github.com/googleapis/enterprise-certificate-proxy v0.3.22 // indirect - github.com/googleapis/gax-go/v2 v2.25.0 // indirect + github.com/google/s2a-go v0.1.11 // indirect + github.com/googleapis/enterprise-certificate-proxy v0.3.24 // indirect + github.com/googleapis/gax-go/v2 v2.27.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 // indirect github.com/jackc/pgx/v5 v5.11.0 // indirect github.com/jackc/puddle/v2 v2.2.2 // indirect @@ -84,7 +83,8 @@ require ( github.com/pbnjay/memory v0.0.0-20210728143218-7b4eea64cf58 // indirect github.com/prometheus/otlptranslator v1.0.0 // indirect github.com/quic-go/qpack v0.6.0 // indirect - github.com/smallstep/cli-utils v0.12.2 // indirect + github.com/smallstep/android-attestation v0.0.0-20260722204520-a51b1564ebda // indirect + github.com/smallstep/cli-utils v0.13.0 // indirect github.com/smallstep/go-attestation v0.4.4-0.20260814222900-a849f4e2cd68 // indirect github.com/smallstep/linkedca v0.26.0 // indirect github.com/smallstep/pkcs7 v0.2.3 // indirect @@ -107,14 +107,14 @@ require ( go.opentelemetry.io/otel/exporters/stdout/stdoutlog v0.22.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0 // indirect go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0 // indirect - go.opentelemetry.io/otel/log v0.22.0 // indirect + go.opentelemetry.io/otel/log v1.47.0 // indirect go.opentelemetry.io/otel/sdk/log v0.22.0 // indirect go.yaml.in/yaml/v3 v3.0.5 // indirect golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba // indirect golang.org/x/oauth2 v0.37.0 // indirect - google.golang.org/api v0.298.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 // indirect + google.golang.org/api v0.310.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b // indirect google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 // indirect ) @@ -154,7 +154,7 @@ require ( github.com/pires/go-proxyproto v0.15.0 github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_model v0.6.3 - github.com/prometheus/common v0.71.0 // indirect + github.com/prometheus/common v0.72.0 // indirect github.com/prometheus/procfs v0.22.0 // indirect github.com/rs/xid v1.6.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect @@ -166,15 +166,15 @@ require ( github.com/urfave/cli v1.22.17 // indirect go.etcd.io/bbolt v1.5.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.46.0 // indirect - go.opentelemetry.io/otel/metric v1.46.0 // indirect - go.opentelemetry.io/otel/trace v1.46.0 + go.opentelemetry.io/otel/metric v1.47.0 // indirect + go.opentelemetry.io/otel/trace v1.47.0 go.opentelemetry.io/proto/otlp v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect - golang.org/x/mod v0.41.0 // indirect - golang.org/x/sys v0.48.0 - golang.org/x/text v0.42.0 // indirect - golang.org/x/tools v0.50.0 - google.golang.org/grpc v1.83.2 // indirect + golang.org/x/mod v0.42.0 // indirect + golang.org/x/sys v0.49.0 + golang.org/x/text v0.43.0 // indirect + golang.org/x/tools v0.51.0 + google.golang.org/grpc v1.85.0 // indirect google.golang.org/protobuf v1.36.12 // indirect howett.net/plist v1.0.1 // indirect ) diff --git a/go.sum b/go.sum index 829fcaa1e..3e34ab678 100644 --- a/go.sum +++ b/go.sum @@ -4,18 +4,18 @@ cel.dev/expr v0.25.3 h1:A2jO8jwOugrrovveCWfj0KEZOfqiLgAcwjpHPhzIGw0= cel.dev/expr v0.25.3/go.mod h1:hrXvqGP6G6gyx8UAHSHJ5RGk//1Oj5nXQ2NI02Nrsg4= cloud.google.com/go v0.123.0 h1:2NAUJwPR47q+E35uaJeYoNhuNEM9kM8SjgRgdeOJUSE= cloud.google.com/go v0.123.0/go.mod h1:xBoMV08QcqUGuPW65Qfm1o9Y4zKZBpGS+7bImXLTAZU= -cloud.google.com/go/auth v0.23.3 h1:UMK+oBtuNGMCR/6i6mmySUItqjOazpJrbmZyhGbGBWo= -cloud.google.com/go/auth v0.23.3/go.mod h1:fClbry28fo7XkxhSeT6AQtAVAp6Jy0fW9N99PoPNPFM= -cloud.google.com/go/auth/oauth2adapt v0.2.8 h1:keo8NaayQZ6wimpNSmW5OPc283g65QNIiLpZnkHRbnc= -cloud.google.com/go/auth/oauth2adapt v0.2.8/go.mod h1:XQ9y31RkqZCcwJWNSx2Xvric3RrU88hAYYbjDWYDL+c= -cloud.google.com/go/compute/metadata v0.9.1 h1:CTE1OWBQ0vnF5uHwdFAQJvMQ0Fi/KRcqqKTo9V0F8Ik= -cloud.google.com/go/compute/metadata v0.9.1/go.mod h1:NtnlvB6X3t4R6xSWyVX/ZWk493PCxGQlhI/iqxh4M8I= -cloud.google.com/go/iam v1.12.0 h1:Aki3bX9aHUDKPHfnRJfDcTdVedvy6quGBQcTqx3DRXk= -cloud.google.com/go/iam v1.12.0/go.mod h1:FEZ4lXpADAC2AIpQY7LANNjjwyQ2jK439CI2VaD+sLY= -cloud.google.com/go/kms v1.33.0 h1:pG0X78m212b2pv9N4fdMoUO69LuZGQ9kSvn8sHBOFAo= -cloud.google.com/go/kms v1.33.0/go.mod h1:CSGvW6GnMQbY+1nOHcIzhMtHSbExXlOmCKjWtYVjcpA= -cloud.google.com/go/longrunning v1.2.0 h1:WjYH3YHBGCxGJP9M4dWGHBfXr/cFIjMkNgWcJj7/iMM= -cloud.google.com/go/longrunning v1.2.0/go.mod h1:5KMQALFGOCtFoi2xSOA1u3H7WKlhmckgiyFw7+LGQp0= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a h1:jW1ZLFy9oa5ai8LOI40z6s+DL1cO/L1KSm9hVGnibn8= +cloud.google.com/go/auth v0.24.1-0.20261001053825-dbc26066f70a/go.mod h1:1dmBXa9xfBvBr39ZnDUDkaaA91ccq9CcqENDgJA4d7c= +cloud.google.com/go/auth/oauth2adapt v0.3.0 h1:FY8oSZpCYoUNv6QxVODuMjQz4IlSOVeiQtZ08vLPz88= +cloud.google.com/go/auth/oauth2adapt v0.3.0/go.mod h1:7+2uCm7++XFO+/lN06c2HXpDXb/NMNn2/UwyBPbTnkk= +cloud.google.com/go/compute/metadata v0.10.0 h1:pyKMUQSwchgkIBBJGdILqQbs/BNJXqwSA7Ej6LAvvtY= +cloud.google.com/go/compute/metadata v0.10.0/go.mod h1:rGFHRrIif570kSibjFTMbt6/4/tzgJWFGI/HVol4GIk= +cloud.google.com/go/iam v1.14.0 h1:YRIB1/4xxwJ+NfI6RQr1WaOoHHeV0MizJEj940nBXJA= +cloud.google.com/go/iam v1.14.0/go.mod h1:JTPZfbHdGXJrOYREtkRoFzCDGaBdbA7ILLKO/DDuav0= +cloud.google.com/go/kms v1.36.0 h1:Yewd4nwxa5IOaYJX0dpfzEM5PMCcg6d2LOdrW7V7bbQ= +cloud.google.com/go/kms v1.36.0/go.mod h1:BZZ2mD9XlonF2JRr7DVIokrTeHKG/CKde5aSPHqeuS4= +cloud.google.com/go/longrunning v1.3.0 h1:lZ6c8SJJBmILp/Wnr3vGnBLa0q+cYfSHRCcUfVI2hpI= +cloud.google.com/go/longrunning v1.3.0/go.mod h1:wpgLxCn+UA3/TZ1bj/fW39mfDpwVlMPu1xKJyoMt7V0= code.pfad.fr/check v1.1.0 h1:GWvjdzhSEgHvEHe2uJujDcpmZoySKuHQNrZMfzfO0bE= code.pfad.fr/check v1.1.0/go.mod h1:NiUH13DtYsb7xp5wll0U4SXx7KhXQVCtRgdC96IPfoM= dario.cat/mergo v1.0.2 h1:85+piFYR1tMbRrLcDwR18y4UKJ3aH1Tbzi24VRW1TK8= @@ -55,36 +55,36 @@ github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmO github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b h1:uUXgbcPDK3KpW29o4iy7GtuappbWT0l5NaMo9H9pJDw= github.com/aryann/difflib v0.0.0-20210328193216-ff5ff6dc229b/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/aws/aws-sdk-go-v2 v1.47.0 h1:0jsHallhJCeaU0Ko48c/3FK1ctOQ7NpzggxriJOQ8MQ= -github.com/aws/aws-sdk-go-v2 v1.47.0/go.mod h1:bttEH6JqnUL8LepvDVfdrds/fZ5bCIxzpe3abyUrhDU= -github.com/aws/aws-sdk-go-v2/config v1.33.4 h1:FzvkXKSzwqHni4U7nDigHg4jjtqMpVUuHgmZfSoJVQ0= -github.com/aws/aws-sdk-go-v2/config v1.33.4/go.mod h1:VZqGZnZsCWVfK/iGPptJIyNIX3XEX6iQU2Rel4sLrr8= -github.com/aws/aws-sdk-go-v2/credentials v1.20.4 h1:hTvrJJseKbvw32kmiE0G+u/9ZqpqscjDrTigHIXP2qs= -github.com/aws/aws-sdk-go-v2/credentials v1.20.4/go.mod h1:gWp9O1ZBWwpcIrgV+mVHk4gZUurAEDkgypu/OXOlIaw= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.0 h1:AM4hHjww+PSFtt6E+UrBrPlZkWsePCLEt9AjkfQX+yM= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.0/go.mod h1:3x/yXezeQjpOvBb4jEMxrS8SXvpdvJ5abv6l5c1gWM8= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.3 h1:Hp/VgjP0BysR3OgLlR057Vz2LcbbVnoWeJ+3qWiS/fY= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.3/go.mod h1:nwGV5qw7F1IZPgxCvA/ph8N2TAuz+BkRG/bXn808qMA= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.3 h1:MUaM4f+kj1ZIBPZfUS8cxP1GKXXZtHJjAthy93AN7SM= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.3/go.mod h1:6YmVmEVRI5ZZzRjCSsb9SryKH0hAlMRdgA7kG9aDvBU= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.3 h1:fuSCw4Z2qfRCztMPO3GXJNSiEp6Wee+WOLwrHHUMy9c= -github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.3/go.mod h1:6SxcHheD1pPR5+kWm1wGvjlL/YqUsh267sAfEmN4K7A= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19 h1:bAdDl/HkGCcGPoe25ToSHEw23VIxt6CT5fLcg111BKg= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.19/go.mod h1:KaUzbLxv4CeSxh6ZCl9B4m7CuFenS8kUEaDs+f/DQr4= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.3 h1:bON1rJf67TSTDCKg816AAIE4xSTtoo9tl0XRkO72R+I= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.3/go.mod h1:c5BBpjJcQXpfeq9iASyVKA3T6vX6B6LEXY4mL/gklDY= -github.com/aws/aws-sdk-go-v2/service/kms v1.60.0 h1:O/xKUsrz7J69Q0yca9XeYxwgi+NbBVbxczcZWudJdU0= -github.com/aws/aws-sdk-go-v2/service/kms v1.60.0/go.mod h1:/eZ9xj8IZyb7fj+/t3HO7x89X+7Vn+gCDDbQ2NHCVtM= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.0 h1:ZD5qFpWcaOKdTuhBi431pIDkCgrMkMlMT6jlpSPoIRI= -github.com/aws/aws-sdk-go-v2/service/signin v1.10.0/go.mod h1:8Nuuf+tR346PjJ3MvZPh9pekbLiLQFWJhzMXfwy7alA= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.0 h1:JGeeBcMlhg1xtOXYpeCaTQBZObtXMPQCUqBcmr65NRA= -github.com/aws/aws-sdk-go-v2/service/sso v1.38.0/go.mod h1:XwteswG9EOMRFm73UT0t+MbTwyLxMrEXkU6e+v92Lzo= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.0 h1:obhahQXDEdVEv8y5bTKXR30LVaxYe1kyYM0L7l2Iq+k= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.0/go.mod h1:6twZZ/aXHNy1vXUO8koUbp++MYzMASkOgEBdkbJYmO0= -github.com/aws/aws-sdk-go-v2/service/sts v1.50.0 h1:khXV3+K5D3f4e8xtplaRdSFn1bEg3gj5EBHQvbCOZbQ= -github.com/aws/aws-sdk-go-v2/service/sts v1.50.0/go.mod h1:/8JRcdTt//hG0Q4BTmGbuOplT7ABe+5rdtqUHqXvYIM= -github.com/aws/smithy-go v1.28.1 h1:R/nXH00c8qcfCzQVELtRw+eLQWtzv+VAIEFJ1/xxXlQ= -github.com/aws/smithy-go v1.28.1/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= +github.com/aws/aws-sdk-go-v2 v1.47.5 h1:5yA+A+BiXbDq1ZLbYwPViwhEGDMdR0MEhL8Jh2LnLS4= +github.com/aws/aws-sdk-go-v2 v1.47.5/go.mod h1:iNIkogrRvFwm+1OQIUOP2lPBtlXZboOIUWiCa+pHEMw= +github.com/aws/aws-sdk-go-v2/config v1.33.10 h1:RRb0GghYqq2ikMXzfT4r9NO9lVhOld3FIhJJWDIdk+w= +github.com/aws/aws-sdk-go-v2/config v1.33.10/go.mod h1:BDSA7QGh6yrNQA5Z5aBnHWKMWdJDMD4IOlB4QjYSp5E= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10 h1:ItSjcLk+2M15RnRxO105uVIqLiVQn8y3gaeHC7W0iqs= +github.com/aws/aws-sdk-go-v2/credentials v1.20.10/go.mod h1:eO4GlmGXB+gx+zDbhu3IENEFOmjrbVKJtOptJiIhngc= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4 h1:7ksj/zMap9+831SmNQZkcpmfuATp3DKr4BfLNnBdYXM= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.20.4/go.mod h1:zhi8vDrD1dj76ysTWS6Ny1y6/EEW1Jrq2y8lzKeoqfs= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.8 h1:gzIWc3DTPfPbWKrQnmL6BV6WD7NPD1htxzgdk/bQ/Z4= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.5.8/go.mod h1:vvUA5cDAZWGo4R14FZPZfXfJCmgsafOWEq78Kg0D+ug= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.8 h1:PWv+vG8aCLS8qd+HPdYhK7Vees90aKHWFFQ1AGYD/8E= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.8.8/go.mod h1:xxPZEpflYHJA12366ZGyq66z9dHPCoeCIu99Jck+MPw= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7 h1:wYu55QUHARwu9YzeuY5yEJUTsIu8ahkmp1l3QmbzHn8= +github.com/aws/aws-sdk-go-v2/internal/v4a v1.5.7/go.mod h1:OteEkhFAgFwQtZft/3myWo3tVWxdAo7cwV+7AbcpAtQ= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22 h1:qHfXn1Tm2Rh8kic/DvdKaiSVlHQRSr5C+rMuBR29D44= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.13.22/go.mod h1:D4ytxJbGXu82l+2XF0q60bibysf+KkIbWfAOldAQwf8= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7 h1:6MSlRo7aiUVBftQ8XmW7XIh3EZqCbkN9zI0YlGW8nl0= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.14.7/go.mod h1:OqapjZfp6VW4YJKKO4l68UdPvS4FIEYuEoq1JNkxCL0= +github.com/aws/aws-sdk-go-v2/service/kms v1.62.2 h1:f0+3opcARrLmWoMciHVzlc1Ww8qFXhvrlscmPShpM+s= +github.com/aws/aws-sdk-go-v2/service/kms v1.62.2/go.mod h1:YVEFrNMhrD35Z6qdvzvpGHDbmFmhZ/Nf58Ubv9dROVU= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5 h1:oFsZ3u5PPFSO1YZDGKFgyDuwgpbv/sTmVShEZfRnyaE= +github.com/aws/aws-sdk-go-v2/service/signin v1.10.5/go.mod h1:P+IzYJeldxO0mHt8fX4cglzexP3akO94C/UuEA2ojP0= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5 h1:EYD6E6CsgRQPazaOfZ6suyTgfZjg07HoT4S3qB9Exkg= +github.com/aws/aws-sdk-go-v2/service/sso v1.38.5/go.mod h1:hHg7OZNN1/U62f3Q5mebJYKO4f97vZC+s0fNAsPLnMk= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5 h1:v6V0AnJ0aDmivAIie/6iT7sGpjnNmzaAdxZwZ0dhwqI= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.43.5/go.mod h1:P2Lqn27Kph9z400MFOYIebFnKjZEwyUIAva6fFFMiRY= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5 h1:OuyNaMncYP4ftrvcnOHJ9j3AxO3zsC5C/ewD0HoHdjQ= +github.com/aws/aws-sdk-go-v2/service/sts v1.51.5/go.mod h1:Bhu66tgvf94uunUSiAc0Ew0avhnpSm0J8Hl1MYocRbo= +github.com/aws/smithy-go v1.28.7 h1:h/n1SHrwVtaDYLz8mR1/Kq4Xh4RaFbFW7bOYckg9mfE= +github.com/aws/smithy-go v1.28.7/go.mod h1:YE2RhdIuDbA5E5bTdciG9KrW3+TiEONeUWCqxX9i1Fc= 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/bits-and-blooms/bitset v1.20.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= @@ -153,14 +153,12 @@ github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHqu github.com/frankban/quicktest v1.14.6 h1:7Xjx+VpznH+oBnejlPUj8oUpdxnVs4f8XU8WnHkI4W8= github.com/frankban/quicktest v1.14.6/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= -github.com/fxamacker/cbor/v2 v2.9.4 h1:xwjVlxEMR3S605oUlgBjKLTTeGFciYPGYCtF/35LKGo= -github.com/fxamacker/cbor/v2 v2.9.4/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= -github.com/go-chi/chi/v5 v5.4.0 h1:+ufzvFTGKyin26Or5DLrlIDq4ygIDBVcj7oVNeeaYFE= -github.com/go-chi/chi/v5 v5.4.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM= -github.com/go-jose/go-jose/v3 v3.0.5 h1:BLLJWbC4nMZOfuPVxoZIxeYsn6Nl2r1fITaJ78UQlVQ= -github.com/go-jose/go-jose/v3 v3.0.5/go.mod h1:5b+7YgP7ZICgJDBdfjZaIt+H/9L9T/YQrVfLAMboGkQ= -github.com/go-jose/go-jose/v4 v4.1.6 h1:sNRkftxFJxwsILiQukqp5z83QBSmntVwmgRY7AqBDO4= -github.com/go-jose/go-jose/v4 v4.1.6/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= +github.com/fxamacker/cbor/v2 v2.10.0 h1:HVF3T5vYwLqO81ebPirWEPNv2SMrUMD3HLnKgEr6uWE= +github.com/fxamacker/cbor/v2 v2.10.0/go.mod h1:uSwlToFuT9BZAKRxxVm3qQC8DR4tlWl7D6pf20iRYH4= +github.com/go-chi/chi/v5 v5.5.0 h1:xdKQ1dJmVJsmgahrXSKhUx8NyVPzpwdlyrrQFpMPJgg= +github.com/go-chi/chi/v5 v5.5.0/go.mod h1:d1IG7GtKPSjPyBP365PH8sAGVHk3qfB/IhjFNRH1wWM= +github.com/go-jose/go-jose/v4 v4.1.9 h1:pKfeQkig1NmgK4hJrZYXLEYURXfoJB61Larw0uIW4gY= +github.com/go-jose/go-jose/v4 v4.1.9/go.mod h1:x4oUasVrzR7071A4TnHLGSPpNOm2a21K9Kf04k1rs08= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-logr/logr v1.4.4 h1:tG4xh9yMsRCAiodLVTxyrkzSZ9+o0L1Kg/+cPVcbP/8= github.com/go-logr/logr v1.4.4/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= @@ -179,24 +177,23 @@ github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl76 github.com/google/certificate-transparency-go v1.0.21/go.mod h1:QeJfpSbVSfYc7RgB3gJFj9cbuQMMchQxrWXz8Ruopmg= github.com/google/certificate-transparency-go v1.3.3 h1:hq/rSxztSkXN2tx/3jQqF6Xc0O565UQPdHrOWvZwybo= github.com/google/certificate-transparency-go v1.3.3/go.mod h1:iR17ZgSaXRzSa5qvjFl8TnVD5h8ky2JMVio+dzoKMgA= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 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-tpm v0.9.8 h1:slArAR9Ft+1ybZu0lBwpSmpwhRXaa85hWtMinMyRAWo= github.com/google/go-tpm v0.9.8/go.mod h1:h9jEsEECg7gtLis0upRBQU+GhYVH6jMjrFxI8u6bVUY= -github.com/google/go-tpm-tools v0.4.9 h1:jZEhnE4WRFbomSssBH2gWaIViIHU1gjH1jz76+xC9bI= -github.com/google/go-tpm-tools v0.4.9/go.mod h1:Omb8zosA8qY9URn1gsrO2i4b6DFqGp29BqNx18V66c4= +github.com/google/go-tpm-tools v0.4.11 h1:+Qgcs+l0XcWXFMU3e2HJJKnlEQZXVrtqr3WaJPVlZaE= +github.com/google/go-tpm-tools v0.4.11/go.mod h1:rSCvZFOXuv7Ie25XfFHWf2JGG6NVZYNSfNyxo8AEjlY= github.com/google/go-tspi v0.3.0 h1:ADtq8RKfP+jrTyIWIZDIYcKOMecRqNJFOew2IT0Inus= github.com/google/go-tspi v0.3.0/go.mod h1:xfMGI3G0PhxCdNVcYr1C4C+EizojDg/TXuX5by8CiHI= -github.com/google/s2a-go v0.1.10 h1:EMp+aOuXN6l8cE/gjF5Bt+vyZxsUuyCWe9chDWR/+uU= -github.com/google/s2a-go v0.1.10/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= +github.com/google/s2a-go v0.1.11 h1:7v1V1TraNGP63WptsAkNqr2w8jgm4vM6A6qx6Lsw9iM= +github.com/google/s2a-go v0.1.11/go.mod h1:pz4tyvwXvJLLbyrkh6FW1eS2zPUXMaTmyNhYtyP2tNw= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/googleapis/enterprise-certificate-proxy v0.3.22 h1:NU4XpII6jD+Dxcot94fqjE+AfJoE/lQP9q3faYGzC/c= -github.com/googleapis/enterprise-certificate-proxy v0.3.22/go.mod h1:L3D/IQExI6LqEjBdXcZQ1WluSgigQmSwBboFstVPM4w= -github.com/googleapis/gax-go/v2 v2.25.0 h1:77gyzCOrTyzPKfzGZJG/V5DO4/Kuamek8W+cYJQ4U8k= -github.com/googleapis/gax-go/v2 v2.25.0/go.mod h1:sMKqnMesnKH+3wiRJROcttA+cJoZoGbZl1vDQ8XYtGk= +github.com/googleapis/enterprise-certificate-proxy v0.3.24 h1:G9iCJIY+AYVmUskKdjX8FVy7sG+nbzjOQ41cvlmhcvg= +github.com/googleapis/enterprise-certificate-proxy v0.3.24/go.mod h1:hEjCmnoakQzv5ImLUp6alkY7XgLlNoAxwTXmhHHNIsI= +github.com/googleapis/gax-go/v2 v2.27.0 h1:qe2iQOUzxb3fd6x6ewpIEixPQhJ+0Ihc/RRZhKA/2g0= +github.com/googleapis/gax-go/v2 v2.27.0/go.mod h1:RofiqDw3ehcG4L0H1zO3D2Itpwd3/uS/7wdmbNDF1DE= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0 h1:/Tnpcb2E0Pz/tN9s3bfEY2Q8ePCEX9iuS+cneUwncnw= github.com/grpc-ecosystem/grpc-gateway/v2 v2.30.0/go.mod h1:zOBXOsUaBSjKgmH4OGzV1esUpR3oUSCPYVd2cUBjKYY= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= @@ -217,8 +214,8 @@ github.com/jackc/puddle/v2 v2.2.2 h1:PR8nw+E/1w0GLuRFSmiioY6UooMp6KJv0/61nB7icHo github.com/jackc/puddle/v2 v2.2.2/go.mod h1:vriiEXHvEE654aYKXXjOvZM39qJ0q+azkZFrfEOc3H4= github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= -github.com/klauspost/compress v1.20.1 h1:T7kKElXUMXrUJ2E9QhQhxFtcK5rPyLdsGZvdbLMPdiQ= -github.com/klauspost/compress v1.20.1/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= +github.com/klauspost/compress v1.20.3 h1:zWNoFqq/lSuYQRim3dUXlXeA0IqwuZGicdG5ZTfY5j4= +github.com/klauspost/compress v1.20.3/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/klauspost/cpuid/v2 v2.4.0 h1:S6Hrbc7+ywsr0r+RLapfGBHfyefhCTwEh3A0tV913Dw= github.com/klauspost/cpuid/v2 v2.4.0/go.mod h1:19jmZ9mjzoF//ddRSUsv0zfBTJWh3QJh9FNxZTMrGxU= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= @@ -275,12 +272,12 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/prashantv/gostub v1.1.0 h1:BTyx3RfQjRHnUWaGF9oQos79AlQ5k8WNktv7VGvVH4g= github.com/prashantv/gostub v1.1.0/go.mod h1:A5zLQHz7ieHGG7is6LLXLz7I8+3LZzsrV0P1IAHhP5U= -github.com/prometheus/client_golang v1.24.1 h1:JnJkREXzWxUdCuPFpIWZiPispT9xVV59uiuyR2bPlnU= -github.com/prometheus/client_golang v1.24.1/go.mod h1:F+oSRECHg4sse5ucfYpYDeIv/hu68Zo0uoHKetWnzcE= +github.com/prometheus/client_golang v1.25.0 h1:cDtW1TcFsMi1RJc8khwCKB4VhzwV04aKqbYtNOXuiK0= +github.com/prometheus/client_golang v1.25.0/go.mod h1:j2X/4/kaQHLPnmyEU8zjmkndo1T317VpCIQEml8LTKk= github.com/prometheus/client_model v0.6.3 h1:O0jaTVAYNxTHYInEPFJt5I3+sN8zqBtVMPTB1qyxiEo= github.com/prometheus/client_model v0.6.3/go.mod h1:gpN5P9S7Rr6Yr92PiQ+Ixvhf6JZEkF1dnxsYL2aPBEM= -github.com/prometheus/common v0.71.0 h1:9KDAKb7Mj3HEVKyFCK6Dc/HIwlBzZIN2l7/lrHl3KK8= -github.com/prometheus/common v0.71.0/go.mod h1:CLJ5H8TEsGX8bl31BdMkfhIZ+QmZ9tBPPotUxUbfcmk= +github.com/prometheus/common v0.72.0 h1:tAYsE+sPJxIncDAobm4H5aQjmox9ZxEIIqPbiffa8G4= +github.com/prometheus/common v0.72.0/go.mod h1:77NWqAQ2tXT7BIK40qjJdw5Acrsrg1TlHAnsQi3i6mk= github.com/prometheus/otlptranslator v1.0.0 h1:s0LJW/iN9dkIH+EnhiD3BlkkP5QVIUVEoIwkU+A6qos= github.com/prometheus/otlptranslator v1.0.0/go.mod h1:vRYWnXvI6aWGpsdY/mOT/cbeVRBlPWtBNDb7kGR3uKM= github.com/prometheus/procfs v0.22.0 h1:6q9+/JL9IKAPbCmBrv9n5O5Ty3NKnciV5X7YGw0oics= @@ -310,12 +307,14 @@ github.com/sirupsen/logrus v1.10.2 h1:G2SED73/qrAu6YwbdxOD6peLkCBI3z7L+ykJFTXJBB github.com/sirupsen/logrus v1.10.2/go.mod h1:SLEg8TqYulVKKfIGHldVp2K2aYz2DKSVBq4g/H5bR7Q= github.com/slackhq/nebula v1.11.2 h1:eP61cSfUuoEVGViD50gZBsAbBLPUAhoNOYewPmEwPG4= github.com/slackhq/nebula v1.11.2/go.mod h1:xz3SEyYeEhXY8MDlVu8S3Qt+SjncsSJ8bl4RXUgxtXQ= +github.com/smallstep/android-attestation v0.0.0-20260722204520-a51b1564ebda h1:IfbkxDvPbdr00RD5kgdzdCkPp4ANOLgXyVI8NkWjQ+I= +github.com/smallstep/android-attestation v0.0.0-20260722204520-a51b1564ebda/go.mod h1:WEOYAQ4qnt6LhEcreLGA0woxzE8k5e0vjGuIq72J5tw= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262 h1:unQFBIznI+VYD1/1fApl1A+9VcBk+9dcqGfnePY87LY= github.com/smallstep/assert v0.0.0-20200723003110-82e2b9b3b262/go.mod h1:MyOHs9Po2fbM1LHej6sBUT8ozbxmMOFG+E+rx/GSGuc= -github.com/smallstep/certificates v0.30.2 h1:1G3xBi8sJ740iA1mMPW2Svv7EIZKJ4Zf/iQtA5QlN0Y= -github.com/smallstep/certificates v0.30.2/go.mod h1:oyaE/aEYUGDr+YiCZLAxxP22bOQqcSHTeDgp8Vv2rlY= -github.com/smallstep/cli-utils v0.12.2 h1:lGzM9PJrH/qawbzMC/s2SvgLdJPKDWKwKzx9doCVO+k= -github.com/smallstep/cli-utils v0.12.2/go.mod h1:uCPqefO29goHLGqFnwk0i8W7XJu18X3WHQFRtOm/00Y= +github.com/smallstep/certificates v0.30.3-0.20261105213751-6d5a251fbe01 h1:37RUToHubGV3jBtmuW1I6mwINrVYjljzRbGvg4S2P5s= +github.com/smallstep/certificates v0.30.3-0.20261105213751-6d5a251fbe01/go.mod h1:5H7gEyq41/ZNlGh/0oyrOwmnZtxDKbN5QuqDOcFtkzU= +github.com/smallstep/cli-utils v0.13.0 h1:yoGBkW9DJJ6cEZS+UhoBPiYDUIXDz3SjAyBKrK7d/EY= +github.com/smallstep/cli-utils v0.13.0/go.mod h1:1k5tKEGCKpJZHipYTUzN1LhlMW3GoWwlrG7976WDMOY= github.com/smallstep/go-attestation v0.4.4-0.20260814222900-a849f4e2cd68 h1:KcK2guFXrE5sX/nvF1b+atHP6DjRB1gCv3ppyTXB2Zk= github.com/smallstep/go-attestation v0.4.4-0.20260814222900-a849f4e2cd68/go.mod h1:vNAduivU014fubg6ewygkAvQC0IQVXqdc8vaGl/0er4= github.com/smallstep/linkedca v0.26.0 h1:NsxTVo3zI3KwOFFiVodeHtuGgKq0b5kOUXVLjjNTvXY= @@ -403,8 +402,8 @@ go.opentelemetry.io/contrib/propagators/jaeger v1.46.0 h1:uxl0SGcmuBkHj/Adl9oftE go.opentelemetry.io/contrib/propagators/jaeger v1.46.0/go.mod h1:LiOkxCIvoLofmRps7f8l0NkBtmObnAyQ5trteFs6wj8= go.opentelemetry.io/contrib/propagators/ot v1.46.0 h1:SxC/1xmJJJdGQTNmavqW8ju85TRXiZHeFaQdnEMCWLE= go.opentelemetry.io/contrib/propagators/ot v1.46.0/go.mod h1:ZrntlVZOzRMetoU2y7eIHUbJ7riKEOqIyLXkuu91sxU= -go.opentelemetry.io/otel v1.46.0 h1:FHt5/CDyVxi/8IM1CH7VE/rRgq3kLHa2mSTVMO8AWyc= -go.opentelemetry.io/otel v1.46.0/go.mod h1:Gj3SEScelsNC45tp4nSxRYlS+f5iez7W8XPMCt905kE= +go.opentelemetry.io/otel v1.47.0 h1:j7ALJ/zgkS7Z6aeJW09p8VC9804bC+PpeTfCD4XPnOM= +go.opentelemetry.io/otel v1.47.0/go.mod h1:8wS9O2qfXrYrzp6hIF/HOYJJf/wIhFPhR2xLuP+iXQU= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.22.0 h1:Bu39F5tzJct+f2IZbB8989fwyTps3c8e7EsUQsz+vs8= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploggrpc v0.22.0/go.mod h1:dJUwod88EsFgYCqrDHaSPzhiY9pBUpt0d85/qSfua7k= go.opentelemetry.io/otel/exporters/otlp/otlplog/otlploghttp v0.22.0 h1:lYk7RmxdLK865qLwibroNGldHa1U7SWKYYvNjlK7PIo= @@ -427,26 +426,26 @@ go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0 h1:PR9eAf7o0dQs3h go.opentelemetry.io/otel/exporters/stdout/stdoutmetric v1.46.0/go.mod h1:2Z4KyNdH1uuzivdinyfGsxzNNT/Rl45pwtVwfYVI0xk= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0 h1:KdRxPiAoMptR3vfWzvjjvutTsSiwbC2uG0496rzZNfo= go.opentelemetry.io/otel/exporters/stdout/stdouttrace v1.46.0/go.mod h1:K/qSA+3G7Eovxi4K09wzrAgkWRnosS0DAOZeEpve7sM= -go.opentelemetry.io/otel/log v0.22.0 h1:5DBNnfvaJ6CVdkJ+Jle8Tzs50aSSv49TXGj9XRsEYw0= -go.opentelemetry.io/otel/log v0.22.0/go.mod h1:gzOt/R67vF2GniAqWu8Qv0SXy89f71muHcrkz76PCdc= -go.opentelemetry.io/otel/metric v1.46.0 h1:yBnkXvgV7AXFILZc5K6IZe/CBFF3OS7BJ8ov6/lj0K8= -go.opentelemetry.io/otel/metric v1.46.0/go.mod h1:iPmdWqifKUdzziPkvvzIJXITl56fQx2mGM/DHLB3/2o= -go.opentelemetry.io/otel/metric/x v0.68.0 h1:TA/cBT23D3MnxYPwHL7YFOdYGdx0A0v+s7Mzotpd1dU= -go.opentelemetry.io/otel/metric/x v0.68.0/go.mod h1:agudOmvWhwUTjgibWDzxD2PoWYnpw5Ht5jISYOD2Hd4= -go.opentelemetry.io/otel/sdk v1.46.0 h1:h5CNQQjEbuQXY/JfZtgt3i7HVFV3aHPO2OAwO2eTYPI= -go.opentelemetry.io/otel/sdk v1.46.0/go.mod h1:GAERFXFt5SYCEB+YiKUbMBeza6UaDH7GmGOZEfh2gSM= +go.opentelemetry.io/otel/log v1.47.0 h1:cOTS1CcLbSQeZKanGJ+0JpF/+t4PELi3O3bbl2lqCcI= +go.opentelemetry.io/otel/log v1.47.0/go.mod h1:9byitSQ5pLC6PpqwGXjqdMKya6ZTswHRZh2vvXT33nw= +go.opentelemetry.io/otel/metric v1.47.0 h1:4PptaldXx3Eat1XjMZ68pPJEs5wrhlemctZE9a3UdWY= +go.opentelemetry.io/otel/metric v1.47.0/go.mod h1:ADGSXxRrXM6bjbvLo535EstVFlPpPYZm4LBKixjDHwU= +go.opentelemetry.io/otel/metric/x v0.69.0 h1:DjRLr15H83v+hCW7JA9NoJvOkYTtmq5YoDRbe9deYpM= +go.opentelemetry.io/otel/metric/x v0.69.0/go.mod h1:uVvsMPMFFyj/HUQfrUnH3JjnOQ1dwFDorgFLRBasM0k= +go.opentelemetry.io/otel/sdk v1.47.0 h1:zWXEr4j2lFefG87TU6Yg8a7ngfohIKFZHKp0Hf5hC6I= +go.opentelemetry.io/otel/sdk v1.47.0/go.mod h1:VUc24kiOeoGsxG8G9ULx3fWKvB7jMhnGE8Oi607lgR0= go.opentelemetry.io/otel/sdk/log v0.22.0 h1:PRL+s6P63XT4E/bheEflopPUpVxuvANqZwtt89yhoGk= go.opentelemetry.io/otel/sdk/log v0.22.0/go.mod h1:JNp0sBELrjCTcu5W3GzABVypeU6vDJjBS+X0JISuz+g= go.opentelemetry.io/otel/sdk/log/logtest v0.22.0 h1:infPnfNrhCNgOUZRs3gWUg8vhoBUHihq02gwK05gzlg= go.opentelemetry.io/otel/sdk/log/logtest v0.22.0/go.mod h1:gkQZA3z15Bv3KU9vigBTi8dFechSozRP7v94X4VZv+s= -go.opentelemetry.io/otel/sdk/metric v1.46.0 h1:0piZ26EG4RBfebb2jhDH6ERCYHoVWduc3kLgPCwSnSE= -go.opentelemetry.io/otel/sdk/metric v1.46.0/go.mod h1:I1PbKrdVc8Qu8HYVDNtqVIwLwjNrhsV/uFuxfwg8mO4= -go.opentelemetry.io/otel/trace v1.46.0 h1:OULy7ccdJnZtJ0UDYFOIGaCmiWzJ8Vi2G/Rsu60qs1c= -go.opentelemetry.io/otel/trace v1.46.0/go.mod h1:J7GAXweO77XSFkB/rmAqk9D6ihszhFjLU+d9WuUxDLI= +go.opentelemetry.io/otel/sdk/metric v1.47.0 h1:lfISg2j93VT6yqdk9OfUaZmw/GfcZqCCV3jdXtsPnKw= +go.opentelemetry.io/otel/sdk/metric v1.47.0/go.mod h1:ypLp+mW1Nt2x+Szt3b5/i1syodyts49lMOwxpDI3VGw= +go.opentelemetry.io/otel/trace v1.47.0 h1:JOjX/Oci8K94QHddo+bbfya/Ai/nf6/dt9ZfrFNWSrM= +go.opentelemetry.io/otel/trace v1.47.0/go.mod h1:jNaSLa2PZEYFG6fRjJABAu+bw4FS08uDmPg28lTghu0= go.opentelemetry.io/proto/otlp v1.11.0 h1:5rrYs0Ykyj50sdU/JU0x8etU+LubXWb+gED6TbEdMIk= go.opentelemetry.io/proto/otlp v1.11.0/go.mod h1:SmVizdCOAm3XBtG1g1NnOdhW6jtddT72hLMhv8VwA8E= -go.step.sm/crypto v0.91.0 h1:0mN0DwVOvUuh7VbyTnxABZuAkxwak/Grp8Y/b4YaZDU= -go.step.sm/crypto v0.91.0/go.mod h1:NxxObRBymdbyXLoTCW5Ea6sLxuy5yI/xr9+hSBlbU/Q= +go.step.sm/crypto v0.92.0 h1:ifhnf9D2X12SokY000OL9GX038hJJ1xfoFzyX7FzgAs= +go.step.sm/crypto v0.92.0/go.mod h1:3ypkxvcrqPtpvPhRpNgHwoNQcJfFqWd401rxKbrlO5s= go.uber.org/automaxprocs v1.6.0 h1:O3y2/QNTOdbF+e/dpXNNW7Rx2hZ4sTIPyybbxyNqTUs= go.uber.org/automaxprocs v1.6.0/go.mod h1:ifeIMSnPZuznNm6jmdzmU3/bfk01Fe2fotchwEFJ8r8= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= @@ -472,8 +471,8 @@ golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDf golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/crypto v0.32.0/go.mod h1:ZnnJkOaASj8g0AjIduWNlq2NRxL0PlBrbKVyZ6V/Ugc= golang.org/x/crypto v0.33.0/go.mod h1:bVdXmD7IV/4GdElGPozy6U7lWdRXA4qyRVGJV57uQ5M= -golang.org/x/crypto v0.57.0 h1:3ZVCjf8Ggz7zneR/EHRVx68Ctf+2pmIMP2UFhh9cC6M= -golang.org/x/crypto v0.57.0/go.mod h1:Fdz0i5U6CoizGwLda9DttjSk6qlZo25zYNtR+ycvuZA= +golang.org/x/crypto v0.58.0 h1:COkYLr4k7nDI4r6QtMML2AfzeIswWHAJthLS6K/M/54= +golang.org/x/crypto v0.58.0/go.mod h1:Xh+kl5A+M0gMiWDytH2Hhr5Z7WbNCpv/eB/EFgfSk+w= golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d h1:5NBkmd8MXirajj6AAEpi4HFVJnVkBNPTL1ggYAKqaws= golang.org/x/crypto/x509roots/fallback v0.0.0-20261030153154-30a33513ff6d/go.mod h1:HPze8vhfG6fO06AM+VSvxRm4E3+5Yk375mgrJ5M2z1E= golang.org/x/exp v0.0.0-20260908205506-85c1c2202aba h1:Ck8QetSgk912qxWLMCKxd0in+aiyBQyDSMae6e/xmpU= @@ -483,8 +482,8 @@ golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/mod v0.15.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= -golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= +golang.org/x/mod v0.42.0 h1:ICeL3t2L30ljSPHHxDnR4fqVcBt/zR2zJAb9juavmQg= +golang.org/x/mod v0.42.0/go.mod h1:u5fzIrRInkL8MaO1cbRkUHT64v303YIT5KEqpNr7jRs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= @@ -494,8 +493,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/net v0.34.0/go.mod h1:di0qlW3YNM5oh6GqDGQr92MyTozJPmybPK4Ev/Gm31k= -golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= -golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= +golang.org/x/net v0.62.0 h1:18ELalfM5+XNRwzM2nYqXsZQ9ByS1uhj2O/U7+5jqRY= +golang.org/x/net v0.62.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI= golang.org/x/oauth2 v0.37.0 h1:JUlcxA8oAtauLfiH8FX2/FkAWHAdi0QtGCGc+hofE98= golang.org/x/oauth2 v0.37.0/go.mod h1:IxwZNxUULJmpBFf9K/9NTMSIfZZuvuTy1gGxhigP/58= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -506,8 +505,8 @@ golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sync v0.11.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= -golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= -golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= +golang.org/x/sync v0.24.0 h1:iqiDrGoDgyuvAKrhLQthUEzU/R378N78gXbBjxed7oA= +golang.org/x/sync v0.24.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/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= @@ -524,8 +523,8 @@ golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.29.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/sys v0.30.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= -golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= +golang.org/x/sys v0.49.0 h1:XbzkgYJHdqh/8m2Uu0W/dQv8nktxx4BFHp1M0gROTXA= +golang.org/x/sys v0.49.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE= 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= @@ -536,8 +535,8 @@ golang.org/x/term v0.17.0/go.mod h1:lLRBjIVuehSbZlaOtGMbcMncT+aqLLLmKrsjNrUguwk= golang.org/x/term v0.20.0/go.mod h1:8UkIAJTvZgivsXaD6/pH6U9ecQzZ45awqEOzuCvwpFY= golang.org/x/term v0.28.0/go.mod h1:Sw/lC2IAUZ92udQNf3WodGtn4k/XoLyZoh8v/8uiwek= golang.org/x/term v0.29.0/go.mod h1:6bl4lRlvVuDgSf3179VpIxBF0o10JUpXWOnI7nErv7s= -golang.org/x/term v0.46.0 h1:3+OXuTbaKDgwk8jTi3aSLHRlmWqHEUDUtxnbFigO4YE= -golang.org/x/term v0.46.0/go.mod h1:+K02xbkittuwc0Am4abfA3Fc+XRGXkvBXNO88NCXPoc= +golang.org/x/term v0.47.0 h1:cpyOwQkr2Nzxe2p6KnrTG7Ei2wtzjsuSjhpXXepZ/BM= +golang.org/x/term v0.47.0/go.mod h1:efAfAuG6RKABvg1ArGebRkvX6LXul14SM67o2e4mUCY= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= @@ -548,8 +547,8 @@ golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= golang.org/x/text v0.22.0/go.mod h1:YRoo4H8PVmsu+E3Ou7cqLVH8oXWIHVoX0jqUWALQhfY= -golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= -golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= +golang.org/x/text v0.43.0 h1:1QivrlhwAsnMOcqgOdl9my7s9OyZl8O5/UGUTJVXoWc= +golang.org/x/text v0.43.0/go.mod h1:hbSIYA/amXcRXTFSZqh8tWHEoqRvvbKPJ2uz/KU+a+s= golang.org/x/time v0.16.0 h1:vMb6ptszcQMkcwiRTAuNNU50gom6++Q/6gY2hDM6VDE= golang.org/x/time v0.16.0/go.mod h1:rVKOqvZeKvrDKTQiAHJ7wmwP0RzleSphoEA9RcdLA0s= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -558,21 +557,21 @@ golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= -golang.org/x/tools v0.50.0 h1:c2ifzfcuY7L90lZ2aKd8S4K2NpASF08SZx9ZuJkHmSU= -golang.org/x/tools v0.50.0/go.mod h1:7ulVMw3831Mwi5EZD6RomGyffr4VFjuNYXf2BbCEAV0= +golang.org/x/tools v0.51.0 h1:k4Xc/1Om9jwkBJBo4NVLMSARBoWtK10mx+W5BnXCeAI= +golang.org/x/tools v0.51.0/go.mod h1:9eEncMayCV6zRMGhR5eZEC2iBx98qWcF1HZ9Z7wJOoA= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= gonum.org/v1/gonum v0.17.0 h1:VbpOemQlsSMrYmn7T2OUvQ4dqxQXU+ouZFQsZOx50z4= gonum.org/v1/gonum v0.17.0/go.mod h1:El3tOrEuMpv2UdMrbNlKEh9vd86bmQ6vqIcDwxEOc1E= -google.golang.org/api v0.298.0 h1:YW18RkHBMZBA1ergX0m4biagzgbiPTb2uTsRsDPWNRY= -google.golang.org/api v0.298.0/go.mod h1:02qB8+Ox1ZFzcaKFMguy1nQLJmSIyvV6Ff4txJEXtl4= -google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d h1:C9v1o0/4quuhOAfmRXA2j+we0PqZIp8traLdeogF3Ms= -google.golang.org/genproto v0.0.0-20260715232425-e75dac1f907d/go.mod h1:Wz2wFJntZFmLGo7pLDXZ3wYk5hyc0Mb+SkHhDDXT+lU= -google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459 h1:GS9OIt/j7c8bvBjYNgnKQysVfmV7e4jM0H8ZK95G4t8= -google.golang.org/genproto/googleapis/api v0.0.0-20260921155816-b14227669459/go.mod h1:PX5/4vemwVoXtwEcRDWwcR1/r0qrosfx3qoVADMwnVE= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459 h1:b0xCahf3FK2m2Cv0p4vTozGPWncCvLfwV86UNg8xWU8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20260921155816-b14227669459/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= -google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= -google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= +google.golang.org/api v0.310.0 h1:537ccDDmbwuwX1iof3Vtdz9vow6uJCgrSZJWedAWM0I= +google.golang.org/api v0.310.0/go.mod h1:5NUthU+LmGMKzYgRaScb+TTe1Lo7x4A+J7g+Yj8BRzA= +google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941 h1:CXq2XEi5aEyLjjPZIwqrmQH8ZY4ctUwK7uyAx3mjX/U= +google.golang.org/genproto v0.0.0-20261012220534-4341edf3f941/go.mod h1:3gK0ehnhP0V7/x3ypGoLyT3d0n6TSi/EcsphIjHrcz4= +google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941 h1:DS/w3N8rsfrwxwgGSj6WhMsPo7aNQGmDx74J81zd0NQ= +google.golang.org/genproto/googleapis/api v0.0.0-20261012220534-4341edf3f941/go.mod h1:AuGAdi9KnXss7xbLxIKhCvk+Ro/SxpET/iS45DNYN+M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b h1:6WNWHZk91dp4gZ25642OALkuG1UVNZbwENJD19DnB8k= +google.golang.org/genproto/googleapis/rpc v0.0.0-20261019180522-ce908d29299b/go.mod h1:OaIUM3+LpYcK2GXM4FTmhWoIq371Owdr+Cc7/BsYHHc= +google.golang.org/grpc v1.85.0 h1:BPBCfuVRQ1qvBhKDOq9uvQllMvO59rKsYhXpp7Dd8vw= +google.golang.org/grpc v1.85.0/go.mod h1:0rQrOD58yjal/0EaVbGBANindixsCZNQPDV3VKtaKuQ= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2 h1:rgSNvqscFZ1JgV/4wH5GOsZFSFkR2Eua9As3KIr2LlM= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.6.2/go.mod h1:iMEtFwDlAhjDU9L5mY6U1XLwlIId/G3h+QcBHDIvrJ8= google.golang.org/protobuf v1.36.12 h1:pJOKDDOyeXErUroCihFAd5LQuwXBSpVnKGrj5o/fwxc= diff --git a/modules/caddyhttp/fileserver/staticfiles_test.go b/modules/caddyhttp/fileserver/staticfiles_test.go index a8b8d74df..8c45adfa1 100644 --- a/modules/caddyhttp/fileserver/staticfiles_test.go +++ b/modules/caddyhttp/fileserver/staticfiles_test.go @@ -142,6 +142,67 @@ func TestFileHidden(t *testing.T) { } } +// Win32 path normalization strips trailing dots and spaces, so Windows opens +// hidden files under these aliases; fileHidden relies on FastAbs normalizing alike. +func TestHideWindowsTrailingDotSpace(t *testing.T) { + if runtime.GOOS != "windows" { + t.Skip("Win32 path normalization only") + } + + root := t.TempDir() + for _, dir := range []string{"publicdir", "secretdir"} { + if err := os.Mkdir(filepath.Join(root, dir), 0o700); err != nil { + t.Fatal(err) + } + } + for _, name := range []string{"Caddyfile", "public.txt", filepath.Join("publicdir", "p.txt"), filepath.Join("secretdir", "p.txt")} { + if err := os.WriteFile(filepath.Join(root, name), []byte(name), 0o600); err != nil { + t.Fatal(err) + } + } + + canonicalURIs := false + fsrv := FileServer{ + Root: root, + Hide: []string{"Caddyfile", filepath.Join(root, "secretdir")}, + CanonicalURIs: &canonicalURIs, + } + ctx, cancel := caddy.NewContext(caddy.Context{Context: context.Background()}) + defer cancel() + if err := fsrv.Provision(ctx); err != nil { + t.Fatal(err) + } + + for i, tc := range []struct { + path string + wantStatus int + }{ + {path: "/public.txt.", wantStatus: http.StatusOK}, + {path: "/public.txt%20", wantStatus: http.StatusOK}, + {path: "/publicdir./p.txt", wantStatus: http.StatusOK}, + {path: "/Caddyfile.", wantStatus: http.StatusNotFound}, + {path: "/Caddyfile%20", wantStatus: http.StatusNotFound}, + {path: "/Caddyfile.%20..", wantStatus: http.StatusNotFound}, + {path: "/secretdir./p.txt", wantStatus: http.StatusNotFound}, + } { + r := httptest.NewRequest(http.MethodGet, tc.path, nil) + r = r.WithContext(context.WithValue(r.Context(), caddy.ReplacerCtxKey, caddy.NewReplacer())) + w := httptest.NewRecorder() + + status := http.StatusOK + if err := fsrv.ServeHTTP(w, r, nil); err != nil { + he, ok := errors.AsType[caddyhttp.HandlerError](err) + if !ok { + t.Fatalf("Test %d (%s): unexpected error: %v", i, tc.path, err) + } + status = he.StatusCode + } + if status != tc.wantStatus { + t.Errorf("Test %d (%s): expected status %d, got %d (body %q)", i, tc.path, tc.wantStatus, status, w.Body.String()) + } + } +} + // Check to make sure that we don't serve ETag and Last-Modified headers // for files with invalid modification times func TestModTimeHeaders(t *testing.T) { diff --git a/modules/caddyhttp/reverseproxy/reverseproxy.go b/modules/caddyhttp/reverseproxy/reverseproxy.go index 0f73ecfea..c9b314924 100644 --- a/modules/caddyhttp/reverseproxy/reverseproxy.go +++ b/modules/caddyhttp/reverseproxy/reverseproxy.go @@ -557,9 +557,11 @@ func notifyDetachedTunnelTrackersOfUpstreamRemoval(upstream string, self *tunnel // Connection deletion unregisters empty trackers. Do not hold the // registry lock while acquiring tracker locks or closing connections. + // One deadline for every tracker; see closeConnectionsLocked. + deadline := time.Now().Add(closeControlWriteTimeout) var err error for _, tunnel := range trackers { - if closeErr := tunnel.closeConnectionsForUpstream(upstream); closeErr != nil && tunnel == self && err == nil { + if closeErr := tunnel.closeConnectionsForUpstream(upstream, deadline); closeErr != nil && tunnel == self && err == nil { err = closeErr } } @@ -1242,6 +1244,16 @@ func (h *Handler) reverseProxy(rw http.ResponseWriter, req *http.Request, origRe // http.Transport reads a newer value to dial a new connection when that new // value is updated by another reverse proxy handler, typically forward_auth. ctx := context.WithValue(req.Context(), dialInfoCtxKey, di) + // Record the upstream socket for the websocket close message, since an + // upgraded HTTP/1 body hides it; see upstreamWriteCloser. + if isWebsocket(req) { + upstreamConn := new(atomic.Pointer[net.Conn]) + trace.GotConn = func(info httptrace.GotConnInfo) { + conn := info.Conn + upstreamConn.Store(&conn) + } + ctx = context.WithValue(ctx, upstreamConnCtxKey, upstreamConn) + } req = req.WithContext(httptrace.WithClientTrace(ctx, trace)) // do the round-trip diff --git a/modules/caddyhttp/reverseproxy/streaming.go b/modules/caddyhttp/reverseproxy/streaming.go index 20f09466a..b702f13fb 100644 --- a/modules/caddyhttp/reverseproxy/streaming.go +++ b/modules/caddyhttp/reverseproxy/streaming.go @@ -29,6 +29,7 @@ import ( "net" "net/http" "sync" + "sync/atomic" "time" "unsafe" @@ -59,6 +60,38 @@ func (rwc extendedConnectReadWriteCloser) Write(p []byte) (n int, err error) { return n, nil } +// SetWriteDeadline bounds writes to the extended CONNECT stream, so a peer +// that stopped reading cannot block the close message forever. +func (rwc extendedConnectReadWriteCloser) SetWriteDeadline(deadline time.Time) error { + //nolint:bodyclose + return http.NewResponseController(rwc.ResponseWriter).SetWriteDeadline(deadline) +} + +// upstreamConnCtxKey is the context key for the *atomic.Pointer[net.Conn] +// recording the connection a websocket upgrade's round trip used. +const upstreamConnCtxKey caddy.CtxKey = "reverse_proxy.upstream_conn" + +// upstreamWriteCloser returns where to write the close message to the +// upstream. The write must be bounded by a deadline, but for HTTP/1 +// upgrades net/http hands the upstream socket back inside a body type that +// hides its deadline methods and writes straight through to the socket, so +// the close message goes to the socket recorded during the round trip +// instead. An HTTP/1 connection is dedicated to this request; HTTP/2 and +// HTTP/3 share theirs between streams, so their bodies are used as they are. +func upstreamWriteCloser(req *http.Request, res *http.Response, backConn io.ReadWriteCloser) io.ReadWriteCloser { + if res.ProtoMajor != 1 { + return backConn + } + recorded, ok := req.Context().Value(upstreamConnCtxKey).(*atomic.Pointer[net.Conn]) + if !ok { + return backConn + } + if uc := recorded.Load(); uc != nil { + return *uc + } + return backConn +} + func (h *Handler) handleUpgradeResponse(logger *zap.Logger, rw http.ResponseWriter, req *http.Request, res *http.Response, upstreamAddr string) { // Until the tunnel takes ownership, every setup failure must close the // backend body and any hijacked client connection. net/http no longer @@ -208,16 +241,16 @@ func (h *Handler) handleUpgradeResponse(logger *zap.Logger, rw http.ResponseWrit // need to know whether the connection is considered the server or the // client side of the proxy. Note that gracefulClose must not capture h, // since the tunnel may outlive the handler instance. - gracefulClose := func(conn io.ReadWriteCloser, isClient bool) func() error { + gracefulClose := func(conn io.ReadWriteCloser, isClient bool) func(time.Time) error { if isWebsocket(req) { - return func() error { - return writeCloseControl(conn, isClient) + return func(deadline time.Time) error { + return writeCloseControl(conn, isClient, deadline) } } return nil } deleteFrontConn := tunnel.registerConnection(conn, gracefulClose(conn, false), detached, upstreamAddr) - deleteBackConn := tunnel.registerConnection(backConn, gracefulClose(backConn, true), detached, upstreamAddr) + deleteBackConn := tunnel.registerConnection(backConn, gracefulClose(upstreamWriteCloser(req, res, backConn), true), detached, upstreamAddr) if h.streamLogsSkipHandshake() { caddyhttp.SetVar(req.Context(), caddyhttp.LogSkipVar, true) } @@ -413,31 +446,9 @@ func (h Handler) flushInterval(req *http.Request, res *http.Response, incrementa return -1 } - // for h2 and h2c upstream streaming data to client (issues #3556 and #3606) - if h.isBidirectionalStream(req, res) { - return -1 - } - return time.Duration(h.FlushInterval) } -// isBidirectionalStream returns whether we should work in bi-directional stream mode. -// -// See https://github.com/caddyserver/caddy/pull/3620 for discussion of nuances. -func (h Handler) isBidirectionalStream(req *http.Request, res *http.Response) bool { - // We have to check the encoding here; only flush headers with identity encoding. - // Non-identity encoding might combine with "encode" directive, and in that case, - // if body size larger than enc.MinLength, upper level encode handle might have - // Content-Encoding header to write. - // (see https://github.com/caddyserver/caddy/issues/3606 for use case) - ae := req.Header.Get("Accept-Encoding") - - return req.ProtoMajor == 2 && - res.ProtoMajor == 2 && - res.ContentLength == -1 && - (ae == "identity" || ae == "") -} - func (h Handler) copyResponse(dst http.ResponseWriter, src io.Reader, flushInterval time.Duration, logger *zap.Logger) error { var w io.Writer = dst @@ -543,7 +554,7 @@ func (h Handler) copyBuffer(dst io.Writer, src io.Reader, buf []byte, logger *za // closed when the upstream is removed from the config, not on every reload. type openConnection struct { conn io.ReadWriteCloser - gracefulClose func() error + gracefulClose func(deadline time.Time) error detached bool upstream string } @@ -571,7 +582,7 @@ func newTunnelTracker(logger *zap.Logger, closeDelay time.Duration) *tunnelTrack // registerConnection stores conn in the tracking map. The caller must invoke // the returned del func when the connection is done. -func (ts *tunnelTracker) registerConnection(conn io.ReadWriteCloser, gracefulClose func() error, detached bool, upstream string) (del func()) { +func (ts *tunnelTracker) registerConnection(conn io.ReadWriteCloser, gracefulClose func(deadline time.Time) error, detached bool, upstream string) (del func()) { ts.mu.Lock() ts.connections[conn] = openConnection{conn, gracefulClose, detached, upstream} ts.mu.Unlock() @@ -596,16 +607,27 @@ func (ts *tunnelTracker) registerConnection(conn io.ReadWriteCloser, gracefulClo // closeAttachedConnections closes all tracked attached connections. func (ts *tunnelTracker) closeAttachedConnections() error { - var err error ts.mu.Lock() defer ts.mu.Unlock() + // detached connections are only closed when the upstream is gone from the config + return ts.closeConnectionsLocked(time.Now().Add(closeControlWriteTimeout), func(oc openConnection) bool { + return !oc.detached + }) +} + +// closeConnectionsLocked sends a close message to, then closes, every +// tracked connection that match selects. The caller must hold mu. Every +// graceful close shares one absolute deadline: the loop is serial and holds +// the lock, so per-connection timeouts would add up across stalled peers. +// The first error is returned. +func (ts *tunnelTracker) closeConnectionsLocked(deadline time.Time, match func(openConnection) bool) error { + var err error for _, oc := range ts.connections { - // detached connections are only closed when the upstream is gone from the config - if oc.detached { + if !match(oc) { continue } if oc.gracefulClose != nil { - if gracefulErr := oc.gracefulClose(); gracefulErr != nil && err == nil { + if gracefulErr := oc.gracefulClose(deadline); gracefulErr != nil && err == nil { err = gracefulErr } } @@ -657,7 +679,24 @@ func (ts *tunnelTracker) cleanupAttachedConnections() error { // from his simple implementation of this I was able to learn from at: // github.com/pascaldekloe/websocket. Further work for handling masking // taken from github.com/gorilla/websocket. -func writeCloseControl(conn io.Writer, isClient bool) error { +// +// The write must finish by deadline: a peer that stopped reading leaves the +// tunnel's copy goroutine stuck writing, and the close message would wait +// behind it forever while the caller holds the tunnel tracker lock. The +// connection is closed right after, so the deadline needs no reset. +// Connections that cannot set a write deadline are skipped instead. +func writeCloseControl(conn io.Writer, isClient bool, deadline time.Time) error { + dc, ok := conn.(interface{ SetWriteDeadline(time.Time) error }) + if !ok { + return nil + } + if err := dc.SetWriteDeadline(deadline); err != nil { + if errors.Is(err, http.ErrNotSupported) { + return nil + } + return err + } + // Sources: // https://github.com/pascaldekloe/websocket/blob/32050af67a5d/websocket.go#L119 // https://github.com/gorilla/websocket/blob/v1.5.0/conn.go#L413 @@ -707,6 +746,11 @@ func writeCloseControl(conn io.Writer, isClient bool) error { return err } +// closeControlWriteTimeout is how long one batch of graceful closes waits +// for peers to accept their close messages before giving up on them. It is +// a variable so tests can shorten it. +var closeControlWriteTimeout = 5 * time.Second + // Copied from https://github.com/gorilla/websocket/blob/v1.5.0/mask.go func maskBytes(key [4]byte, pos int, b []byte) int { // Mask one byte at a time for small buffers. @@ -766,27 +810,17 @@ func isWebsocket(r *http.Request) bool { // closeConnectionsForUpstream closes detached connections to the given // upstream on stopped trackers. Attached connections keep their close delay. -func (ts *tunnelTracker) closeConnectionsForUpstream(addr string) error { - var err error +// The deadline is shared so one upstream removal is bounded across every +// tracker it notifies. +func (ts *tunnelTracker) closeConnectionsForUpstream(addr string, deadline time.Time) error { ts.mu.Lock() defer ts.mu.Unlock() if !ts.stopped { return nil } - for _, oc := range ts.connections { - if !oc.detached || oc.upstream != addr { - continue - } - if oc.gracefulClose != nil { - if gracefulErr := oc.gracefulClose(); gracefulErr != nil && err == nil { - err = gracefulErr - } - } - if closeErr := oc.conn.Close(); closeErr != nil && err == nil { - err = closeErr - } - } - return err + return ts.closeConnectionsLocked(deadline, func(oc openConnection) bool { + return oc.detached && oc.upstream == addr + }) } type maxLatencyWriter struct { diff --git a/modules/caddyhttp/reverseproxy/streaming_test.go b/modules/caddyhttp/reverseproxy/streaming_test.go index 5b239a64d..83b74b2a3 100644 --- a/modules/caddyhttp/reverseproxy/streaming_test.go +++ b/modules/caddyhttp/reverseproxy/streaming_test.go @@ -10,9 +10,11 @@ import ( "net/http" "net/http/httptest" "net/url" + "os" "runtime" "strings" "sync" + "sync/atomic" "testing" "time" @@ -441,88 +443,95 @@ func TestHandlerUpgradedStreamHalfClose(t *testing.T) { for name, test := range tests { t.Run(name, func(t *testing.T) { - srvc := make(chan *net.TCPConn, 1) - - backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - conn, _, err := http.NewResponseController(w).Hijack() - if err != nil { - t.Errorf("backend hijack failed: %v", err) - return - } - tcp, ok := conn.(*net.TCPConn) - if !ok { - conn.Close() - t.Errorf("backend conn is %T, want *net.TCPConn", conn) - return - } - if _, err := io.WriteString(tcp, "HTTP/1.1 101 Switching Protocols\r\nConnection: Upgrade\r\nUpgrade: websocket\r\n\r\n"); err != nil { - tcp.Close() - t.Errorf("backend upgrade write failed: %v", err) - return - } - srvc <- tcp - })) - defer backend.Close() - - h := minimalHandler(0, &Upstream{ - Host: new(Host), - Dial: backend.Listener.Addr().String(), - }) - h.tunnelTracker = newTunnelTracker(caddy.Log(), 0) - initReverseProxyMetrics(h, prometheus.NewRegistry()) - - frontend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // Isolate half-close propagation from request cancellation which has - // its own backend-close path. - r = r.WithContext(context.WithoutCancel(r.Context())) - _ = h.ServeHTTP(w, prepareTestRequest(r), caddyhttp.HandlerFunc(func(http.ResponseWriter, *http.Request) error { - return nil - })) - })) - defer frontend.Close() - - frontendURL, err := url.Parse(frontend.URL) - if err != nil { - t.Fatalf("failed to parse frontend URL: %v", err) - } - addr, err := net.ResolveTCPAddr("tcp", frontendURL.Host) - if err != nil { - t.Fatalf("failed to resolve TCP address: %v", err) - } - cli, err := net.DialTCP("tcp", nil, addr) - if err != nil { - t.Fatalf("failed to dial frontend: %v", err) - } - defer cli.Close() - - req, _ := http.NewRequest(http.MethodGet, frontend.URL, nil) - req.Header.Set("Connection", "Upgrade") - req.Header.Set("Upgrade", "websocket") - if err := req.Write(cli); err != nil { - t.Fatalf("failed to write upgrade request: %v", err) - } - - resp, err := http.ReadResponse(bufio.NewReader(cli), &http.Request{Method: http.MethodGet}) - if err != nil { - t.Fatalf("failed to read upgrade response: %v", err) - } - if resp.StatusCode != http.StatusSwitchingProtocols { - t.Fatalf("status = %d, want 101", resp.StatusCode) - } - - var srv *net.TCPConn - select { - case srv = <-srvc: - case <-time.After(5 * time.Second): - t.Fatal("timed out waiting for the backend connection") - } - defer srv.Close() - + _, cli, srv := newUpgradedTunnel(t) test(t, cli, srv) }) } } +// newUpgradedTunnel proxies a websocket upgrade from a raw client connection +// through a Handler to a hijacking backend and returns both ends of the +// tunnel. The Handler's tunnel tracker holds the proxied connections. +func newUpgradedTunnel(t *testing.T) (h *Handler, cli, srv *net.TCPConn) { + t.Helper() + srvc := make(chan *net.TCPConn, 1) + + backend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + conn, _, err := http.NewResponseController(w).Hijack() + if err != nil { + t.Errorf("backend hijack failed: %v", err) + return + } + tcp, ok := conn.(*net.TCPConn) + if !ok { + conn.Close() + t.Errorf("backend conn is %T, want *net.TCPConn", conn) + return + } + if _, err := io.WriteString(tcp, "HTTP/1.1 101 Switching Protocols\r\nConnection: Upgrade\r\nUpgrade: websocket\r\n\r\n"); err != nil { + tcp.Close() + t.Errorf("backend upgrade write failed: %v", err) + return + } + srvc <- tcp + })) + t.Cleanup(backend.Close) + + h = minimalHandler(0, &Upstream{ + Host: new(Host), + Dial: backend.Listener.Addr().String(), + }) + h.tunnelTracker = newTunnelTracker(caddy.Log(), 0) + initReverseProxyMetrics(h, prometheus.NewRegistry()) + + frontend := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + // Isolate the tunnel from request cancellation, which has its own + // backend-close path. + r = r.WithContext(context.WithoutCancel(r.Context())) + _ = h.ServeHTTP(w, prepareTestRequest(r), caddyhttp.HandlerFunc(func(http.ResponseWriter, *http.Request) error { + return nil + })) + })) + t.Cleanup(frontend.Close) + + frontendURL, err := url.Parse(frontend.URL) + if err != nil { + t.Fatalf("failed to parse frontend URL: %v", err) + } + addr, err := net.ResolveTCPAddr("tcp", frontendURL.Host) + if err != nil { + t.Fatalf("failed to resolve TCP address: %v", err) + } + cli, err = net.DialTCP("tcp", nil, addr) + if err != nil { + t.Fatalf("failed to dial frontend: %v", err) + } + t.Cleanup(func() { cli.Close() }) + + req, _ := http.NewRequest(http.MethodGet, frontend.URL, nil) + req.Header.Set("Connection", "Upgrade") + req.Header.Set("Upgrade", "websocket") + if err := req.Write(cli); err != nil { + t.Fatalf("failed to write upgrade request: %v", err) + } + + resp, err := http.ReadResponse(bufio.NewReader(cli), &http.Request{Method: http.MethodGet}) + if err != nil { + t.Fatalf("failed to read upgrade response: %v", err) + } + if resp.StatusCode != http.StatusSwitchingProtocols { + t.Fatalf("status = %d, want 101", resp.StatusCode) + } + + select { + case srv = <-srvc: + case <-time.After(10 * time.Second): + t.Fatal("timed out waiting for the backend connection") + } + t.Cleanup(func() { srv.Close() }) + return h, cli, srv +} + // A response carrying the Incremental header field (RFC 10036) must be // forwarded without buffering, whatever its Content-Type and Content-Length. func TestFlushIntervalIncremental(t *testing.T) { @@ -617,7 +626,7 @@ func TestDetachedTrackerRemovalAllowsConcurrentConnectionDeletion(t *testing.T) } deleted := make(chan struct{}) conn := newTrackingReadWriteCloser() - del := ts.registerConnection(conn, func() error { + del := ts.registerConnection(conn, func(time.Time) error { go func() { deleteOther() close(deleted) @@ -644,6 +653,228 @@ func TestDetachedTrackerRemovalAllowsConcurrentConnectionDeletion(t *testing.T) } } +// newStalledWebsocketPeer returns one end of a pipe whose other end never +// reads, with a goroutine stuck writing to it the way a tunnel's copy loop +// would be. net.Pipe is unbuffered and lets only one write through at a +// time, so a close message written to conn waits behind that stuck write, +// just as it does on a socket whose peer stopped reading. +func newStalledWebsocketPeer(t *testing.T) net.Conn { + t.Helper() + conn, peer := net.Pipe() + t.Cleanup(func() { + conn.Close() + peer.Close() + }) + go func() { _, _ = conn.Write([]byte("stalled")) }() + return conn +} + +// shortenCloseControlWriteTimeout makes a stalled peer time out quickly for +// the rest of the test. +func shortenCloseControlWriteTimeout(t *testing.T) { + t.Helper() + saved := closeControlWriteTimeout + closeControlWriteTimeout = 10 * time.Millisecond + t.Cleanup(func() { closeControlWriteTimeout = saved }) +} + +func TestHandlerCleanupDoesNotBlockOnStalledWebsocketPeer(t *testing.T) { + conn := newStalledWebsocketPeer(t) + + ts := newTunnelTracker(caddy.Log(), 0) + shortenCloseControlWriteTimeout(t) + ts.registerConnection(conn, func(deadline time.Time) error { + return writeCloseControl(conn, false, deadline) + }, false, "upstream") + + cleanupDone := make(chan error, 1) + go func() { cleanupDone <- ts.cleanupAttachedConnections() }() + + select { + case err := <-cleanupDone: + if !errors.Is(err, os.ErrDeadlineExceeded) { + t.Errorf("cleanup = %v, want %v", err, os.ErrDeadlineExceeded) + } + case <-time.After(10 * time.Second): + t.Fatal("cleanup blocked on a websocket peer that stopped reading") + } +} + +func TestHandlerCleanupUsesOneDeadlinePerBatch(t *testing.T) { + // The close loop is serial and holds the tracker lock, so a deadline per + // connection would let every stalled peer add another full timeout. + ts := newTunnelTracker(caddy.Log(), 0) + shortenCloseControlWriteTimeout(t) + var deadlines []time.Time + for range 2 { + conn := newStalledWebsocketPeer(t) + ts.registerConnection(conn, func(deadline time.Time) error { + deadlines = append(deadlines, deadline) + return writeCloseControl(conn, false, deadline) + }, false, "upstream") + } + + _ = ts.cleanupAttachedConnections() + if len(deadlines) != 2 { + t.Fatalf("got %d graceful closes, want 2", len(deadlines)) + } + if !deadlines[0].Equal(deadlines[1]) { + t.Errorf("graceful closes got deadlines %v and %v, want one shared deadline", deadlines[0], deadlines[1]) + } +} + +func TestUpstreamRemovalUsesOneDeadlineAcrossTrackers(t *testing.T) { + // Removing an upstream notifies every stopped tracker in turn, and each + // close loop holds its own lock, so a deadline per tracker would let + // every tracker with a stalled peer add another full timeout. + const upstream = "upstream-removal-one-deadline" + shortenCloseControlWriteTimeout(t) + var deadlines []time.Time + var trackers []*tunnelTracker + for range 2 { + ts := newTunnelTracker(caddy.Log(), 0) + registerDetachedTunnelTrackers(ts) + t.Cleanup(func() { unregisterDetachedTunnelTrackers(ts) }) + conn := newStalledWebsocketPeer(t) + ts.registerConnection(conn, func(deadline time.Time) error { + deadlines = append(deadlines, deadline) + return writeCloseControl(conn, false, deadline) + }, true, upstream) + if err := ts.cleanupAttachedConnections(); err != nil { + t.Fatal(err) + } + trackers = append(trackers, ts) + } + + _ = notifyDetachedTunnelTrackersOfUpstreamRemoval(upstream, trackers[0]) + if len(deadlines) != 2 { + t.Fatalf("got %d graceful closes, want 2", len(deadlines)) + } + if !deadlines[0].Equal(deadlines[1]) { + t.Errorf("trackers got deadlines %v and %v, want one shared deadline", deadlines[0], deadlines[1]) + } +} + +func TestWriteCloseControlSkipsConnectionsWithoutWriteDeadline(t *testing.T) { + // A write that cannot be bounded could block forever behind a stalled + // peer, so the best-effort close message is skipped instead. + var buf bytes.Buffer + if err := writeCloseControl(&buf, false, time.Now().Add(time.Second)); err != nil { + t.Fatal(err) + } + if buf.Len() != 0 { + t.Errorf("close message %q was written to a connection without write deadlines", buf.Bytes()) + } +} + +func TestExtendedConnectReadWriteCloserSetWriteDeadline(t *testing.T) { + rw := &writeDeadlineRecorder{ResponseRecorder: httptest.NewRecorder()} + rwc := extendedConnectReadWriteCloser{io.NopCloser(strings.NewReader("")), rw} + deadline := time.Now().Add(time.Second) + if err := rwc.SetWriteDeadline(deadline); err != nil { + t.Fatal(err) + } + if !rw.writeDeadline.Equal(deadline) { + t.Errorf("write deadline = %v, want %v", rw.writeDeadline, deadline) + } + + // Writers without deadline support report ErrNotSupported, which + // writeCloseControl treats as a reason to skip the close message. + plain := extendedConnectReadWriteCloser{io.NopCloser(strings.NewReader("")), httptest.NewRecorder()} + if err := plain.SetWriteDeadline(deadline); !errors.Is(err, http.ErrNotSupported) { + t.Errorf("SetWriteDeadline on a plain recorder = %v, want ErrNotSupported", err) + } +} + +type writeDeadlineRecorder struct { + *httptest.ResponseRecorder + writeDeadline time.Time +} + +func (r *writeDeadlineRecorder) SetWriteDeadline(deadline time.Time) error { + r.writeDeadline = deadline + return nil +} + +func TestHandlerUpgradeBoundsUpstreamCloseMessage(t *testing.T) { + switch runtime.GOOS { + case "plan9", "js", "wasip1": + t.Skipf("not supported on %s", runtime.GOOS) + } + + // net/http hands upgraded HTTP/1 bodies back inside a type that hides the + // socket's deadline methods, so without the connection recorded during + // the round trip the close message to the upstream would be skipped. + h, cli, srv := newUpgradedTunnel(t) + if err := cli.SetDeadline(time.Now().Add(10 * time.Second)); err != nil { + t.Fatal(err) + } + if err := srv.SetDeadline(time.Now().Add(10 * time.Second)); err != nil { + t.Fatal(err) + } + + // Data reaching the backend proves both connections are registered. + if _, err := io.WriteString(cli, "hello"); err != nil { + t.Fatal(err) + } + hello := make([]byte, len("hello")) + if _, err := io.ReadFull(srv, hello); err != nil || string(hello) != "hello" { + t.Fatalf("backend read %q, %v; want %q", hello, err, "hello") + } + + // Send the close messages without closing anything. Cleanup closes the + // connections in map order, and closing the client side first can tear + // down the tunnel before the upstream gets its close message. + deadline := time.Now().Add(5 * time.Second) + h.tunnelTracker.mu.Lock() + for _, oc := range h.tunnelTracker.connections { + if err := oc.gracefulClose(deadline); err != nil { + t.Errorf("graceful close = %v", err) + } + } + h.tunnelTracker.mu.Unlock() + frame := make([]byte, 2) + if _, err := io.ReadFull(srv, frame); err != nil { + t.Fatalf("backend did not receive a close message: %v", err) + } + if frame[0] != 0x88 || frame[1]&0x80 == 0 { + t.Fatalf("backend received %x, want a masked close frame", frame) + } +} + +func TestUpstreamWriteCloser(t *testing.T) { + // The HTTP/1 path, including the recorded socket, is covered end to end + // by TestHandlerUpgradeBoundsUpstreamCloseMessage. HTTP/2 and HTTP/3 share + // their connection between streams, so the close message must never go + // to a recorded socket for them. + body, _ := net.Pipe() + socket, _ := net.Pipe() + for _, tc := range []struct { + name string + protoMajor int + recorded net.Conn + want io.ReadWriteCloser + }{ + {name: "http/1 with recorded socket", protoMajor: 1, recorded: socket, want: socket}, + {name: "http/1 without recorded socket", protoMajor: 1, want: body}, + {name: "http/2", protoMajor: 2, recorded: socket, want: body}, + {name: "http/3", protoMajor: 3, recorded: socket, want: body}, + } { + t.Run(tc.name, func(t *testing.T) { + recorded := new(atomic.Pointer[net.Conn]) + if tc.recorded != nil { + recorded.Store(&tc.recorded) + } + req := httptest.NewRequest(http.MethodGet, "/", nil) + req = req.WithContext(context.WithValue(req.Context(), upstreamConnCtxKey, recorded)) + res := &http.Response{ProtoMajor: tc.protoMajor} + if got := upstreamWriteCloser(req, res, body); got != tc.want { + t.Errorf("upstreamWriteCloser() = %v, want %v", got, tc.want) + } + }) + } +} + // opaqueUpgradeWriter supports hijacking but hides the recorder from the // detachment helper, as a middleware wrapper without Unwrap would do. type opaqueUpgradeWriter struct {