google-guest-agent: upgrade google.golang.org/grpc to v1.83.1 to fix CVE-2026-84304
Upgrade google.golang.org/grpc dependency to v1.83.1 and re-vendor Go dependencies via `go mod vendor` to resolve CVE-2026-84304 in app-admin/google-guest-agent.
Provenance:
- CVE-2026-84304: Go module google.golang.org/grpc fixed in v1.83.1, fix commits 7354d9c8debb ("transport: restrict memory overhead of buffering small data frames (#9331)"), 8cfeca0e1ee5 ("Cherry-pick #9331 to v1.83.x (#9333)") (https://github.com/advisories/GHSA-vp52-pcj8-j9qc)
Build adjustments:
- go get google.golang.org/grpc@v1.83.1
- go mod tidy && go mod vendor && go mod verify
BUG=b/588515801
TEST=go mod verify; CGO_ENABLED=0 go build -mod=vendor ./cmd/...
RELEASE_NOTE=Fixed CVE-2026-84304 in google-guest-agent.
cos-patch: security-high
Change-Id: Iba71493dfdb3be31fe071c600e765d2070fc467c
Reviewed-on: https://cos-review.googlesource.com/c/third_party/google-guest-agent/+/242918
Tested-by: Cusky Presubmit Bot <presubmit@cos-infra-prod.iam.gserviceaccount.com>
Reviewed-by: Robert Kolchmeyer <rkolchmeyer@google.com>
diff --git a/go.mod b/go.mod
index f341a2c..6e534ef 100644
--- a/go.mod
+++ b/go.mod
@@ -19,8 +19,8 @@
golang.org/x/crypto v0.57.0
golang.org/x/exp v0.0.0-20260611194520-c48552f49976
golang.org/x/sys v0.48.0
- google.golang.org/api v0.262.0
- google.golang.org/grpc v1.82.2
+ google.golang.org/api v0.264.0
+ google.golang.org/grpc v1.83.1
google.golang.org/protobuf v1.36.11
gopkg.in/ini.v1 v1.67.3
gopkg.in/yaml.v3 v3.0.1
@@ -30,11 +30,11 @@
require (
cel.dev/expr v0.25.2 // indirect
cloud.google.com/go v0.123.0 // indirect
- cloud.google.com/go/auth v0.18.1 // indirect
+ cloud.google.com/go/auth v0.18.2 // indirect
cloud.google.com/go/auth/oauth2adapt v0.2.8 // indirect
cloud.google.com/go/iam v1.5.3 // indirect
cloud.google.com/go/logging v1.13.1 // indirect
- cloud.google.com/go/longrunning v0.7.0 // indirect
+ cloud.google.com/go/longrunning v0.8.0 // indirect
cloud.google.com/go/monitoring v1.24.3 // indirect
github.com/GoogleCloudPlatform/confidential-space/server v0.0.0-20260617215616-d522e41e9e74 // indirect
github.com/GoogleCloudPlatform/opentelemetry-operations-go/detectors/gcp v1.33.0 // indirect
@@ -58,7 +58,7 @@
github.com/google/s2a-go v0.1.9 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.3.17 // indirect
- github.com/googleapis/gax-go/v2 v2.16.0 // indirect
+ github.com/googleapis/gax-go/v2 v2.17.0 // indirect
github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/lufia/plan9stats v0.0.0-20260627054121-477a66015f15 // indirect
github.com/mdlayher/socket v0.6.1 // indirect
@@ -86,7 +86,7 @@
golang.org/x/sync v0.23.0 // indirect
golang.org/x/text v0.42.0 // indirect
golang.org/x/time v0.15.0 // indirect
- google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 // indirect
+ google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7 // indirect
)
diff --git a/go.sum b/go.sum
index 1480ceb..8b59e89 100644
--- a/go.sum
+++ b/go.sum
@@ -2,8 +2,8 @@
cel.dev/expr v0.25.2/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.18.1 h1:IwTEx92GFUo2pJ6Qea0EU3zYvKnTAeRCODxfA/G5UWs=
-cloud.google.com/go/auth v0.18.1/go.mod h1:GfTYoS9G3CWpRA3Va9doKN9mjPGRS+v41jmZAhBzbrA=
+cloud.google.com/go/auth v0.18.2 h1:+Nbt5Ev0xEqxlNjd6c+yYUeosQ5TtEUaNcN/3FozlaM=
+cloud.google.com/go/auth v0.18.2/go.mod h1:xD+oY7gcahcu7G2SG2DsBerfFxgPAJz17zz2joOFF3M=
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.0 h1:pDUj4QMoPejqq20dK0Pg2N4yG9zIkYGdBtwLoEkH9Zs=
@@ -12,8 +12,8 @@
cloud.google.com/go/iam v1.5.3/go.mod h1:MR3v9oLkZCTlaqljW6Eb2d3HGDGK5/bDv93jhfISFvU=
cloud.google.com/go/logging v1.13.1 h1:O7LvmO0kGLaHY/gq8cV7T0dyp6zJhYAOtZPX4TF3QtY=
cloud.google.com/go/logging v1.13.1/go.mod h1:XAQkfkMBxQRjQek96WLPNze7vsOmay9H5PqfsNYDqvw=
-cloud.google.com/go/longrunning v0.7.0 h1:FV0+SYF1RIj59gyoWDRi45GiYUMM3K1qO51qoboQT1E=
-cloud.google.com/go/longrunning v0.7.0/go.mod h1:ySn2yXmjbK9Ba0zsQqunhDkYi0+9rlXIwnoAf+h+TPY=
+cloud.google.com/go/longrunning v0.8.0 h1:LiKK77J3bx5gDLi4SMViHixjD2ohlkwBi+mKA7EhfW8=
+cloud.google.com/go/longrunning v0.8.0/go.mod h1:UmErU2Onzi+fKDg2gR7dusz11Pe26aknR4kHmJJqIfk=
cloud.google.com/go/monitoring v1.24.3 h1:dde+gMNc0UhPZD1Azu6at2e79bfdztVDS5lvhOdsgaE=
cloud.google.com/go/monitoring v1.24.3/go.mod h1:nYP6W0tm3N9H/bOw8am7t62YTzZY+zUeQ+Bi6+2eonI=
cloud.google.com/go/storage v1.57.2 h1:sVlym3cHGYhrp6XZKkKb+92I1V42ks2qKKpB0CF5Mb4=
@@ -103,8 +103,8 @@
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.3.17 h1:73NfMHdiqo9JFU9+7a5ExpVa10/R29pXfZIaW559nrg=
github.com/googleapis/enterprise-certificate-proxy v0.3.17/go.mod h1:rSEsBUemEBZEexP2y6jPp16LUmUbjmSbcPMQizR0o4k=
-github.com/googleapis/gax-go/v2 v2.16.0 h1:iHbQmKLLZrexmb0OSsNGTeSTS0HO4YvFOG8g5E4Zd0Y=
-github.com/googleapis/gax-go/v2 v2.16.0/go.mod h1:o1vfQjjNZn4+dPnRdl/4ZD7S9414Y4xA+a/6Icj6l14=
+github.com/googleapis/gax-go/v2 v2.17.0 h1:RksgfBpxqff0EZkDWYuz9q/uWsTVz+kf43LsZ1J6SMc=
+github.com/googleapis/gax-go/v2 v2.17.0/go.mod h1:mzaqghpQp4JDh3HvADwrat+6M3MOIDp5YKHhb9PAgDY=
github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
@@ -207,16 +207,16 @@
golang.org/x/time v0.15.0/go.mod h1:Y4YMaQmXwGQZoFaVFk4YpCt4FLQMYKZe9oeV/f4MSno=
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.262.0 h1:4B+3u8He2GwyN8St3Jhnd3XRHlIvc//sBmgHSp78oNY=
-google.golang.org/api v0.262.0/go.mod h1:jNwmH8BgUBJ/VrUG6/lIl9YiildyLd09r9ZLHiQ6cGI=
-google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217 h1:GvESR9BIyHUahIb0NcTum6itIWtdoglGX+rnGxm2934=
-google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217/go.mod h1:yJ2HH4EHEDTd3JiLmhds6NkJ17ITVYOdV3m3VKOnws0=
+google.golang.org/api v0.264.0 h1:+Fo3DQXBK8gLdf8rFZ3uLu39JpOnhvzJrLMQSoSYZJM=
+google.golang.org/api v0.264.0/go.mod h1:fAU1xtNNisHgOF5JooAs8rRaTkl2rT3uaoNGo9NS3R8=
+google.golang.org/genproto v0.0.0-20260128011058-8636f8732409 h1:VQZ/yAbAtjkHgH80teYd2em3xtIkkHd7ZhqfH2N9CsM=
+google.golang.org/genproto v0.0.0-20260128011058-8636f8732409/go.mod h1:rxKD3IEILWEu3P44seeNOAwZN4SaoKaQ/2eTg4mM6EM=
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7 h1:jQ9p21COKWjP3VwuFrNRiiOTMh3mPpN45R7SLrH/HUU=
google.golang.org/genproto/googleapis/api v0.0.0-20260630182238-925bb5da69e7/go.mod h1:KqHwBx2upmfa1XSi1WuRvC+2VGCLtooKkfmyvRbUmqA=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7 h1:eM/YSd5bBFagF51o1E745Ta7RwzpW0h+z+QDNZOgmQ8=
google.golang.org/genproto/googleapis/rpc v0.0.0-20260630182238-925bb5da69e7/go.mod h1:4Hqkh8ycfw05ld/3BWL7rJOSfebL2Q+DVDeRgYgxUU8=
-google.golang.org/grpc v1.82.2 h1:2+rCCTC8esfgjDFhN+rIok0FVsBLw/y5vHzNX2FjRLw=
-google.golang.org/grpc v1.82.2/go.mod h1:yzTZ1TB1Z3SG+LIYaI+WiE8D5+PZ3ArnrSp8zF3+/ZA=
+google.golang.org/grpc v1.83.1 h1:HIO0+BEtBP6soyqvqC8sNUjZ7bTs+0hFQuFF+RAy++Y=
+google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ=
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=
diff --git a/vendor/cloud.google.com/go/auth/CHANGES.md b/vendor/cloud.google.com/go/auth/CHANGES.md
index b48828c..846231f 100644
--- a/vendor/cloud.google.com/go/auth/CHANGES.md
+++ b/vendor/cloud.google.com/go/auth/CHANGES.md
@@ -1,5 +1,11 @@
# Changes
+## [0.18.2](https://github.com/googleapis/google-cloud-go/releases/tag/auth%2Fv0.18.2) (2026-02-13)
+
+### Bug Fixes
+
+* fixes gdch credentials logic (#13741) ([f82cda5](https://github.com/googleapis/google-cloud-go/commit/f82cda58bd9885b7b8a9d8b15126f5a1e0add0dc))
+
## [0.18.1](https://github.com/googleapis/google-cloud-go/releases/tag/auth%2Fv0.18.1) (2026-01-21)
### Bug Fixes
diff --git a/vendor/cloud.google.com/go/auth/credentials/idtoken/cache.go b/vendor/cloud.google.com/go/auth/credentials/idtoken/cache.go
new file mode 100644
index 0000000..2fbbdb8
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/idtoken/cache.go
@@ -0,0 +1,139 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package idtoken
+
+import (
+ "context"
+ "encoding/json"
+ "fmt"
+ "log/slog"
+ "net/http"
+ "strconv"
+ "strings"
+ "sync"
+ "time"
+
+ "cloud.google.com/go/auth/internal"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+type cachingClient struct {
+ client *http.Client
+
+ // clock optionally specifies a func to return the current time.
+ // If nil, time.Now is used.
+ clock func() time.Time
+
+ mu sync.Mutex
+ certs map[string]*cachedResponse
+ logger *slog.Logger
+}
+
+func newCachingClient(client *http.Client, logger *slog.Logger) *cachingClient {
+ return &cachingClient{
+ client: client,
+ certs: make(map[string]*cachedResponse, 2),
+ logger: logger,
+ }
+}
+
+type cachedResponse struct {
+ resp *certResponse
+ exp time.Time
+}
+
+func (c *cachingClient) getCert(ctx context.Context, url string) (*certResponse, error) {
+ if response, ok := c.get(url); ok {
+ return response, nil
+ }
+ req, err := http.NewRequestWithContext(ctx, http.MethodGet, url, nil)
+ if err != nil {
+ return nil, err
+ }
+ c.logger.DebugContext(ctx, "cert request", "request", internallog.HTTPRequest(req, nil))
+ resp, body, err := internal.DoRequest(c.client, req)
+ if err != nil {
+ return nil, err
+ }
+ c.logger.DebugContext(ctx, "cert response", "response", internallog.HTTPResponse(resp, body))
+ if resp.StatusCode != http.StatusOK {
+ return nil, fmt.Errorf("idtoken: unable to retrieve cert, got status code %d", resp.StatusCode)
+ }
+
+ certResp := &certResponse{}
+ if err := json.Unmarshal(body, &certResp); err != nil {
+ return nil, err
+
+ }
+ c.set(url, certResp, resp.Header)
+ return certResp, nil
+}
+
+func (c *cachingClient) now() time.Time {
+ if c.clock != nil {
+ return c.clock()
+ }
+ return time.Now()
+}
+
+func (c *cachingClient) get(url string) (*certResponse, bool) {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ cachedResp, ok := c.certs[url]
+ if !ok {
+ return nil, false
+ }
+ if c.now().After(cachedResp.exp) {
+ return nil, false
+ }
+ return cachedResp.resp, true
+}
+
+func (c *cachingClient) set(url string, resp *certResponse, headers http.Header) {
+ exp := c.calculateExpireTime(headers)
+ c.mu.Lock()
+ c.certs[url] = &cachedResponse{resp: resp, exp: exp}
+ c.mu.Unlock()
+}
+
+// calculateExpireTime will determine the expire time for the cache based on
+// HTTP headers. If there is any difficulty reading the headers the fallback is
+// to set the cache to expire now.
+func (c *cachingClient) calculateExpireTime(headers http.Header) time.Time {
+ var maxAge int
+ cc := strings.Split(headers.Get("cache-control"), ",")
+ for _, v := range cc {
+ if strings.Contains(v, "max-age") {
+ ss := strings.Split(v, "=")
+ if len(ss) < 2 {
+ return c.now()
+ }
+ ma, err := strconv.Atoi(ss[1])
+ if err != nil {
+ return c.now()
+ }
+ maxAge = ma
+ }
+ }
+ a := headers.Get("age")
+ if a == "" {
+ return c.now().Add(time.Duration(maxAge) * time.Second)
+ }
+ age, err := strconv.Atoi(a)
+ if err != nil {
+ return c.now()
+ }
+ return c.now().Add(time.Duration(maxAge-age) * time.Second)
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/idtoken/compute.go b/vendor/cloud.google.com/go/auth/credentials/idtoken/compute.go
new file mode 100644
index 0000000..86f6cd7
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/idtoken/compute.go
@@ -0,0 +1,89 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package idtoken
+
+import (
+ "context"
+ "fmt"
+ "net/url"
+ "time"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/internal"
+ "cloud.google.com/go/compute/metadata"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+const identitySuffix = "instance/service-accounts/default/identity"
+
+// computeCredentials checks if this code is being run on GCE. If it is, it
+// will use the metadata service to build a Credentials that fetches ID
+// tokens.
+func computeCredentials(opts *Options) (*auth.Credentials, error) {
+ if opts.CustomClaims != nil {
+ return nil, fmt.Errorf("idtoken: Options.CustomClaims can't be used with the metadata service, please provide a service account if you would like to use this feature")
+ }
+ metadataClient := metadata.NewWithOptions(&metadata.Options{
+ Logger: internallog.New(opts.Logger),
+ })
+ tp := &computeIDTokenProvider{
+ audience: opts.Audience,
+ format: opts.ComputeTokenFormat,
+ client: metadataClient,
+ }
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: auth.NewCachedTokenProvider(tp, &auth.CachedTokenProviderOptions{
+ ExpireEarly: 5 * time.Minute,
+ }),
+ ProjectIDProvider: auth.CredentialsPropertyFunc(func(ctx context.Context) (string, error) {
+ return metadataClient.ProjectIDWithContext(ctx)
+ }),
+ UniverseDomainProvider: &internal.ComputeUniverseDomainProvider{
+ MetadataClient: metadataClient,
+ },
+ }), nil
+}
+
+type computeIDTokenProvider struct {
+ audience string
+ format ComputeTokenFormat
+ client *metadata.Client
+}
+
+func (c *computeIDTokenProvider) Token(ctx context.Context) (*auth.Token, error) {
+ v := url.Values{}
+ v.Set("audience", c.audience)
+ if c.format != ComputeTokenFormatStandard {
+ v.Set("format", "full")
+ }
+ if c.format == ComputeTokenFormatFullWithLicense {
+ v.Set("licenses", "TRUE")
+ }
+ urlSuffix := identitySuffix + "?" + v.Encode()
+ res, err := c.client.GetWithContext(ctx, urlSuffix)
+ if err != nil {
+ return nil, err
+ }
+ if res == "" {
+ return nil, fmt.Errorf("idtoken: invalid empty response from metadata service")
+ }
+ return &auth.Token{
+ Value: res,
+ Type: internal.TokenTypeBearer,
+ // Compute tokens are valid for one hour:
+ // https://cloud.google.com/iam/docs/create-short-lived-credentials-direct#create-id
+ Expiry: time.Now().Add(1 * time.Hour),
+ }, nil
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/idtoken/file.go b/vendor/cloud.google.com/go/auth/credentials/idtoken/file.go
new file mode 100644
index 0000000..ac242f9
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/idtoken/file.go
@@ -0,0 +1,143 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package idtoken
+
+import (
+ "encoding/json"
+ "fmt"
+ "path/filepath"
+ "strings"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials"
+ "cloud.google.com/go/auth/credentials/impersonate"
+ intimpersonate "cloud.google.com/go/auth/credentials/internal/impersonate"
+ "cloud.google.com/go/auth/internal"
+ "cloud.google.com/go/auth/internal/credsfile"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+const (
+ jwtTokenURL = "https://oauth2.googleapis.com/token"
+ iamCredAud = "https://iamcredentials.googleapis.com/"
+)
+
+func credsFromDefault(creds *auth.Credentials, opts *Options) (*auth.Credentials, error) {
+ b := creds.JSON()
+ t, err := credsfile.ParseFileType(b)
+ if err != nil {
+ return nil, err
+ }
+ switch credentials.CredType(t) {
+ case credentials.ServiceAccount:
+ f, err := credsfile.ParseServiceAccount(b)
+ if err != nil {
+ return nil, err
+ }
+ var tp auth.TokenProvider
+ if resolveUniverseDomain(f) == internal.DefaultUniverseDomain {
+ tp, err = new2LOTokenProvider(f, opts)
+ if err != nil {
+ return nil, err
+ }
+ } else {
+ // In case of non-GDU universe domain, use IAM.
+ tp = intimpersonate.IDTokenIAMOptions{
+ Client: opts.client(),
+ Logger: internallog.New(opts.Logger),
+ // Pass the credentials universe domain to configure the endpoint.
+ UniverseDomain: auth.CredentialsPropertyFunc(creds.UniverseDomain),
+ ServiceAccountEmail: f.ClientEmail,
+ GenerateIDTokenRequest: intimpersonate.GenerateIDTokenRequest{
+ Audience: opts.Audience,
+ },
+ }
+ }
+ tp = auth.NewCachedTokenProvider(tp, nil)
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: tp,
+ JSON: b,
+ ProjectIDProvider: auth.CredentialsPropertyFunc(creds.ProjectID),
+ UniverseDomainProvider: auth.CredentialsPropertyFunc(creds.UniverseDomain),
+ }), nil
+ case credentials.ImpersonatedServiceAccount, credentials.ExternalAccount:
+ type url struct {
+ ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"`
+ }
+ var accountURL url
+ if err := json.Unmarshal(b, &accountURL); err != nil {
+ return nil, err
+ }
+ account := filepath.Base(accountURL.ServiceAccountImpersonationURL)
+ account = strings.Split(account, ":")[0]
+ config := impersonate.IDTokenOptions{
+ Audience: opts.Audience,
+ TargetPrincipal: account,
+ IncludeEmail: true,
+ Client: opts.client(),
+ Credentials: creds,
+ Logger: internallog.New(opts.Logger),
+ }
+ idTokenCreds, err := impersonate.NewIDTokenCredentials(&config)
+ if err != nil {
+ return nil, err
+ }
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: idTokenCreds,
+ JSON: b,
+ ProjectIDProvider: auth.CredentialsPropertyFunc(creds.ProjectID),
+ UniverseDomainProvider: auth.CredentialsPropertyFunc(creds.UniverseDomain),
+ QuotaProjectIDProvider: auth.CredentialsPropertyFunc(creds.QuotaProjectID),
+ }), nil
+ default:
+ return nil, fmt.Errorf("idtoken: unsupported credentials type: %v", t)
+ }
+}
+
+func new2LOTokenProvider(f *credsfile.ServiceAccountFile, opts *Options) (auth.TokenProvider, error) {
+ opts2LO := &auth.Options2LO{
+ Email: f.ClientEmail,
+ PrivateKey: []byte(f.PrivateKey),
+ PrivateKeyID: f.PrivateKeyID,
+ TokenURL: f.TokenURL,
+ UseIDToken: true,
+ Logger: internallog.New(opts.Logger),
+ }
+ if opts2LO.TokenURL == "" {
+ opts2LO.TokenURL = jwtTokenURL
+ }
+
+ var customClaims map[string]interface{}
+ if opts != nil {
+ customClaims = opts.CustomClaims
+ }
+ if customClaims == nil {
+ customClaims = make(map[string]interface{})
+ }
+ customClaims["target_audience"] = opts.Audience
+
+ opts2LO.PrivateClaims = customClaims
+ return auth.New2LOTokenProvider(opts2LO)
+}
+
+// resolveUniverseDomain returns the default service domain for a given
+// Cloud universe. This is the universe domain configured for the credentials,
+// which will be used in endpoint.
+func resolveUniverseDomain(f *credsfile.ServiceAccountFile) string {
+ if f.UniverseDomain != "" {
+ return f.UniverseDomain
+ }
+ return internal.DefaultUniverseDomain
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/idtoken/idtoken.go b/vendor/cloud.google.com/go/auth/credentials/idtoken/idtoken.go
new file mode 100644
index 0000000..765bc87
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/idtoken/idtoken.go
@@ -0,0 +1,268 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package idtoken provides functionality for generating and validating ID
+// tokens, with configurable options for audience, custom claims, and token
+// formats.
+//
+// For more information on ID tokens, see
+// https://cloud.google.com/docs/authentication/token-types#id.
+package idtoken
+
+import (
+ "errors"
+ "log/slog"
+ "net/http"
+ "os"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials"
+ "cloud.google.com/go/auth/internal"
+ "cloud.google.com/go/auth/internal/credsfile"
+ "cloud.google.com/go/compute/metadata"
+)
+
+// ComputeTokenFormat dictates the the token format when requesting an ID token
+// from the compute metadata service.
+type ComputeTokenFormat int
+
+const (
+ // ComputeTokenFormatDefault means the same as [ComputeTokenFormatFull].
+ ComputeTokenFormatDefault ComputeTokenFormat = iota
+ // ComputeTokenFormatStandard mean only standard JWT fields will be included
+ // in the token.
+ ComputeTokenFormatStandard
+ // ComputeTokenFormatFull means the token will include claims about the
+ // virtual machine instance and its project.
+ ComputeTokenFormatFull
+ // ComputeTokenFormatFullWithLicense means the same as
+ // [ComputeTokenFormatFull] with the addition of claims about licenses
+ // associated with the instance.
+ ComputeTokenFormatFullWithLicense
+)
+
+var (
+ defaultScopes = []string{
+ "https://iamcredentials.googleapis.com/",
+ "https://www.googleapis.com/auth/cloud-platform",
+ }
+
+ errMissingOpts = errors.New("idtoken: opts must be provided")
+ errMissingAudience = errors.New("idtoken: Audience must be provided")
+ errBothFileAndJSON = errors.New("idtoken: CredentialsFile and CredentialsJSON must not both be provided")
+)
+
+// Options for the configuration of creation of an ID token with
+// [NewCredentials].
+type Options struct {
+ // Audience is the `aud` field for the token, such as an API endpoint the
+ // token will grant access to. Required.
+ Audience string
+ // ComputeTokenFormat dictates the the token format when requesting an ID
+ // token from the compute metadata service. Optional.
+ ComputeTokenFormat ComputeTokenFormat
+ // CustomClaims specifies private non-standard claims for an ID token.
+ // Optional.
+ CustomClaims map[string]interface{}
+
+ // CredentialsFile sources a JSON credential file from the provided
+ // filepath. If provided, do not provide CredentialsJSON. Optional.
+ //
+ // Deprecated: This field is deprecated because of a potential security risk.
+ // It does not validate the credential configuration. The security risk occurs
+ // when a credential configuration is accepted from a source that is not
+ // under your control and used without validation on your side.
+ //
+ // If you know that you will be loading credential configurations of a
+ // specific type, it is recommended to use a credential-type-specific
+ // NewCredentialsFromFile method. This will ensure that an unexpected
+ // credential type with potential for malicious intent is not loaded
+ // unintentionally. You might still have to do validation for certain
+ // credential types. Please follow the recommendation for that method. For
+ // example, if you want to load only service accounts, you can use
+ //
+ // creds, err := idtoken.NewCredentialsFromFile(ctx, credentials.ServiceAccount, filename, opts)
+ //
+ // If you are loading your credential configuration from an untrusted source
+ // and have not mitigated the risks (e.g. by validating the configuration
+ // yourself), make these changes as soon as possible to prevent security
+ // risks to your environment.
+ //
+ // Regardless of the method used, it is always your responsibility to
+ // validate configurations received from external sources.
+ //
+ // For more details see:
+ // https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
+ CredentialsFile string
+ // CredentialsJSON sources a JSON credential file from the provided bytes.
+ // If provided, do not provide CredentialsJSON. Optional.
+ //
+ // Deprecated: This field is deprecated because of a potential security risk.
+ // It does not validate the credential configuration. The security risk occurs
+ // when a credential configuration is accepted from a source that is not
+ // under your control and used without validation on your side.
+ //
+ // If you know that you will be loading credential configurations of a
+ // specific type, it is recommended to use a credential-type-specific
+ // NewCredentialsFromJSON method. This will ensure that an unexpected
+ // credential type with potential for malicious intent is not loaded
+ // unintentionally. You might still have to do validation for certain
+ // credential types. Please follow the recommendation for that method. For
+ // example, if you want to load only service accounts, you can use
+ //
+ // creds, err := idtoken.NewCredentialsFromJSON(ctx, credentials.ServiceAccount, json, opts)
+ //
+ // If you are loading your credential configuration from an untrusted source
+ // and have not mitigated the risks (e.g. by validating the configuration
+ // yourself), make these changes as soon as possible to prevent security
+ // risks to your environment.
+ //
+ // Regardless of the method used, it is always your responsibility to
+ // validate configurations received from external sources.
+ //
+ // For more details see:
+ // https://cloud.google.com/docs/authentication/external/externally-sourced-credentials
+ CredentialsJSON []byte
+ // Client configures the underlying client used to make network requests
+ // when fetching tokens. If provided this should be a fully-authenticated
+ // client. Optional.
+ Client *http.Client
+ // UniverseDomain is the default service domain for a given Cloud universe.
+ // The default value is "googleapis.com". This is the universe domain
+ // configured for the client, which will be compared to the universe domain
+ // that is separately configured for the credentials. Optional.
+ UniverseDomain string
+ // Logger is used for debug logging. If provided, logging will be enabled
+ // at the loggers configured level. By default logging is disabled unless
+ // enabled by setting GOOGLE_SDK_GO_LOGGING_LEVEL in which case a default
+ // logger will be used. Optional.
+ Logger *slog.Logger
+}
+
+func (o *Options) client() *http.Client {
+ if o == nil || o.Client == nil {
+ return internal.DefaultClient()
+ }
+ return o.Client
+}
+
+func (o *Options) validate() error {
+ if o == nil {
+ return errMissingOpts
+ }
+ if o.Audience == "" {
+ return errMissingAudience
+ }
+ if o.CredentialsFile != "" && len(o.CredentialsJSON) > 0 {
+ return errBothFileAndJSON
+ }
+ return nil
+}
+
+// NewCredentials creates a [cloud.google.com/go/auth.Credentials] that returns
+// ID tokens configured by the opts provided. The parameter opts.Audience must
+// not be empty. If both opts.CredentialsFile and opts.CredentialsJSON are
+// empty, an attempt will be made to detect credentials from the environment
+// (see [cloud.google.com/go/auth/credentials.DetectDefault]). Only service
+// account, impersonated service account, external account and Compute
+// credentials are supported.
+func NewCredentials(opts *Options) (*auth.Credentials, error) {
+ if err := opts.validate(); err != nil {
+ return nil, err
+ }
+ b := opts.jsonBytes()
+ if b == nil && metadata.OnGCE() {
+ return computeCredentials(opts)
+ }
+ creds, err := credentials.DetectDefault(&credentials.DetectOptions{
+ Scopes: defaultScopes,
+ CredentialsJSON: b,
+ Client: opts.client(),
+ UseSelfSignedJWT: true,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return credsFromDefault(creds, opts)
+}
+
+func (o *Options) jsonBytes() []byte {
+ if len(o.CredentialsJSON) > 0 {
+ return o.CredentialsJSON
+ }
+ var fnOverride string
+ if o != nil {
+ fnOverride = o.CredentialsFile
+ }
+ filename := credsfile.GetFileNameFromEnv(fnOverride)
+ if filename != "" {
+ b, _ := os.ReadFile(filename)
+ return b
+ }
+ return nil
+}
+
+// NewCredentialsFromJSON creates a [cloud.google.com/go/auth.Credentials] that
+// returns ID tokens from the provided JSON bytes. The credType argument
+// specifies the expected credential type. If the JSON does not match the
+// expected type, an error is returned.
+//
+// This method is safe to use with untrusted credential configurations if the
+// expected credType is NOT [credentials.ExternalAccount] or
+// [credentials.ImpersonatedServiceAccount].
+//
+// **IMPORTANT**: If you use [credentials.ExternalAccount] or
+// [credentials.ImpersonatedServiceAccount], you must validate the credential
+// configuration before providing it to this method. Providing an unvalidated
+// credential configuration to Google APIs can compromise the security of your
+// systems and data. For more information, refer to [Validate credential
+// configurations from external sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
+func NewCredentialsFromJSON(credType credentials.CredType, b []byte, opts *Options) (*auth.Credentials, error) {
+ if err := opts.validate(); err != nil {
+ return nil, err
+ }
+ // Use credentials.NewCredentialsFromJSON to validate type and create base credentials.
+ creds, err := credentials.NewCredentialsFromJSON(credType, b, &credentials.DetectOptions{
+ Client: opts.Client,
+ Logger: opts.Logger,
+ UniverseDomain: opts.UniverseDomain,
+ })
+ if err != nil {
+ return nil, err
+ }
+ return credsFromDefault(creds, opts)
+}
+
+// NewCredentialsFromFile creates a [cloud.google.com/go/auth.Credentials] that
+// returns ID tokens from the provided file. The credType argument specifies the
+// expected credential type. If the file content does not match the expected
+// type, an error is returned.
+//
+// This method is safe to use with untrusted credential configurations if the
+// expected credType is NOT [credentials.ExternalAccount] or
+// [credentials.ImpersonatedServiceAccount].
+//
+// **IMPORTANT**: If you use [credentials.ExternalAccount] or
+// [credentials.ImpersonatedServiceAccount], you must validate the credential
+// configuration before providing it to this method. Providing an unvalidated
+// credential configuration to Google APIs can compromise the security of your
+// systems and data. For more information, refer to [Validate credential
+// configurations from external sources](https://cloud.google.com/docs/authentication/external/externally-sourced-credentials).
+func NewCredentialsFromFile(credType credentials.CredType, filename string, opts *Options) (*auth.Credentials, error) {
+ b, err := os.ReadFile(filename)
+ if err != nil {
+ return nil, err
+ }
+ return NewCredentialsFromJSON(credType, b, opts)
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/idtoken/validate.go b/vendor/cloud.google.com/go/auth/credentials/idtoken/validate.go
new file mode 100644
index 0000000..4dd0dd5
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/idtoken/validate.go
@@ -0,0 +1,314 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package idtoken
+
+import (
+ "context"
+ "crypto"
+ "crypto/ecdsa"
+ "crypto/elliptic"
+ "crypto/rsa"
+ "crypto/sha256"
+ "encoding/base64"
+ "encoding/json"
+ "fmt"
+ "log/slog"
+ "math/big"
+ "net/http"
+ "strings"
+ "time"
+
+ "cloud.google.com/go/auth/internal"
+ "cloud.google.com/go/auth/internal/jwt"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+const (
+ es256KeySize int = 32
+ // googleIAPCertsURL is used for ES256 Certs.
+ googleIAPCertsURL string = "https://www.gstatic.com/iap/verify/public_key-jwk"
+ // googleSACertsURL is used for RS256 Certs.
+ googleSACertsURL string = "https://www.googleapis.com/oauth2/v3/certs"
+)
+
+var (
+ defaultValidator = &Validator{client: newCachingClient(internal.DefaultClient(), internallog.New(nil))}
+ // now aliases time.Now for testing.
+ now = time.Now
+)
+
+// certResponse represents a list jwks. It is the format returned from known
+// Google cert endpoints.
+type certResponse struct {
+ Keys []jwk `json:"keys"`
+}
+
+// jwk is a simplified representation of a standard jwk. It only includes the
+// fields used by Google's cert endpoints.
+type jwk struct {
+ Alg string `json:"alg"`
+ Crv string `json:"crv"`
+ Kid string `json:"kid"`
+ Kty string `json:"kty"`
+ Use string `json:"use"`
+ E string `json:"e"`
+ N string `json:"n"`
+ X string `json:"x"`
+ Y string `json:"y"`
+}
+
+// Validator provides a way to validate Google ID Tokens
+type Validator struct {
+ client *cachingClient
+ rs256URL string
+ es256URL string
+}
+
+// Payload represents a decoded payload of an ID token.
+type Payload struct {
+ Issuer string `json:"iss"`
+ Audience string `json:"aud"`
+ Expires int64 `json:"exp"`
+ IssuedAt int64 `json:"iat"`
+ Subject string `json:"sub,omitempty"`
+ Claims map[string]interface{} `json:"-"`
+}
+
+// ValidatorOptions provides a way to configure a [Validator].
+type ValidatorOptions struct {
+ // Client used to make requests to the certs URL. Optional.
+ Client *http.Client
+ // Custom certs URL for RS256 JWK to be used. If not provided, the default
+ // Google oauth2 endpoint will be used. Optional.
+ RS256CertsURL string
+ // Custom certs URL for ES256 JWK to be used. If not provided, the default
+ // Google IAP endpoint will be used. Optional.
+ ES256CertsURL string
+ // Logger is used for debug logging. If provided, logging will be enabled
+ // at the loggers configured level. By default logging is disabled unless
+ // enabled by setting GOOGLE_SDK_GO_LOGGING_LEVEL in which case a default
+ // Logger will be used. Optional.
+ Logger *slog.Logger
+}
+
+// NewValidator creates a Validator that uses the options provided to configure
+// a the internal http.Client that will be used to make requests to fetch JWKs.
+func NewValidator(opts *ValidatorOptions) (*Validator, error) {
+ if opts == nil {
+ opts = &ValidatorOptions{}
+ }
+ client := opts.Client
+ if client == nil {
+ client = internal.DefaultClient()
+ }
+ rs256URL := opts.RS256CertsURL
+ es256URL := opts.ES256CertsURL
+ logger := internallog.New(opts.Logger)
+ return &Validator{client: newCachingClient(client, logger), rs256URL: rs256URL, es256URL: es256URL}, nil
+}
+
+// Validate is used to validate the provided idToken with a known Google cert
+// URL. If audience is not empty the audience claim of the Token is validated.
+// Upon successful validation a parsed token Payload is returned allowing the
+// caller to validate any additional claims.
+func (v *Validator) Validate(ctx context.Context, idToken string, audience string) (*Payload, error) {
+ return v.validate(ctx, idToken, audience)
+}
+
+// Validate is used to validate the provided idToken with a known Google cert
+// URL. If audience is not empty the audience claim of the Token is validated.
+// Upon successful validation a parsed token Payload is returned allowing the
+// caller to validate any additional claims.
+func Validate(ctx context.Context, idToken string, audience string) (*Payload, error) {
+ return defaultValidator.validate(ctx, idToken, audience)
+}
+
+// ParsePayload parses the given token and returns its payload.
+//
+// Warning: This function does not validate the token prior to parsing it.
+//
+// ParsePayload is primarily meant to be used to inspect a token's payload. This is
+// useful when validation fails and the payload needs to be inspected.
+//
+// Note: A successful Validate() invocation with the same token will return an
+// identical payload.
+func ParsePayload(idToken string) (*Payload, error) {
+ _, payload, _, err := parseToken(idToken)
+ if err != nil {
+ return nil, err
+ }
+ return payload, nil
+}
+
+func (v *Validator) validate(ctx context.Context, idToken string, audience string) (*Payload, error) {
+ header, payload, sig, err := parseToken(idToken)
+ if err != nil {
+ return nil, err
+ }
+
+ if audience != "" && payload.Audience != audience {
+ return nil, fmt.Errorf("idtoken: audience provided does not match aud claim in the JWT")
+ }
+
+ if now().Unix() > payload.Expires {
+ return nil, fmt.Errorf("idtoken: token expired: now=%v, expires=%v", now().Unix(), payload.Expires)
+ }
+ hashedContent := hashHeaderPayload(idToken)
+ switch header.Algorithm {
+ case jwt.HeaderAlgRSA256:
+ if err := v.validateRS256(ctx, header.KeyID, hashedContent, sig); err != nil {
+ return nil, err
+ }
+ case jwt.HeaderAlgES256:
+ if err := v.validateES256(ctx, header.KeyID, hashedContent, sig); err != nil {
+ return nil, err
+ }
+ default:
+ return nil, fmt.Errorf("idtoken: expected JWT signed with RS256 or ES256 but found %q", header.Algorithm)
+ }
+
+ return payload, nil
+}
+
+func (v *Validator) validateRS256(ctx context.Context, keyID string, hashedContent []byte, sig []byte) error {
+ certResp, err := v.client.getCert(ctx, v.rs256CertsURL())
+ if err != nil {
+ return err
+ }
+ j, err := findMatchingKey(certResp, keyID)
+ if err != nil {
+ return err
+ }
+ dn, err := decode(j.N)
+ if err != nil {
+ return err
+ }
+ de, err := decode(j.E)
+ if err != nil {
+ return err
+ }
+
+ pk := &rsa.PublicKey{
+ N: new(big.Int).SetBytes(dn),
+ E: int(new(big.Int).SetBytes(de).Int64()),
+ }
+ return rsa.VerifyPKCS1v15(pk, crypto.SHA256, hashedContent, sig)
+}
+
+func (v *Validator) rs256CertsURL() string {
+ if v.rs256URL == "" {
+ return googleSACertsURL
+ }
+ return v.rs256URL
+}
+
+func (v *Validator) validateES256(ctx context.Context, keyID string, hashedContent []byte, sig []byte) error {
+ certResp, err := v.client.getCert(ctx, v.es256CertsURL())
+ if err != nil {
+ return err
+ }
+ j, err := findMatchingKey(certResp, keyID)
+ if err != nil {
+ return err
+ }
+ dx, err := decode(j.X)
+ if err != nil {
+ return err
+ }
+ dy, err := decode(j.Y)
+ if err != nil {
+ return err
+ }
+
+ pk := &ecdsa.PublicKey{
+ Curve: elliptic.P256(),
+ X: new(big.Int).SetBytes(dx),
+ Y: new(big.Int).SetBytes(dy),
+ }
+ r := big.NewInt(0).SetBytes(sig[:es256KeySize])
+ s := big.NewInt(0).SetBytes(sig[es256KeySize:])
+ if valid := ecdsa.Verify(pk, hashedContent, r, s); !valid {
+ return fmt.Errorf("idtoken: ES256 signature not valid")
+ }
+ return nil
+}
+
+func (v *Validator) es256CertsURL() string {
+ if v.es256URL == "" {
+ return googleIAPCertsURL
+ }
+ return v.es256URL
+}
+
+func findMatchingKey(response *certResponse, keyID string) (*jwk, error) {
+ if response == nil {
+ return nil, fmt.Errorf("idtoken: cert response is nil")
+ }
+ for _, v := range response.Keys {
+ if v.Kid == keyID {
+ return &v, nil
+ }
+ }
+ return nil, fmt.Errorf("idtoken: could not find matching cert keyId for the token provided")
+}
+
+func parseToken(idToken string) (*jwt.Header, *Payload, []byte, error) {
+ segments := strings.Split(idToken, ".")
+ if len(segments) != 3 {
+ return nil, nil, nil, fmt.Errorf("idtoken: invalid token, token must have three segments; found %d", len(segments))
+ }
+ // Header
+ dh, err := decode(segments[0])
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to decode JWT header: %v", err)
+ }
+ var header *jwt.Header
+ err = json.Unmarshal(dh, &header)
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to unmarshal JWT header: %v", err)
+ }
+
+ // Payload
+ dp, err := decode(segments[1])
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to decode JWT claims: %v", err)
+ }
+ var payload *Payload
+ if err := json.Unmarshal(dp, &payload); err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to unmarshal JWT payload: %v", err)
+ }
+ if err := json.Unmarshal(dp, &payload.Claims); err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to unmarshal JWT payload claims: %v", err)
+ }
+
+ // Signature
+ signature, err := decode(segments[2])
+ if err != nil {
+ return nil, nil, nil, fmt.Errorf("idtoken: unable to decode JWT signature: %v", err)
+ }
+ return header, payload, signature, nil
+}
+
+// hashHeaderPayload gets the SHA256 checksum for verification of the JWT.
+func hashHeaderPayload(idtoken string) []byte {
+ // remove the sig from the token
+ content := idtoken[:strings.LastIndex(idtoken, ".")]
+ hashed := sha256.Sum256([]byte(content))
+ return hashed[:]
+}
+
+func decode(s string) ([]byte, error) {
+ return base64.RawURLEncoding.DecodeString(s)
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/impersonate/doc.go b/vendor/cloud.google.com/go/auth/credentials/impersonate/doc.go
new file mode 100644
index 0000000..0dc45f1
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/impersonate/doc.go
@@ -0,0 +1,45 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Package impersonate is used to impersonate Google Credentials. If you need
+// to impersonate some credentials to use with a client library see
+// [NewCredentials]. If instead you would like to create an Open
+// Connect ID token using impersonation see [NewIDTokenCredentials].
+//
+// # Required IAM roles
+//
+// In order to impersonate a service account the base service account must have
+// the Service Account Token Creator role, roles/iam.serviceAccountTokenCreator,
+// on the service account being impersonated. See
+// https://cloud.google.com/iam/docs/understanding-service-accounts.
+//
+// Optionally, delegates can be used during impersonation if the base service
+// account lacks the token creator role on the target. When using delegates,
+// each service account must be granted roles/iam.serviceAccountTokenCreator
+// on the next service account in the delgation chain.
+//
+// For example, if a base service account of SA1 is trying to impersonate target
+// service account SA2 while using delegate service accounts DSA1 and DSA2,
+// the following must be true:
+//
+// 1. Base service account SA1 has roles/iam.serviceAccountTokenCreator on
+// DSA1.
+// 2. DSA1 has roles/iam.serviceAccountTokenCreator on DSA2.
+// 3. DSA2 has roles/iam.serviceAccountTokenCreator on target SA2.
+//
+// If the base credential is an authorized user and not a service account, or if
+// the option WithQuotaProject is set, the target service account must have a
+// role that grants the serviceusage.services.use permission such as
+// roles/serviceusage.serviceUsageConsumer.
+package impersonate
diff --git a/vendor/cloud.google.com/go/auth/credentials/impersonate/idtoken.go b/vendor/cloud.google.com/go/auth/credentials/impersonate/idtoken.go
new file mode 100644
index 0000000..6c47082
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/impersonate/idtoken.go
@@ -0,0 +1,141 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package impersonate
+
+import (
+ "errors"
+ "log/slog"
+ "net/http"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials"
+ "cloud.google.com/go/auth/credentials/internal/impersonate"
+ "cloud.google.com/go/auth/httptransport"
+ "cloud.google.com/go/auth/internal"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+// IDTokenOptions for generating an impersonated ID token.
+type IDTokenOptions struct {
+ // Audience is the `aud` field for the token, such as an API endpoint the
+ // token will grant access to. Required.
+ Audience string
+ // TargetPrincipal is the email address of the service account to
+ // impersonate. Required.
+ TargetPrincipal string
+ // IncludeEmail includes the target service account's email in the token.
+ // The resulting token will include both an `email` and `email_verified`
+ // claim. Optional.
+ IncludeEmail bool
+ // Delegates are the ordered service account email addresses in a delegation
+ // chain. Each service account must be granted
+ // roles/iam.serviceAccountTokenCreator on the next service account in the
+ // chain. Optional.
+ Delegates []string
+
+ // Credentials used in generating the impersonated ID token. If empty, an
+ // attempt will be made to detect credentials from the environment (see
+ // [cloud.google.com/go/auth/credentials.DetectDefault]). Optional.
+ Credentials *auth.Credentials
+ // Client configures the underlying client used to make network requests
+ // when fetching tokens. If provided this should be a fully-authenticated
+ // client. Optional.
+ Client *http.Client
+ // UniverseDomain is the default service domain for a given Cloud universe.
+ // The default value is "googleapis.com". This is the universe domain
+ // configured for the client, which will be compared to the universe domain
+ // that is separately configured for the credentials. Optional.
+ UniverseDomain string
+ // Logger is used for debug logging. If provided, logging will be enabled
+ // at the loggers configured level. By default logging is disabled unless
+ // enabled by setting GOOGLE_SDK_GO_LOGGING_LEVEL in which case a default
+ // logger will be used. Optional.
+ Logger *slog.Logger
+}
+
+func (o *IDTokenOptions) validate() error {
+ if o == nil {
+ return errors.New("impersonate: options must be provided")
+ }
+ if o.Audience == "" {
+ return errors.New("impersonate: audience must be provided")
+ }
+ if o.TargetPrincipal == "" {
+ return errors.New("impersonate: target service account must be provided")
+ }
+ return nil
+}
+
+var (
+ defaultScope = "https://www.googleapis.com/auth/cloud-platform"
+)
+
+// NewIDTokenCredentials creates an impersonated
+// [cloud.google.com/go/auth/Credentials] that returns ID tokens configured
+// with the provided config and using credentials loaded from Application
+// Default Credentials as the base credentials if not provided with the opts.
+// The tokens produced are valid for one hour and are automatically refreshed.
+func NewIDTokenCredentials(opts *IDTokenOptions) (*auth.Credentials, error) {
+ if err := opts.validate(); err != nil {
+ return nil, err
+ }
+ client := opts.Client
+ creds := opts.Credentials
+ logger := internallog.New(opts.Logger)
+ if client == nil {
+ var err error
+ if creds == nil {
+ creds, err = credentials.DetectDefault(&credentials.DetectOptions{
+ Scopes: []string{defaultScope},
+ UseSelfSignedJWT: true,
+ Logger: logger,
+ })
+ if err != nil {
+ return nil, err
+ }
+ }
+ client, err = httptransport.NewClient(&httptransport.Options{
+ Credentials: creds,
+ UniverseDomain: opts.UniverseDomain,
+ Logger: logger,
+ })
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ universeDomainProvider := resolveUniverseDomainProvider(creds)
+ var delegates []string
+ for _, v := range opts.Delegates {
+ delegates = append(delegates, internal.FormatIAMServiceAccountResource(v))
+ }
+
+ iamOpts := impersonate.IDTokenIAMOptions{
+ Client: client,
+ Logger: logger,
+ // Pass the credentials universe domain provider to configure the endpoint.
+ UniverseDomain: universeDomainProvider,
+ ServiceAccountEmail: opts.TargetPrincipal,
+ GenerateIDTokenRequest: impersonate.GenerateIDTokenRequest{
+ Audience: opts.Audience,
+ IncludeEmail: opts.IncludeEmail,
+ Delegates: delegates,
+ },
+ }
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: auth.NewCachedTokenProvider(iamOpts, nil),
+ UniverseDomainProvider: universeDomainProvider,
+ }), nil
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/impersonate/impersonate.go b/vendor/cloud.google.com/go/auth/credentials/impersonate/impersonate.go
new file mode 100644
index 0000000..7d8efd5
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/impersonate/impersonate.go
@@ -0,0 +1,284 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package impersonate
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "log/slog"
+ "net/http"
+ "strings"
+ "time"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials"
+ "cloud.google.com/go/auth/httptransport"
+ "cloud.google.com/go/auth/internal"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+var (
+ universeDomainPlaceholder = "UNIVERSE_DOMAIN"
+ iamCredentialsUniverseDomainEndpoint = "https://iamcredentials.UNIVERSE_DOMAIN"
+ oauth2Endpoint = "https://oauth2.googleapis.com"
+ errMissingTargetPrincipal = errors.New("impersonate: target service account must be provided")
+ errMissingScopes = errors.New("impersonate: scopes must be provided")
+ errLifetimeOverMax = errors.New("impersonate: max lifetime is 12 hours")
+ errUniverseNotSupportedDomainWideDelegation = errors.New("impersonate: service account user is configured for the credential. " +
+ "Domain-wide delegation is not supported in universes other than googleapis.com")
+)
+
+// TODO(codyoss): plumb through base for this and idtoken
+
+// NewCredentials returns an impersonated
+// [cloud.google.com/go/auth/NewCredentials] configured with the provided options
+// and using credentials loaded from Application Default Credentials as the base
+// credentials if not provided with the opts.
+func NewCredentials(opts *CredentialsOptions) (*auth.Credentials, error) {
+ if err := opts.validate(); err != nil {
+ return nil, err
+ }
+
+ var isStaticToken bool
+ // Default to the longest acceptable value of one hour as the token will
+ // be refreshed automatically if not set.
+ lifetime := 1 * time.Hour
+ if opts.Lifetime != 0 {
+ lifetime = opts.Lifetime
+ // Don't auto-refresh token if a lifetime is configured.
+ isStaticToken = true
+ }
+
+ client := opts.Client
+ creds := opts.Credentials
+ logger := internallog.New(opts.Logger)
+ if client == nil {
+ var err error
+ if creds == nil {
+ creds, err = credentials.DetectDefault(&credentials.DetectOptions{
+ Scopes: []string{defaultScope},
+ UseSelfSignedJWT: true,
+ Logger: logger,
+ })
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ client, err = httptransport.NewClient(transportOpts(opts, creds, logger))
+ if err != nil {
+ return nil, err
+ }
+ }
+
+ universeDomainProvider := resolveUniverseDomainProvider(creds)
+ // If a subject is specified a domain-wide delegation auth-flow is initiated
+ // to impersonate as the provided subject (user).
+ if opts.Subject != "" {
+ tp, err := user(opts, client, lifetime, isStaticToken, universeDomainProvider)
+ if err != nil {
+ return nil, err
+ }
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: tp,
+ UniverseDomainProvider: universeDomainProvider,
+ }), nil
+ }
+
+ its := impersonatedTokenProvider{
+ client: client,
+ targetPrincipal: opts.TargetPrincipal,
+ lifetime: fmt.Sprintf("%.fs", lifetime.Seconds()),
+ universeDomainProvider: universeDomainProvider,
+ logger: logger,
+ }
+ for _, v := range opts.Delegates {
+ its.delegates = append(its.delegates, internal.FormatIAMServiceAccountResource(v))
+ }
+ its.scopes = make([]string, len(opts.Scopes))
+ copy(its.scopes, opts.Scopes)
+
+ var tpo *auth.CachedTokenProviderOptions
+ if isStaticToken {
+ tpo = &auth.CachedTokenProviderOptions{
+ DisableAutoRefresh: true,
+ }
+ }
+
+ return auth.NewCredentials(&auth.CredentialsOptions{
+ TokenProvider: auth.NewCachedTokenProvider(its, tpo),
+ UniverseDomainProvider: universeDomainProvider,
+ }), nil
+}
+
+// transportOpts returns options for httptransport.NewClient. If opts.UniverseDomain
+// is provided, it will be used in the transport for a validation ensuring that it
+// matches the universe domain in the base credentials. If opts.UniverseDomain
+// is not provided, this validation will be skipped.
+func transportOpts(opts *CredentialsOptions, creds *auth.Credentials, logger *slog.Logger) *httptransport.Options {
+ tOpts := &httptransport.Options{
+ Credentials: creds,
+ Logger: logger,
+ }
+ if opts.UniverseDomain == "" {
+ tOpts.InternalOptions = &httptransport.InternalOptions{
+ SkipUniverseDomainValidation: true,
+ }
+ } else {
+ tOpts.UniverseDomain = opts.UniverseDomain
+ }
+ return tOpts
+}
+
+// resolveUniverseDomainProvider returns the default service domain for a given
+// Cloud universe. This is the universe domain configured for the credentials,
+// which will be used in endpoint(s), and compared to the universe domain that
+// is separately configured for the client.
+func resolveUniverseDomainProvider(creds *auth.Credentials) auth.CredentialsPropertyProvider {
+ if creds != nil {
+ return auth.CredentialsPropertyFunc(creds.UniverseDomain)
+ }
+ return internal.StaticCredentialsProperty(internal.DefaultUniverseDomain)
+}
+
+// CredentialsOptions for generating an impersonated credential token.
+type CredentialsOptions struct {
+ // TargetPrincipal is the email address of the service account to
+ // impersonate. Required.
+ TargetPrincipal string
+ // Scopes that the impersonated credential should have. Required.
+ Scopes []string
+ // Delegates are the service account email addresses in a delegation chain.
+ // Each service account must be granted roles/iam.serviceAccountTokenCreator
+ // on the next service account in the chain. Optional.
+ Delegates []string
+ // Lifetime is the amount of time until the impersonated token expires. If
+ // unset the token's lifetime will be one hour and be automatically
+ // refreshed. If set the token may have a max lifetime of one hour and will
+ // not be refreshed. Service accounts that have been added to an org policy
+ // with constraints/iam.allowServiceAccountCredentialLifetimeExtension may
+ // request a token lifetime of up to 12 hours. Optional.
+ Lifetime time.Duration
+ // Subject is the sub field of a JWT. This field should only be set if you
+ // wish to impersonate as a user. This feature is useful when using domain
+ // wide delegation. Optional.
+ Subject string
+
+ // Credentials used in generating the impersonated token. If empty, an
+ // attempt will be made to detect credentials from the environment (see
+ // [cloud.google.com/go/auth/credentials.DetectDefault]). Optional.
+ Credentials *auth.Credentials
+ // Client configures the underlying client used to make network requests
+ // when fetching tokens. If provided this should be a fully-authenticated
+ // client. Optional.
+ Client *http.Client
+ // UniverseDomain is the default service domain for a given Cloud universe.
+ // This field has no default value, and only if provided will it be used to
+ // verify the universe domain from the credentials. Optional.
+ UniverseDomain string
+ // Logger is used for debug logging. If provided, logging will be enabled
+ // at the loggers configured level. By default logging is disabled unless
+ // enabled by setting GOOGLE_SDK_GO_LOGGING_LEVEL in which case a default
+ // logger will be used. Optional.
+ Logger *slog.Logger
+}
+
+func (o *CredentialsOptions) validate() error {
+ if o == nil {
+ return errors.New("impersonate: options must be provided")
+ }
+ if o.TargetPrincipal == "" {
+ return errMissingTargetPrincipal
+ }
+ if len(o.Scopes) == 0 {
+ return errMissingScopes
+ }
+ if o.Lifetime.Hours() > 12 {
+ return errLifetimeOverMax
+ }
+ return nil
+}
+
+type generateAccessTokenRequest struct {
+ Delegates []string `json:"delegates,omitempty"`
+ Lifetime string `json:"lifetime,omitempty"`
+ Scope []string `json:"scope,omitempty"`
+}
+
+type generateAccessTokenResponse struct {
+ AccessToken string `json:"accessToken"`
+ ExpireTime string `json:"expireTime"`
+}
+
+type impersonatedTokenProvider struct {
+ client *http.Client
+ // universeDomain is used for endpoint construction.
+ universeDomainProvider auth.CredentialsPropertyProvider
+ logger *slog.Logger
+
+ targetPrincipal string
+ lifetime string
+ scopes []string
+ delegates []string
+}
+
+// Token returns an impersonated Token.
+func (i impersonatedTokenProvider) Token(ctx context.Context) (*auth.Token, error) {
+ reqBody := generateAccessTokenRequest{
+ Delegates: i.delegates,
+ Lifetime: i.lifetime,
+ Scope: i.scopes,
+ }
+ b, err := json.Marshal(reqBody)
+ if err != nil {
+ return nil, fmt.Errorf("impersonate: unable to marshal request: %w", err)
+ }
+ universeDomain, err := i.universeDomainProvider.GetProperty(ctx)
+ if err != nil {
+ return nil, err
+ }
+ endpoint := strings.Replace(iamCredentialsUniverseDomainEndpoint, universeDomainPlaceholder, universeDomain, 1)
+ url := fmt.Sprintf("%s/v1/%s:generateAccessToken", endpoint, internal.FormatIAMServiceAccountResource(i.targetPrincipal))
+ req, err := http.NewRequestWithContext(ctx, "POST", url, bytes.NewReader(b))
+ if err != nil {
+ return nil, fmt.Errorf("impersonate: unable to create request: %w", err)
+ }
+ req.Header.Set("Content-Type", "application/json")
+ i.logger.DebugContext(ctx, "impersonated token request", "request", internallog.HTTPRequest(req, b))
+ resp, body, err := internal.DoRequest(i.client, req)
+ if err != nil {
+ return nil, fmt.Errorf("impersonate: unable to generate access token: %w", err)
+ }
+ i.logger.DebugContext(ctx, "impersonated token response", "response", internallog.HTTPResponse(resp, body))
+ if c := resp.StatusCode; c < 200 || c > 299 {
+ return nil, fmt.Errorf("impersonate: status code %d: %s", c, body)
+ }
+
+ var accessTokenResp generateAccessTokenResponse
+ if err := json.Unmarshal(body, &accessTokenResp); err != nil {
+ return nil, fmt.Errorf("impersonate: unable to parse response: %w", err)
+ }
+ expiry, err := time.Parse(time.RFC3339, accessTokenResp.ExpireTime)
+ if err != nil {
+ return nil, fmt.Errorf("impersonate: unable to parse expiry: %w", err)
+ }
+ return &auth.Token{
+ Value: accessTokenResp.AccessToken,
+ Expiry: expiry,
+ }, nil
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/impersonate/user.go b/vendor/cloud.google.com/go/auth/credentials/impersonate/user.go
new file mode 100644
index 0000000..432427f
--- /dev/null
+++ b/vendor/cloud.google.com/go/auth/credentials/impersonate/user.go
@@ -0,0 +1,203 @@
+// Copyright 2023 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package impersonate
+
+import (
+ "bytes"
+ "context"
+ "encoding/json"
+ "errors"
+ "fmt"
+ "log/slog"
+ "net/http"
+ "net/url"
+ "strings"
+ "time"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/internal"
+ "github.com/googleapis/gax-go/v2/internallog"
+)
+
+var (
+ iamCredentialsEndpoint = "https://iamcredentials.googleapis.com"
+)
+
+// user provides an auth flow for domain-wide delegation, setting
+// CredentialsConfig.Subject to be the impersonated user.
+func user(opts *CredentialsOptions, client *http.Client, lifetime time.Duration, isStaticToken bool, universeDomainProvider auth.CredentialsPropertyProvider) (auth.TokenProvider, error) {
+ if opts.Subject == "" {
+ return nil, errors.New("CredentialsConfig.Subject must not be empty")
+ }
+ u := userTokenProvider{
+ client: client,
+ targetPrincipal: opts.TargetPrincipal,
+ subject: opts.Subject,
+ lifetime: lifetime,
+ universeDomainProvider: universeDomainProvider,
+ logger: internallog.New(opts.Logger),
+ }
+ u.delegates = make([]string, len(opts.Delegates))
+ for i, v := range opts.Delegates {
+ u.delegates[i] = internal.FormatIAMServiceAccountResource(v)
+ }
+ u.scopes = make([]string, len(opts.Scopes))
+ copy(u.scopes, opts.Scopes)
+ var tpo *auth.CachedTokenProviderOptions
+ if isStaticToken {
+ tpo = &auth.CachedTokenProviderOptions{
+ DisableAutoRefresh: true,
+ }
+ }
+ return auth.NewCachedTokenProvider(u, tpo), nil
+}
+
+type claimSet struct {
+ Iss string `json:"iss"`
+ Scope string `json:"scope,omitempty"`
+ Sub string `json:"sub,omitempty"`
+ Aud string `json:"aud"`
+ Iat int64 `json:"iat"`
+ Exp int64 `json:"exp"`
+}
+
+type signJWTRequest struct {
+ Payload string `json:"payload"`
+ Delegates []string `json:"delegates,omitempty"`
+}
+
+type signJWTResponse struct {
+ // KeyID is the key used to sign the JWT.
+ KeyID string `json:"keyId"`
+ // SignedJwt contains the automatically generated header; the
+ // client-supplied payload; and the signature, which is generated using
+ // the key referenced by the `kid` field in the header.
+ SignedJWT string `json:"signedJwt"`
+}
+
+type exchangeTokenResponse struct {
+ AccessToken string `json:"access_token"`
+ TokenType string `json:"token_type"`
+ ExpiresIn int64 `json:"expires_in"`
+}
+
+type userTokenProvider struct {
+ client *http.Client
+ logger *slog.Logger
+
+ targetPrincipal string
+ subject string
+ scopes []string
+ lifetime time.Duration
+ delegates []string
+ universeDomainProvider auth.CredentialsPropertyProvider
+}
+
+func (u userTokenProvider) Token(ctx context.Context) (*auth.Token, error) {
+ // Because a subject is specified a domain-wide delegation auth-flow is initiated
+ // to impersonate as the provided subject (user).
+ // Return error if users try to use domain-wide delegation in a non-GDU universe.
+ ud, err := u.universeDomainProvider.GetProperty(ctx)
+ if err != nil {
+ return nil, err
+ }
+ if ud != internal.DefaultUniverseDomain {
+ return nil, errUniverseNotSupportedDomainWideDelegation
+ }
+ signedJWT, err := u.signJWT(ctx)
+ if err != nil {
+ return nil, err
+ }
+ return u.exchangeToken(ctx, signedJWT)
+}
+
+func (u userTokenProvider) signJWT(ctx context.Context) (string, error) {
+ now := time.Now()
+ exp := now.Add(u.lifetime)
+ claims := claimSet{
+ Iss: u.targetPrincipal,
+ Scope: strings.Join(u.scopes, " "),
+ Sub: u.subject,
+ Aud: fmt.Sprintf("%s/token", oauth2Endpoint),
+ Iat: now.Unix(),
+ Exp: exp.Unix(),
+ }
+ payloadBytes, err := json.Marshal(claims)
+ if err != nil {
+ return "", fmt.Errorf("impersonate: unable to marshal claims: %w", err)
+ }
+ signJWTReq := signJWTRequest{
+ Payload: string(payloadBytes),
+ Delegates: u.delegates,
+ }
+
+ bodyBytes, err := json.Marshal(signJWTReq)
+ if err != nil {
+ return "", fmt.Errorf("impersonate: unable to marshal request: %w", err)
+ }
+ reqURL := fmt.Sprintf("%s/v1/%s:signJwt", iamCredentialsEndpoint, internal.FormatIAMServiceAccountResource(u.targetPrincipal))
+ req, err := http.NewRequestWithContext(ctx, "POST", reqURL, bytes.NewReader(bodyBytes))
+ if err != nil {
+ return "", fmt.Errorf("impersonate: unable to create request: %w", err)
+ }
+ req.Header.Set("Content-Type", "application/json")
+ u.logger.DebugContext(ctx, "impersonated user sign JWT request", "request", internallog.HTTPRequest(req, bodyBytes))
+ resp, body, err := internal.DoRequest(u.client, req)
+ if err != nil {
+ return "", fmt.Errorf("impersonate: unable to sign JWT: %w", err)
+ }
+ u.logger.DebugContext(ctx, "impersonated user sign JWT response", "response", internallog.HTTPResponse(resp, body))
+ if c := resp.StatusCode; c < 200 || c > 299 {
+ return "", fmt.Errorf("impersonate: status code %d: %s", c, body)
+ }
+
+ var signJWTResp signJWTResponse
+ if err := json.Unmarshal(body, &signJWTResp); err != nil {
+ return "", fmt.Errorf("impersonate: unable to parse response: %w", err)
+ }
+ return signJWTResp.SignedJWT, nil
+}
+
+func (u userTokenProvider) exchangeToken(ctx context.Context, signedJWT string) (*auth.Token, error) {
+ v := url.Values{}
+ v.Set("grant_type", "assertion")
+ v.Set("assertion_type", "http://oauth.net/grant_type/jwt/1.0/bearer")
+ v.Set("assertion", signedJWT)
+ req, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("%s/token", oauth2Endpoint), strings.NewReader(v.Encode()))
+ if err != nil {
+ return nil, err
+ }
+ req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
+ u.logger.DebugContext(ctx, "impersonated user token exchange request", "request", internallog.HTTPRequest(req, []byte(v.Encode())))
+ resp, body, err := internal.DoRequest(u.client, req)
+ if err != nil {
+ return nil, fmt.Errorf("impersonate: unable to exchange token: %w", err)
+ }
+ u.logger.DebugContext(ctx, "impersonated user token exchange response", "response", internallog.HTTPResponse(resp, body))
+ if c := resp.StatusCode; c < 200 || c > 299 {
+ return nil, fmt.Errorf("impersonate: status code %d: %s", c, body)
+ }
+
+ var tokenResp exchangeTokenResponse
+ if err := json.Unmarshal(body, &tokenResp); err != nil {
+ return nil, fmt.Errorf("impersonate: unable to parse response: %w", err)
+ }
+
+ return &auth.Token{
+ Value: tokenResp.AccessToken,
+ Type: tokenResp.TokenType,
+ Expiry: time.Now().Add(time.Second * time.Duration(tokenResp.ExpiresIn)),
+ }, nil
+}
diff --git a/vendor/cloud.google.com/go/auth/credentials/internal/gdch/gdch.go b/vendor/cloud.google.com/go/auth/credentials/internal/gdch/gdch.go
index c2d320f..19a2051 100644
--- a/vendor/cloud.google.com/go/auth/credentials/internal/gdch/gdch.go
+++ b/vendor/cloud.google.com/go/auth/credentials/internal/gdch/gdch.go
@@ -15,6 +15,7 @@
package gdch
import (
+ "bytes"
"context"
"crypto"
"crypto/tls"
@@ -24,9 +25,7 @@
"fmt"
"log/slog"
"net/http"
- "net/url"
"os"
- "strings"
"time"
"cloud.google.com/go/auth"
@@ -121,27 +120,34 @@
Exp: exp.Unix(),
}
h := jwt.Header{
- Algorithm: jwt.HeaderAlgRSA256,
+ Algorithm: jwt.HeaderAlgES256,
Type: jwt.HeaderType,
- KeyID: string(g.pkID),
+ KeyID: g.pkID,
}
payload, err := jwt.EncodeJWS(&h, &claims, g.signer)
if err != nil {
return nil, err
}
- v := url.Values{}
- v.Set("grant_type", GrantType)
- v.Set("audience", g.aud)
- v.Set("requested_token_type", requestTokenType)
- v.Set("subject_token", payload)
- v.Set("subject_token_type", subjectTokenType)
- req, err := http.NewRequestWithContext(ctx, "POST", g.tokenURL, strings.NewReader(v.Encode()))
+ v := map[string]string{
+ "grant_type": GrantType,
+ "audience": g.aud,
+ "requested_token_type": requestTokenType,
+ "subject_token": payload,
+ "subject_token_type": subjectTokenType,
+ }
+
+ r, err := json.Marshal(v)
+ if err != nil {
+ return nil, fmt.Errorf("credentials: cannot marshal token request: %w", err)
+ }
+
+ req, err := http.NewRequestWithContext(ctx, "POST", g.tokenURL, bytes.NewReader(r))
if err != nil {
return nil, err
}
- req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
- g.logger.DebugContext(ctx, "gdch token request", "request", internallog.HTTPRequest(req, []byte(v.Encode())))
+ req.Header.Set("Content-Type", "application/json")
+ g.logger.DebugContext(ctx, "gdch token request", "request", internallog.HTTPRequest(req, r))
resp, body, err := internal.DoRequest(g.client, req)
if err != nil {
return nil, fmt.Errorf("credentials: cannot fetch token: %w", err)
@@ -188,4 +194,5 @@
trans.TLSClientConfig = &tls.Config{
RootCAs: certPool,
}
+ hc.Transport = trans
}
diff --git a/vendor/cloud.google.com/go/auth/internal/jwt/jwt.go b/vendor/cloud.google.com/go/auth/internal/jwt/jwt.go
index 9bd55f5..027c0da 100644
--- a/vendor/cloud.google.com/go/auth/internal/jwt/jwt.go
+++ b/vendor/cloud.google.com/go/auth/internal/jwt/jwt.go
@@ -17,13 +17,16 @@
import (
"bytes"
"crypto"
+ "crypto/ecdsa"
"crypto/rand"
"crypto/rsa"
"crypto/sha256"
+ "encoding/asn1"
"encoding/base64"
"encoding/json"
"errors"
"fmt"
+ "math/big"
"strings"
"time"
)
@@ -35,6 +38,8 @@
HeaderAlgES256 = "ES256"
// HeaderType is the standard [Header.Type].
HeaderType = "JWT"
+ // ES256 key size
+ es256KeySize = 32
)
// Header represents a JWT header.
@@ -127,6 +132,22 @@
if err != nil {
return "", err
}
+
+ if header.Algorithm == HeaderAlgES256 {
+ var ecSig struct {
+ R, S *big.Int
+ }
+ if _, err := asn1.Unmarshal(sig, &ecSig); err != nil {
+ return "", err
+ }
+
+ rawSig := make([]byte, es256KeySize*2)
+
+ ecSig.R.FillBytes(rawSig[:es256KeySize])
+ ecSig.S.FillBytes(rawSig[es256KeySize:])
+
+ sig = rawSig
+ }
return fmt.Sprintf("%s.%s", ss, base64.RawURLEncoding.EncodeToString(sig)), nil
}
@@ -153,7 +174,7 @@
// VerifyJWS tests whether the provided JWT token's signature was produced by
// the private key associated with the provided public key.
-func VerifyJWS(token string, key *rsa.PublicKey) error {
+func VerifyJWS(token string, key crypto.PublicKey) error {
parts := strings.Split(token, ".")
if len(parts) != 3 {
return errors.New("jwt: invalid token received, token must have 3 parts")
@@ -167,5 +188,21 @@
h := sha256.New()
h.Write([]byte(signedContent))
- return rsa.VerifyPKCS1v15(key, crypto.SHA256, h.Sum(nil), signatureString)
+ hashed := h.Sum(nil)
+
+ switch pub := key.(type) {
+ case *rsa.PublicKey:
+ return rsa.VerifyPKCS1v15(pub, crypto.SHA256, hashed, signatureString)
+ case *ecdsa.PublicKey:
+ if len(signatureString) != 2*32 {
+ return fmt.Errorf("jwt: ecdsa signature size should be 64 bytes, got %d", len(signatureString))
+ }
+ r := new(big.Int).SetBytes(signatureString[:32])
+ s := new(big.Int).SetBytes(signatureString[32:])
+ if !ecdsa.Verify(pub, hashed, r, s) {
+ return errors.New("jwt: ecdsa signature verification failed")
+ }
+ return nil
+ }
+ return fmt.Errorf("jwt: unsupported public key type: %T", key)
}
diff --git a/vendor/cloud.google.com/go/auth/internal/version.go b/vendor/cloud.google.com/go/auth/internal/version.go
index ec7f21a..b730086 100644
--- a/vendor/cloud.google.com/go/auth/internal/version.go
+++ b/vendor/cloud.google.com/go/auth/internal/version.go
@@ -17,4 +17,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "0.18.1"
+const Version = "0.18.2"
diff --git a/vendor/cloud.google.com/go/longrunning/CHANGES.md b/vendor/cloud.google.com/go/longrunning/CHANGES.md
index 06de6fd..8f4b645 100644
--- a/vendor/cloud.google.com/go/longrunning/CHANGES.md
+++ b/vendor/cloud.google.com/go/longrunning/CHANGES.md
@@ -1,5 +1,11 @@
# Changes
+## [0.8.0](https://github.com/googleapis/google-cloud-go/releases/tag/longrunning%2Fv0.8.0) (2026-01-08)
+
+### Bug Fixes
+
+* upgrade gRPC service registration func An update to Go gRPC Protobuf generation will change service registration function signatures to use an interface instead of a concrete type in generated .pb.go service files. This change should affect very few client library users. See release notes advisories in https://github.com/googleapis/google-cloud-go/pull/11025. ([185951b](https://github.com/googleapis/google-cloud-go/commit/185951b3bea9fb942979e81ce248ccdebb40d94b))
+
## [0.7.0](https://github.com/googleapis/google-cloud-go/releases/tag/longrunning%2Fv0.7.0) (2025-10-14)
### Features
diff --git a/vendor/cloud.google.com/go/longrunning/autogen/.repo-metadata.json b/vendor/cloud.google.com/go/longrunning/autogen/.repo-metadata.json
new file mode 100644
index 0000000..23ee6e6
--- /dev/null
+++ b/vendor/cloud.google.com/go/longrunning/autogen/.repo-metadata.json
@@ -0,0 +1,10 @@
+{
+ "api_shortname": "longrunning",
+ "client_documentation": "https://cloud.google.com/go/docs/reference/cloud.google.com/go/longrunning/latest/autogen",
+ "client_library_type": "generated",
+ "description": "Long Running Operations API",
+ "distribution_name": "cloud.google.com/go/longrunning/autogen",
+ "language": "go",
+ "library_type": "GAPIC_AUTO",
+ "release_level": "stable"
+}
diff --git a/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations.pb.go b/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations.pb.go
index 036d8e3..cc84c0f 100644
--- a/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations.pb.go
+++ b/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations.pb.go
@@ -21,15 +21,11 @@
package longrunningpb
import (
- context "context"
reflect "reflect"
sync "sync"
_ "google.golang.org/genproto/googleapis/api/annotations"
status "google.golang.org/genproto/googleapis/rpc/status"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status1 "google.golang.org/grpc/status"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
@@ -862,285 +858,3 @@
file_google_longrunning_operations_proto_goTypes = nil
file_google_longrunning_operations_proto_depIdxs = nil
}
-
-// Reference imports to suppress errors if they are not otherwise used.
-var _ context.Context
-var _ grpc.ClientConnInterface
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-const _ = grpc.SupportPackageIsVersion6
-
-// OperationsClient is the client API for Operations service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.
-type OperationsClient interface {
- // Lists operations that match the specified filter in the request. If the
- // server doesn't support this method, it returns `UNIMPLEMENTED`.
- ListOperations(ctx context.Context, in *ListOperationsRequest, opts ...grpc.CallOption) (*ListOperationsResponse, error)
- // Gets the latest state of a long-running operation. Clients can use this
- // method to poll the operation result at intervals as recommended by the API
- // service.
- GetOperation(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
- // Deletes a long-running operation. This method indicates that the client is
- // no longer interested in the operation result. It does not cancel the
- // operation. If the server doesn't support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`.
- DeleteOperation(ctx context.Context, in *DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
- // Starts asynchronous cancellation on a long-running operation. The server
- // makes a best effort to cancel the operation, but success is not
- // guaranteed. If the server doesn't support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`. Clients can use
- // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
- // other methods to check whether the cancellation succeeded or whether the
- // operation completed despite cancellation. On successful cancellation,
- // the operation is not deleted; instead, it becomes an operation with
- // an [Operation.error][google.longrunning.Operation.error] value with a
- // [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
- // `Code.CANCELLED`.
- CancelOperation(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
- // Waits until the specified long-running operation is done or reaches at most
- // a specified timeout, returning the latest state. If the operation is
- // already done, the latest state is immediately returned. If the timeout
- // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
- // timeout is used. If the server does not support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`.
- // Note that this method is on a best-effort basis. It may return the latest
- // state before the specified timeout (including immediately), meaning even an
- // immediate response is no guarantee that the operation is done.
- WaitOperation(ctx context.Context, in *WaitOperationRequest, opts ...grpc.CallOption) (*Operation, error)
-}
-
-type operationsClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewOperationsClient(cc grpc.ClientConnInterface) OperationsClient {
- return &operationsClient{cc}
-}
-
-func (c *operationsClient) ListOperations(ctx context.Context, in *ListOperationsRequest, opts ...grpc.CallOption) (*ListOperationsResponse, error) {
- out := new(ListOperationsResponse)
- err := c.cc.Invoke(ctx, "/google.longrunning.Operations/ListOperations", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *operationsClient) GetOperation(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
- out := new(Operation)
- err := c.cc.Invoke(ctx, "/google.longrunning.Operations/GetOperation", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *operationsClient) DeleteOperation(ctx context.Context, in *DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, "/google.longrunning.Operations/DeleteOperation", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *operationsClient) CancelOperation(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
- out := new(emptypb.Empty)
- err := c.cc.Invoke(ctx, "/google.longrunning.Operations/CancelOperation", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *operationsClient) WaitOperation(ctx context.Context, in *WaitOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
- out := new(Operation)
- err := c.cc.Invoke(ctx, "/google.longrunning.Operations/WaitOperation", in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// OperationsServer is the server API for Operations service.
-type OperationsServer interface {
- // Lists operations that match the specified filter in the request. If the
- // server doesn't support this method, it returns `UNIMPLEMENTED`.
- ListOperations(context.Context, *ListOperationsRequest) (*ListOperationsResponse, error)
- // Gets the latest state of a long-running operation. Clients can use this
- // method to poll the operation result at intervals as recommended by the API
- // service.
- GetOperation(context.Context, *GetOperationRequest) (*Operation, error)
- // Deletes a long-running operation. This method indicates that the client is
- // no longer interested in the operation result. It does not cancel the
- // operation. If the server doesn't support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`.
- DeleteOperation(context.Context, *DeleteOperationRequest) (*emptypb.Empty, error)
- // Starts asynchronous cancellation on a long-running operation. The server
- // makes a best effort to cancel the operation, but success is not
- // guaranteed. If the server doesn't support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`. Clients can use
- // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
- // other methods to check whether the cancellation succeeded or whether the
- // operation completed despite cancellation. On successful cancellation,
- // the operation is not deleted; instead, it becomes an operation with
- // an [Operation.error][google.longrunning.Operation.error] value with a
- // [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
- // `Code.CANCELLED`.
- CancelOperation(context.Context, *CancelOperationRequest) (*emptypb.Empty, error)
- // Waits until the specified long-running operation is done or reaches at most
- // a specified timeout, returning the latest state. If the operation is
- // already done, the latest state is immediately returned. If the timeout
- // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
- // timeout is used. If the server does not support this method, it returns
- // `google.rpc.Code.UNIMPLEMENTED`.
- // Note that this method is on a best-effort basis. It may return the latest
- // state before the specified timeout (including immediately), meaning even an
- // immediate response is no guarantee that the operation is done.
- WaitOperation(context.Context, *WaitOperationRequest) (*Operation, error)
-}
-
-// UnimplementedOperationsServer can be embedded to have forward compatible implementations.
-type UnimplementedOperationsServer struct {
-}
-
-func (*UnimplementedOperationsServer) ListOperations(context.Context, *ListOperationsRequest) (*ListOperationsResponse, error) {
- return nil, status1.Errorf(codes.Unimplemented, "method ListOperations not implemented")
-}
-func (*UnimplementedOperationsServer) GetOperation(context.Context, *GetOperationRequest) (*Operation, error) {
- return nil, status1.Errorf(codes.Unimplemented, "method GetOperation not implemented")
-}
-func (*UnimplementedOperationsServer) DeleteOperation(context.Context, *DeleteOperationRequest) (*emptypb.Empty, error) {
- return nil, status1.Errorf(codes.Unimplemented, "method DeleteOperation not implemented")
-}
-func (*UnimplementedOperationsServer) CancelOperation(context.Context, *CancelOperationRequest) (*emptypb.Empty, error) {
- return nil, status1.Errorf(codes.Unimplemented, "method CancelOperation not implemented")
-}
-func (*UnimplementedOperationsServer) WaitOperation(context.Context, *WaitOperationRequest) (*Operation, error) {
- return nil, status1.Errorf(codes.Unimplemented, "method WaitOperation not implemented")
-}
-
-func RegisterOperationsServer(s *grpc.Server, srv OperationsServer) {
- s.RegisterService(&_Operations_serviceDesc, srv)
-}
-
-func _Operations_ListOperations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(ListOperationsRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(OperationsServer).ListOperations(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/google.longrunning.Operations/ListOperations",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(OperationsServer).ListOperations(ctx, req.(*ListOperationsRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Operations_GetOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(GetOperationRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(OperationsServer).GetOperation(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/google.longrunning.Operations/GetOperation",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(OperationsServer).GetOperation(ctx, req.(*GetOperationRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Operations_DeleteOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(DeleteOperationRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(OperationsServer).DeleteOperation(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/google.longrunning.Operations/DeleteOperation",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(OperationsServer).DeleteOperation(ctx, req.(*DeleteOperationRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Operations_CancelOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CancelOperationRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(OperationsServer).CancelOperation(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/google.longrunning.Operations/CancelOperation",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(OperationsServer).CancelOperation(ctx, req.(*CancelOperationRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _Operations_WaitOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(WaitOperationRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(OperationsServer).WaitOperation(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: "/google.longrunning.Operations/WaitOperation",
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(OperationsServer).WaitOperation(ctx, req.(*WaitOperationRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-var _Operations_serviceDesc = grpc.ServiceDesc{
- ServiceName: "google.longrunning.Operations",
- HandlerType: (*OperationsServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "ListOperations",
- Handler: _Operations_ListOperations_Handler,
- },
- {
- MethodName: "GetOperation",
- Handler: _Operations_GetOperation_Handler,
- },
- {
- MethodName: "DeleteOperation",
- Handler: _Operations_DeleteOperation_Handler,
- },
- {
- MethodName: "CancelOperation",
- Handler: _Operations_CancelOperation_Handler,
- },
- {
- MethodName: "WaitOperation",
- Handler: _Operations_WaitOperation_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "google/longrunning/operations.proto",
-}
diff --git a/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations_grpc.pb.go b/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations_grpc.pb.go
new file mode 100644
index 0000000..2b6407e
--- /dev/null
+++ b/vendor/cloud.google.com/go/longrunning/autogen/longrunningpb/operations_grpc.pb.go
@@ -0,0 +1,329 @@
+// Copyright 2025 Google LLC
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.3.0
+// - protoc v4.25.7
+// source: google/longrunning/operations.proto
+
+package longrunningpb
+
+import (
+ context "context"
+
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+ emptypb "google.golang.org/protobuf/types/known/emptypb"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+const (
+ Operations_ListOperations_FullMethodName = "/google.longrunning.Operations/ListOperations"
+ Operations_GetOperation_FullMethodName = "/google.longrunning.Operations/GetOperation"
+ Operations_DeleteOperation_FullMethodName = "/google.longrunning.Operations/DeleteOperation"
+ Operations_CancelOperation_FullMethodName = "/google.longrunning.Operations/CancelOperation"
+ Operations_WaitOperation_FullMethodName = "/google.longrunning.Operations/WaitOperation"
+)
+
+// OperationsClient is the client API for Operations service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type OperationsClient interface {
+ // Lists operations that match the specified filter in the request. If the
+ // server doesn't support this method, it returns `UNIMPLEMENTED`.
+ ListOperations(ctx context.Context, in *ListOperationsRequest, opts ...grpc.CallOption) (*ListOperationsResponse, error)
+ // Gets the latest state of a long-running operation. Clients can use this
+ // method to poll the operation result at intervals as recommended by the API
+ // service.
+ GetOperation(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error)
+ // Deletes a long-running operation. This method indicates that the client is
+ // no longer interested in the operation result. It does not cancel the
+ // operation. If the server doesn't support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`.
+ DeleteOperation(ctx context.Context, in *DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+ // Starts asynchronous cancellation on a long-running operation. The server
+ // makes a best effort to cancel the operation, but success is not
+ // guaranteed. If the server doesn't support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`. Clients can use
+ // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
+ // other methods to check whether the cancellation succeeded or whether the
+ // operation completed despite cancellation. On successful cancellation,
+ // the operation is not deleted; instead, it becomes an operation with
+ // an [Operation.error][google.longrunning.Operation.error] value with a
+ // [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
+ // `Code.CANCELLED`.
+ CancelOperation(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error)
+ // Waits until the specified long-running operation is done or reaches at most
+ // a specified timeout, returning the latest state. If the operation is
+ // already done, the latest state is immediately returned. If the timeout
+ // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
+ // timeout is used. If the server does not support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`.
+ // Note that this method is on a best-effort basis. It may return the latest
+ // state before the specified timeout (including immediately), meaning even an
+ // immediate response is no guarantee that the operation is done.
+ WaitOperation(ctx context.Context, in *WaitOperationRequest, opts ...grpc.CallOption) (*Operation, error)
+}
+
+type operationsClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewOperationsClient(cc grpc.ClientConnInterface) OperationsClient {
+ return &operationsClient{cc}
+}
+
+func (c *operationsClient) ListOperations(ctx context.Context, in *ListOperationsRequest, opts ...grpc.CallOption) (*ListOperationsResponse, error) {
+ out := new(ListOperationsResponse)
+ err := c.cc.Invoke(ctx, Operations_ListOperations_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *operationsClient) GetOperation(ctx context.Context, in *GetOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
+ out := new(Operation)
+ err := c.cc.Invoke(ctx, Operations_GetOperation_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *operationsClient) DeleteOperation(ctx context.Context, in *DeleteOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, Operations_DeleteOperation_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *operationsClient) CancelOperation(ctx context.Context, in *CancelOperationRequest, opts ...grpc.CallOption) (*emptypb.Empty, error) {
+ out := new(emptypb.Empty)
+ err := c.cc.Invoke(ctx, Operations_CancelOperation_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *operationsClient) WaitOperation(ctx context.Context, in *WaitOperationRequest, opts ...grpc.CallOption) (*Operation, error) {
+ out := new(Operation)
+ err := c.cc.Invoke(ctx, Operations_WaitOperation_FullMethodName, in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// OperationsServer is the server API for Operations service.
+// All implementations should embed UnimplementedOperationsServer
+// for forward compatibility
+type OperationsServer interface {
+ // Lists operations that match the specified filter in the request. If the
+ // server doesn't support this method, it returns `UNIMPLEMENTED`.
+ ListOperations(context.Context, *ListOperationsRequest) (*ListOperationsResponse, error)
+ // Gets the latest state of a long-running operation. Clients can use this
+ // method to poll the operation result at intervals as recommended by the API
+ // service.
+ GetOperation(context.Context, *GetOperationRequest) (*Operation, error)
+ // Deletes a long-running operation. This method indicates that the client is
+ // no longer interested in the operation result. It does not cancel the
+ // operation. If the server doesn't support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`.
+ DeleteOperation(context.Context, *DeleteOperationRequest) (*emptypb.Empty, error)
+ // Starts asynchronous cancellation on a long-running operation. The server
+ // makes a best effort to cancel the operation, but success is not
+ // guaranteed. If the server doesn't support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`. Clients can use
+ // [Operations.GetOperation][google.longrunning.Operations.GetOperation] or
+ // other methods to check whether the cancellation succeeded or whether the
+ // operation completed despite cancellation. On successful cancellation,
+ // the operation is not deleted; instead, it becomes an operation with
+ // an [Operation.error][google.longrunning.Operation.error] value with a
+ // [google.rpc.Status.code][google.rpc.Status.code] of `1`, corresponding to
+ // `Code.CANCELLED`.
+ CancelOperation(context.Context, *CancelOperationRequest) (*emptypb.Empty, error)
+ // Waits until the specified long-running operation is done or reaches at most
+ // a specified timeout, returning the latest state. If the operation is
+ // already done, the latest state is immediately returned. If the timeout
+ // specified is greater than the default HTTP/RPC timeout, the HTTP/RPC
+ // timeout is used. If the server does not support this method, it returns
+ // `google.rpc.Code.UNIMPLEMENTED`.
+ // Note that this method is on a best-effort basis. It may return the latest
+ // state before the specified timeout (including immediately), meaning even an
+ // immediate response is no guarantee that the operation is done.
+ WaitOperation(context.Context, *WaitOperationRequest) (*Operation, error)
+}
+
+// UnimplementedOperationsServer should be embedded to have forward compatible implementations.
+type UnimplementedOperationsServer struct {
+}
+
+func (UnimplementedOperationsServer) ListOperations(context.Context, *ListOperationsRequest) (*ListOperationsResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method ListOperations not implemented")
+}
+func (UnimplementedOperationsServer) GetOperation(context.Context, *GetOperationRequest) (*Operation, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetOperation not implemented")
+}
+func (UnimplementedOperationsServer) DeleteOperation(context.Context, *DeleteOperationRequest) (*emptypb.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method DeleteOperation not implemented")
+}
+func (UnimplementedOperationsServer) CancelOperation(context.Context, *CancelOperationRequest) (*emptypb.Empty, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method CancelOperation not implemented")
+}
+func (UnimplementedOperationsServer) WaitOperation(context.Context, *WaitOperationRequest) (*Operation, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method WaitOperation not implemented")
+}
+
+// UnsafeOperationsServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to OperationsServer will
+// result in compilation errors.
+type UnsafeOperationsServer interface {
+ mustEmbedUnimplementedOperationsServer()
+}
+
+func RegisterOperationsServer(s grpc.ServiceRegistrar, srv OperationsServer) {
+ s.RegisterService(&Operations_ServiceDesc, srv)
+}
+
+func _Operations_ListOperations_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(ListOperationsRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OperationsServer).ListOperations(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Operations_ListOperations_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OperationsServer).ListOperations(ctx, req.(*ListOperationsRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Operations_GetOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(GetOperationRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OperationsServer).GetOperation(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Operations_GetOperation_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OperationsServer).GetOperation(ctx, req.(*GetOperationRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Operations_DeleteOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(DeleteOperationRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OperationsServer).DeleteOperation(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Operations_DeleteOperation_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OperationsServer).DeleteOperation(ctx, req.(*DeleteOperationRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Operations_CancelOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CancelOperationRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OperationsServer).CancelOperation(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Operations_CancelOperation_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OperationsServer).CancelOperation(ctx, req.(*CancelOperationRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _Operations_WaitOperation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(WaitOperationRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(OperationsServer).WaitOperation(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: Operations_WaitOperation_FullMethodName,
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(OperationsServer).WaitOperation(ctx, req.(*WaitOperationRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// Operations_ServiceDesc is the grpc.ServiceDesc for Operations service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var Operations_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "google.longrunning.Operations",
+ HandlerType: (*OperationsServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "ListOperations",
+ Handler: _Operations_ListOperations_Handler,
+ },
+ {
+ MethodName: "GetOperation",
+ Handler: _Operations_GetOperation_Handler,
+ },
+ {
+ MethodName: "DeleteOperation",
+ Handler: _Operations_DeleteOperation_Handler,
+ },
+ {
+ MethodName: "CancelOperation",
+ Handler: _Operations_CancelOperation_Handler,
+ },
+ {
+ MethodName: "WaitOperation",
+ Handler: _Operations_WaitOperation_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "google/longrunning/operations.proto",
+}
diff --git a/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go b/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go
index 13ea291..c445784 100644
--- a/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go
+++ b/vendor/cloud.google.com/go/longrunning/autogen/operations_client.go
@@ -581,6 +581,9 @@
if req.GetPageToken() != "" {
params.Add("pageToken", fmt.Sprintf("%v", req.GetPageToken()))
}
+ if req.GetReturnPartialSuccess() {
+ params.Add("returnPartialSuccess", fmt.Sprintf("%v", req.GetReturnPartialSuccess()))
+ }
baseUrl.RawQuery = params.Encode()
diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.go
new file mode 100644
index 0000000..f296b4d
--- /dev/null
+++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.go
@@ -0,0 +1,146 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.36.10
+// protoc v6.33.2
+// source: envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto
+
+package http_11_proxyv3
+
+import (
+ _ "github.com/cncf/xds/go/udpa/annotations"
+ v3 "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+ unsafe "unsafe"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+// HTTP/1.1 proxy transport socket establishes an upstream connection to a proxy address
+// instead of the target host's address. This behavior is triggered when the transport
+// socket is configured and proxy information is provided.
+//
+// Behavior when proxying:
+// =======================
+// When an upstream connection is established, instead of connecting directly to the endpoint
+// address, the client will connect to the specified proxy address, send an HTTP/1.1 “CONNECT“ request
+// indicating the endpoint address, and process the response. If the response has HTTP status 200,
+// the connection will be passed down to the underlying transport socket.
+//
+// Configuring proxy information:
+// ==============================
+// Set “typed_filter_metadata“ in :ref:`LbEndpoint.Metadata <envoy_v3_api_field_config.endpoint.v3.lbendpoint.metadata>` or :ref:`LocalityLbEndpoints.Metadata <envoy_v3_api_field_config.endpoint.v3.LocalityLbEndpoints.metadata>`.
+// using the key “envoy.http11_proxy_transport_socket.proxy_address“ and the
+// proxy address in “config::core::v3::Address“ format.
+type Http11ProxyUpstreamTransport struct {
+ state protoimpl.MessageState `protogen:"open.v1"`
+ // The underlying transport socket being wrapped. Defaults to plaintext (raw_buffer) if unset.
+ TransportSocket *v3.TransportSocket `protobuf:"bytes,1,opt,name=transport_socket,json=transportSocket,proto3" json:"transport_socket,omitempty"`
+ unknownFields protoimpl.UnknownFields
+ sizeCache protoimpl.SizeCache
+}
+
+func (x *Http11ProxyUpstreamTransport) Reset() {
+ *x = Http11ProxyUpstreamTransport{}
+ mi := &file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+}
+
+func (x *Http11ProxyUpstreamTransport) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Http11ProxyUpstreamTransport) ProtoMessage() {}
+
+func (x *Http11ProxyUpstreamTransport) ProtoReflect() protoreflect.Message {
+ mi := &file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_msgTypes[0]
+ if x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Http11ProxyUpstreamTransport.ProtoReflect.Descriptor instead.
+func (*Http11ProxyUpstreamTransport) Descriptor() ([]byte, []int) {
+ return file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Http11ProxyUpstreamTransport) GetTransportSocket() *v3.TransportSocket {
+ if x != nil {
+ return x.TransportSocket
+ }
+ return nil
+}
+
+var File_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto protoreflect.FileDescriptor
+
+const file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDesc = "" +
+ "\n" +
+ "Renvoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto\x123envoy.extensions.transport_sockets.http_11_proxy.v3\x1a\x1fenvoy/config/core/v3/base.proto\x1a\x1dudpa/annotations/status.proto\"p\n" +
+ "\x1cHttp11ProxyUpstreamTransport\x12P\n" +
+ "\x10transport_socket\x18\x01 \x01(\v2%.envoy.config.core.v3.TransportSocketR\x0ftransportSocketB\xd5\x01\xba\x80\xc8\xd1\x06\x02\x10\x02\n" +
+ "Aio.envoyproxy.envoy.extensions.transport_sockets.http_11_proxy.v3B\x1aUpstreamHttp11ConnectProtoP\x01Zjgithub.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3;http_11_proxyv3b\x06proto3"
+
+var (
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescOnce sync.Once
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescData []byte
+)
+
+func file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescGZIP() []byte {
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescOnce.Do(func() {
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescData = protoimpl.X.CompressGZIP(unsafe.Slice(unsafe.StringData(file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDesc), len(file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDesc)))
+ })
+ return file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDescData
+}
+
+var file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
+var file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_goTypes = []any{
+ (*Http11ProxyUpstreamTransport)(nil), // 0: envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport
+ (*v3.TransportSocket)(nil), // 1: envoy.config.core.v3.TransportSocket
+}
+var file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_depIdxs = []int32{
+ 1, // 0: envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport.transport_socket:type_name -> envoy.config.core.v3.TransportSocket
+ 1, // [1:1] is the sub-list for method output_type
+ 1, // [1:1] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() {
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_init()
+}
+func file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_init() {
+ if File_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto != nil {
+ return
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: unsafe.Slice(unsafe.StringData(file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDesc), len(file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_rawDesc)),
+ NumEnums: 0,
+ NumMessages: 1,
+ NumExtensions: 0,
+ NumServices: 0,
+ },
+ GoTypes: file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_goTypes,
+ DependencyIndexes: file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_depIdxs,
+ MessageInfos: file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_msgTypes,
+ }.Build()
+ File_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto = out.File
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_goTypes = nil
+ file_envoy_extensions_transport_sockets_http_11_proxy_v3_upstream_http_11_connect_proto_depIdxs = nil
+}
diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.validate.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.validate.go
new file mode 100644
index 0000000..a825cd5
--- /dev/null
+++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.pb.validate.go
@@ -0,0 +1,169 @@
+//go:build !disable_pgv
+// Code generated by protoc-gen-validate. DO NOT EDIT.
+// source: envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto
+
+package http_11_proxyv3
+
+import (
+ "bytes"
+ "errors"
+ "fmt"
+ "net"
+ "net/mail"
+ "net/url"
+ "regexp"
+ "sort"
+ "strings"
+ "time"
+ "unicode/utf8"
+
+ "google.golang.org/protobuf/types/known/anypb"
+)
+
+// ensure the imports are used
+var (
+ _ = bytes.MinRead
+ _ = errors.New("")
+ _ = fmt.Print
+ _ = utf8.UTFMax
+ _ = (*regexp.Regexp)(nil)
+ _ = (*strings.Reader)(nil)
+ _ = net.IPv4len
+ _ = time.Duration(0)
+ _ = (*url.URL)(nil)
+ _ = (*mail.Address)(nil)
+ _ = anypb.Any{}
+ _ = sort.Sort
+)
+
+// Validate checks the field values on Http11ProxyUpstreamTransport with the
+// rules defined in the proto definition for this message. If any rules are
+// violated, the first error encountered is returned, or nil if there are no violations.
+func (m *Http11ProxyUpstreamTransport) Validate() error {
+ return m.validate(false)
+}
+
+// ValidateAll checks the field values on Http11ProxyUpstreamTransport with the
+// rules defined in the proto definition for this message. If any rules are
+// violated, the result is a list of violation errors wrapped in
+// Http11ProxyUpstreamTransportMultiError, or nil if none found.
+func (m *Http11ProxyUpstreamTransport) ValidateAll() error {
+ return m.validate(true)
+}
+
+func (m *Http11ProxyUpstreamTransport) validate(all bool) error {
+ if m == nil {
+ return nil
+ }
+
+ var errors []error
+
+ if all {
+ switch v := interface{}(m.GetTransportSocket()).(type) {
+ case interface{ ValidateAll() error }:
+ if err := v.ValidateAll(); err != nil {
+ errors = append(errors, Http11ProxyUpstreamTransportValidationError{
+ field: "TransportSocket",
+ reason: "embedded message failed validation",
+ cause: err,
+ })
+ }
+ case interface{ Validate() error }:
+ if err := v.Validate(); err != nil {
+ errors = append(errors, Http11ProxyUpstreamTransportValidationError{
+ field: "TransportSocket",
+ reason: "embedded message failed validation",
+ cause: err,
+ })
+ }
+ }
+ } else if v, ok := interface{}(m.GetTransportSocket()).(interface{ Validate() error }); ok {
+ if err := v.Validate(); err != nil {
+ return Http11ProxyUpstreamTransportValidationError{
+ field: "TransportSocket",
+ reason: "embedded message failed validation",
+ cause: err,
+ }
+ }
+ }
+
+ if len(errors) > 0 {
+ return Http11ProxyUpstreamTransportMultiError(errors)
+ }
+
+ return nil
+}
+
+// Http11ProxyUpstreamTransportMultiError is an error wrapping multiple
+// validation errors returned by Http11ProxyUpstreamTransport.ValidateAll() if
+// the designated constraints aren't met.
+type Http11ProxyUpstreamTransportMultiError []error
+
+// Error returns a concatenation of all the error messages it wraps.
+func (m Http11ProxyUpstreamTransportMultiError) Error() string {
+ msgs := make([]string, 0, len(m))
+ for _, err := range m {
+ msgs = append(msgs, err.Error())
+ }
+ return strings.Join(msgs, "; ")
+}
+
+// AllErrors returns a list of validation violation errors.
+func (m Http11ProxyUpstreamTransportMultiError) AllErrors() []error { return m }
+
+// Http11ProxyUpstreamTransportValidationError is the validation error returned
+// by Http11ProxyUpstreamTransport.Validate if the designated constraints
+// aren't met.
+type Http11ProxyUpstreamTransportValidationError struct {
+ field string
+ reason string
+ cause error
+ key bool
+}
+
+// Field function returns field value.
+func (e Http11ProxyUpstreamTransportValidationError) Field() string { return e.field }
+
+// Reason function returns reason value.
+func (e Http11ProxyUpstreamTransportValidationError) Reason() string { return e.reason }
+
+// Cause function returns cause value.
+func (e Http11ProxyUpstreamTransportValidationError) Cause() error { return e.cause }
+
+// Key function returns key value.
+func (e Http11ProxyUpstreamTransportValidationError) Key() bool { return e.key }
+
+// ErrorName returns error name.
+func (e Http11ProxyUpstreamTransportValidationError) ErrorName() string {
+ return "Http11ProxyUpstreamTransportValidationError"
+}
+
+// Error satisfies the builtin error interface
+func (e Http11ProxyUpstreamTransportValidationError) Error() string {
+ cause := ""
+ if e.cause != nil {
+ cause = fmt.Sprintf(" | caused by: %v", e.cause)
+ }
+
+ key := ""
+ if e.key {
+ key = "key for "
+ }
+
+ return fmt.Sprintf(
+ "invalid %sHttp11ProxyUpstreamTransport.%s: %s%s",
+ key,
+ e.field,
+ e.reason,
+ cause)
+}
+
+var _ error = Http11ProxyUpstreamTransportValidationError{}
+
+var _ interface {
+ Field() string
+ Reason() string
+ Key() bool
+ Cause() error
+ ErrorName() string
+} = Http11ProxyUpstreamTransportValidationError{}
diff --git a/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect_vtproto.pb.go b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect_vtproto.pb.go
new file mode 100644
index 0000000..47df0d0
--- /dev/null
+++ b/vendor/github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect_vtproto.pb.go
@@ -0,0 +1,95 @@
+//go:build vtprotobuf
+// +build vtprotobuf
+
+// Code generated by protoc-gen-go-vtproto. DO NOT EDIT.
+// source: envoy/extensions/transport_sockets/http_11_proxy/v3/upstream_http_11_connect.proto
+
+package http_11_proxyv3
+
+import (
+ protohelpers "github.com/planetscale/vtprotobuf/protohelpers"
+ proto "google.golang.org/protobuf/proto"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+func (m *Http11ProxyUpstreamTransport) MarshalVTStrict() (dAtA []byte, err error) {
+ if m == nil {
+ return nil, nil
+ }
+ size := m.SizeVT()
+ dAtA = make([]byte, size)
+ n, err := m.MarshalToSizedBufferVTStrict(dAtA[:size])
+ if err != nil {
+ return nil, err
+ }
+ return dAtA[:n], nil
+}
+
+func (m *Http11ProxyUpstreamTransport) MarshalToVTStrict(dAtA []byte) (int, error) {
+ size := m.SizeVT()
+ return m.MarshalToSizedBufferVTStrict(dAtA[:size])
+}
+
+func (m *Http11ProxyUpstreamTransport) MarshalToSizedBufferVTStrict(dAtA []byte) (int, error) {
+ if m == nil {
+ return 0, nil
+ }
+ i := len(dAtA)
+ _ = i
+ var l int
+ _ = l
+ if m.unknownFields != nil {
+ i -= len(m.unknownFields)
+ copy(dAtA[i:], m.unknownFields)
+ }
+ if m.TransportSocket != nil {
+ if vtmsg, ok := interface{}(m.TransportSocket).(interface {
+ MarshalToSizedBufferVTStrict([]byte) (int, error)
+ }); ok {
+ size, err := vtmsg.MarshalToSizedBufferVTStrict(dAtA[:i])
+ if err != nil {
+ return 0, err
+ }
+ i -= size
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(size))
+ } else {
+ encoded, err := proto.Marshal(m.TransportSocket)
+ if err != nil {
+ return 0, err
+ }
+ i -= len(encoded)
+ copy(dAtA[i:], encoded)
+ i = protohelpers.EncodeVarint(dAtA, i, uint64(len(encoded)))
+ }
+ i--
+ dAtA[i] = 0xa
+ }
+ return len(dAtA) - i, nil
+}
+
+func (m *Http11ProxyUpstreamTransport) SizeVT() (n int) {
+ if m == nil {
+ return 0
+ }
+ var l int
+ _ = l
+ if m.TransportSocket != nil {
+ if size, ok := interface{}(m.TransportSocket).(interface {
+ SizeVT() int
+ }); ok {
+ l = size.SizeVT()
+ } else {
+ l = proto.Size(m.TransportSocket)
+ }
+ n += 1 + l + protohelpers.SizeOfVarint(uint64(l))
+ }
+ n += len(m.unknownFields)
+ return n
+}
diff --git a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md b/vendor/github.com/googleapis/gax-go/v2/CHANGES.md
index 2c3300e..ac3f57a 100644
--- a/vendor/github.com/googleapis/gax-go/v2/CHANGES.md
+++ b/vendor/github.com/googleapis/gax-go/v2/CHANGES.md
@@ -1,5 +1,11 @@
# Changes
+## [2.17.0](https://github.com/googleapis/google-cloud-go/releases/tag/v2.17.0) (2026-02-03)
+
+### Features
+
+* update Invoke to add retry count to context (#462) ([ea7096d](https://github.com/googleapis/google-cloud-go/commit/ea7096d50d665064dbfeffd7d93fa13d810ad4e4))
+
## [2.16.0](https://github.com/googleapis/google-cloud-go/releases/tag/v2.16.0) (2025-12-17)
### Features
diff --git a/vendor/github.com/googleapis/gax-go/v2/internal/version.go b/vendor/github.com/googleapis/gax-go/v2/internal/version.go
index fa0e100..c3c26b9 100644
--- a/vendor/github.com/googleapis/gax-go/v2/internal/version.go
+++ b/vendor/github.com/googleapis/gax-go/v2/internal/version.go
@@ -1,4 +1,4 @@
-// Copyright 2025 Google LLC
+// Copyright 2026 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@@ -17,4 +17,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "2.16.0"
+const Version = "2.17.0"
diff --git a/vendor/github.com/googleapis/gax-go/v2/invoke.go b/vendor/github.com/googleapis/gax-go/v2/invoke.go
index 721d1af..af1eebe 100644
--- a/vendor/github.com/googleapis/gax-go/v2/invoke.go
+++ b/vendor/github.com/googleapis/gax-go/v2/invoke.go
@@ -31,15 +31,26 @@
import (
"context"
+ "strconv"
"strings"
"time"
"github.com/googleapis/gax-go/v2/apierror"
+ "google.golang.org/grpc/metadata"
)
// APICall is a user defined call stub.
type APICall func(context.Context, CallSettings) error
+// withRetryCount returns a new context with the retry count appended to
+// gRPC metadata. The retry count is the number of retries that have been
+// attempted. On the initial request, retry count is 0.
+// On a second request (the first retry), retry count is 1.
+func withRetryCount(ctx context.Context, retryCount int) context.Context {
+ // Add to gRPC metadata so it's visible to StatsHandlers
+ return metadata.AppendToOutgoingContext(ctx, "gcp.grpc.resend_count", strconv.Itoa(retryCount))
+}
+
// Invoke calls the given APICall, performing retries as specified by opts, if
// any.
func Invoke(ctx context.Context, call APICall, opts ...CallOption) error {
@@ -78,8 +89,15 @@
ctx = c
}
+ retryCount := 0
+ // Feature gate: GOOGLE_SDK_GO_EXPERIMENTAL_TRACING=true
+ tracingEnabled := IsFeatureEnabled("TRACING")
for {
- err := call(ctx, settings)
+ ctxToUse := ctx
+ if tracingEnabled {
+ ctxToUse = withRetryCount(ctx, retryCount)
+ }
+ err := call(ctxToUse, settings)
if err == nil {
return nil
}
@@ -110,5 +128,6 @@
} else if err = sp(ctx, d); err != nil {
return err
}
+ retryCount++
}
}
diff --git a/vendor/google.golang.org/api/internal/version.go b/vendor/google.golang.org/api/internal/version.go
index 555ea2c..277a76f 100644
--- a/vendor/google.golang.org/api/internal/version.go
+++ b/vendor/google.golang.org/api/internal/version.go
@@ -5,4 +5,4 @@
package internal
// Version is the current tagged release of the library.
-const Version = "0.262.0"
+const Version = "0.264.0"
diff --git a/vendor/google.golang.org/grpc/clientconn.go b/vendor/google.golang.org/grpc/clientconn.go
index c4bca52..b27c7e8 100644
--- a/vendor/google.golang.org/grpc/clientconn.go
+++ b/vendor/google.golang.org/grpc/clientconn.go
@@ -24,12 +24,10 @@
"fmt"
"math"
"net/url"
- "os"
"slices"
"strings"
"sync"
"sync/atomic"
- "syscall"
"time"
"google.golang.org/grpc/balancer"
@@ -1573,26 +1571,13 @@
// to the provided transport.GoAwayInfo, as specified by gRFC A94:
// https://github.com/grpc/proposal/blob/master/A94-grpc-subchannel-disconnections-metrics.md
func disconnectErrorString(info transport.GoAwayInfo) string {
- err := info.Err
- var sysErr syscall.Errno
- switch {
- case info.Reason != transport.GoAwayInvalid:
+ if info.Reason != transport.GoAwayInvalid {
return fmt.Sprintf("GOAWAY %s", info.GoAwayCode.String())
- case err == nil:
- return "unknown"
- case errors.Is(err, context.Canceled):
- return "subchannel shutdown"
- case errors.Is(err, syscall.ECONNRESET):
- return "connection reset"
- case errors.Is(err, syscall.ETIMEDOUT), errors.Is(err, context.DeadlineExceeded), errors.Is(err, os.ErrDeadlineExceeded):
- return "connection timed out"
- case errors.Is(err, syscall.ECONNABORTED):
- return "connection aborted"
- case errors.As(err, &sysErr):
- return "socket error"
- default:
+ }
+ if info.Err == nil {
return "unknown"
}
+ return disconnectErrorLabel(info.Err)
}
// startHealthCheck starts the health checking stream (RPC) to watch the health
diff --git a/vendor/google.golang.org/grpc/clientconn_disconnect_reason_noplan9.go b/vendor/google.golang.org/grpc/clientconn_disconnect_reason_noplan9.go
new file mode 100644
index 0000000..f0fcd88
--- /dev/null
+++ b/vendor/google.golang.org/grpc/clientconn_disconnect_reason_noplan9.go
@@ -0,0 +1,48 @@
+//go:build !plan9
+
+/*
+ *
+ * Copyright 2026 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package grpc
+
+import (
+ "context"
+ "errors"
+ "os"
+ "syscall"
+)
+
+// disconnectErrorLabel returns the grpc.disconnect_error metric label for a
+// transport error, as specified by gRFC A94.
+func disconnectErrorLabel(err error) string {
+ var sysErr syscall.Errno
+ switch {
+ case errors.Is(err, context.Canceled):
+ return "subchannel shutdown"
+ case errors.Is(err, syscall.ECONNRESET):
+ return "connection reset"
+ case errors.Is(err, syscall.ETIMEDOUT), errors.Is(err, context.DeadlineExceeded), errors.Is(err, os.ErrDeadlineExceeded):
+ return "connection timed out"
+ case errors.Is(err, syscall.ECONNABORTED):
+ return "connection aborted"
+ case errors.As(err, &sysErr):
+ return "socket error"
+ default:
+ return "unknown"
+ }
+}
diff --git a/vendor/google.golang.org/grpc/clientconn_disconnect_reason_plan9.go b/vendor/google.golang.org/grpc/clientconn_disconnect_reason_plan9.go
new file mode 100644
index 0000000..930b126
--- /dev/null
+++ b/vendor/google.golang.org/grpc/clientconn_disconnect_reason_plan9.go
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright 2026 gRPC authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package grpc
+
+import (
+ "context"
+ "errors"
+ "os"
+)
+
+// disconnectErrorLabel returns the grpc.disconnect_error metric label for a
+// transport error, as specified by gRFC A94. syscall.Errno does not exist on
+// plan9, so only the portable classifications are available.
+func disconnectErrorLabel(err error) string {
+ switch {
+ case errors.Is(err, context.Canceled):
+ return "subchannel shutdown"
+ case errors.Is(err, context.DeadlineExceeded), errors.Is(err, os.ErrDeadlineExceeded):
+ return "connection timed out"
+ default:
+ return "unknown"
+ }
+}
diff --git a/vendor/google.golang.org/grpc/credentials/alts/internal/conn/record.go b/vendor/google.golang.org/grpc/credentials/alts/internal/conn/record.go
index 89bf226..022416b 100644
--- a/vendor/google.golang.org/grpc/credentials/alts/internal/conn/record.go
+++ b/vendor/google.golang.org/grpc/credentials/alts/internal/conn/record.go
@@ -257,6 +257,9 @@
}
// Now we have a complete frame, decrypted it.
msg := framedMsg[MsgLenFieldSize:]
+ if len(msg) < msgTypeFieldSize {
+ return nil, 0, fmt.Errorf("received frame with size %v which is shorter than message type field size %v", len(msg), msgTypeFieldSize)
+ }
msgType := binary.LittleEndian.Uint32(msg[:msgTypeFieldSize])
if msgType&0xff != altsRecordMsgType {
return nil, 0, fmt.Errorf("received frame with incorrect message type %v, expected lower byte %v",
diff --git a/vendor/google.golang.org/grpc/credentials/google/gcp_service_account_identity_credentials.go b/vendor/google.golang.org/grpc/credentials/google/gcp_service_account_identity_credentials.go
new file mode 100644
index 0000000..160ec81
--- /dev/null
+++ b/vendor/google.golang.org/grpc/credentials/google/gcp_service_account_identity_credentials.go
@@ -0,0 +1,278 @@
+/*
+*
+* Copyright 2026 gRPC authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+ */
+
+package google
+
+import (
+ "context"
+ "errors"
+ "fmt"
+ "sync"
+ "time"
+
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials/idtoken"
+ "cloud.google.com/go/compute/metadata"
+ "google.golang.org/grpc/codes"
+ "google.golang.org/grpc/credentials"
+ "google.golang.org/grpc/credentials/google/internal"
+ "google.golang.org/grpc/internal/backoff"
+ "google.golang.org/grpc/internal/transport"
+ "google.golang.org/grpc/status"
+)
+
+const (
+ // preemptiveRefresh is the window before a token's actual expiration during
+ // which the token is considered stale. Requests using a stale but still
+ // valid token will trigger a background asynchronous refresh. This avoids
+ // blocking the current RPC, preventing periodic latency spikes during token
+ // refresh.
+ preemptiveRefresh = 1 * time.Minute
+
+ // metadataTimeout is the timeout for the call to the metadata server to
+ // prevent the background token fetch from hanging indefinitely in case
+ // of connection issues.
+ metadataTimeout = 60 * time.Second
+)
+
+type gcpServiceAccountIdentityCallCreds struct {
+ // The following fields are initialized at creation time and are read-only
+ // after that.
+ ctx context.Context
+ audience string
+ creds *auth.Credentials
+ backoff backoff.Strategy
+
+ // The following fields are protected by mu.
+ mu sync.Mutex
+ token *auth.Token
+ tokenExpiry time.Time // timestamp after which the cached token is considered invalid
+ preemptiveTokenRefresh time.Time // timestamp after which background preemptive refresh is triggered
+ fetching chan struct{} // used to ensure a single in-progress background token fetch
+ nextRetryTime time.Time // timestamp after which we can attempt the next token fetch
+ retryAttempt int // consecutive fetch failure count used to compute backoff delay
+ lastErr error // cached error returned from the most recent token fetch attempt
+}
+
+func init() {
+ internal.BackoffStrategy = backoff.DefaultExponential
+ internal.NewIDTokenCredentials = func(opts *idtoken.Options) (*auth.Credentials, error) {
+ return idtoken.NewCredentials(opts)
+ }
+}
+
+// NewServiceAccountIdentityCredentials creates a PerRPCCredentials that
+// authenticates using a GCP Service Account Identity JWT token for the given
+// audience.
+//
+// This credential fetches the ID token from the GCE metadata server and is
+// only valid for use in environments running on GCP. The ctx and audience
+// parameters cannot be empty.
+//
+// The credentials object starts asynchronous background token fetches to
+// refresh expired tokens. The provided context propagates cancellation to
+// these background tasks. Users should not pass an RPC-scoped context here,
+// but rather a context that is valid for the entire lifetime of the
+// credentials and should cancel the context when they are done.
+//
+// # Experimental
+//
+// Notice: This API is EXPERIMENTAL and may be changed or removed in a
+// later release.
+func NewServiceAccountIdentityCredentials(ctx context.Context, audience string) (credentials.PerRPCCredentials, error) {
+ if ctx == nil {
+ return nil, fmt.Errorf("credentials: ctx cannot be nil")
+ }
+
+ if audience == "" {
+ return nil, fmt.Errorf("credentials: audience cannot be empty")
+ }
+
+ creds, err := internal.NewIDTokenCredentials(&idtoken.Options{Audience: audience})
+ if err != nil {
+ return nil, fmt.Errorf("credentials: failed to create ID token credentials: %v", err)
+ }
+
+ return &gcpServiceAccountIdentityCallCreds{
+ ctx: ctx,
+ audience: audience,
+ creds: creds,
+ backoff: internal.BackoffStrategy,
+ }, nil
+}
+
+// GetRequestMetadata gets the current request metadata, refreshing tokens if
+// required. This implementation follows the PerRPCCredentials interface.
+//
+// It guarantees that only one underlying token fetch will be executed
+// concurrently. If a valid token is cached, it is returned immediately. If
+// a fetch recently failed, the cached error is returned until the backoff
+// interval expires. Otherwise, it initiates a new token fetch or blocks
+// waiting for an already-in-progress fetch to complete.
+func (c *gcpServiceAccountIdentityCallCreds) GetRequestMetadata(ctx context.Context, _ ...string) (map[string]string, error) {
+ ri, _ := credentials.RequestInfoFromContext(ctx)
+ if err := credentials.CheckSecurityLevel(ri.AuthInfo, credentials.PrivacyAndIntegrity); err != nil {
+ return nil, fmt.Errorf("credentials: cannot send secure credentials on an insecure connection: %v", err)
+ }
+
+ if md, err := c.cachedRequestMetadata(true); md != nil || err != nil {
+ return md, err
+ }
+
+ c.mu.Lock()
+ // Now that we have the lock, did someone else finish the fetch while we
+ // were waiting for the lock?
+ md, err := c.cachedRequestMetadataLocked(false)
+ if md != nil || err != nil {
+ c.mu.Unlock()
+ return md, err
+ }
+
+ // If no one is fetching, start it.
+ if c.fetching == nil {
+ c.fetching = make(chan struct{})
+ go c.startFetch()
+ }
+ wait := c.fetching
+ c.mu.Unlock()
+
+ select {
+ case <-wait:
+ // Return the new cached result from the most recent fetch.
+ md, err := c.cachedRequestMetadata(false)
+ if md == nil && err == nil {
+ return nil, status.Error(codes.Unavailable, "credentials: fetched token is expired")
+ }
+ return md, err
+ case <-ctx.Done():
+ return nil, ctx.Err()
+ }
+}
+
+// cachedRequestMetadata handles its own locking for the "fast path".
+func (c *gcpServiceAccountIdentityCallCreds) cachedRequestMetadata(attemptPreemptiveRefresh bool) (map[string]string, error) {
+ c.mu.Lock()
+ defer c.mu.Unlock()
+ return c.cachedRequestMetadataLocked(attemptPreemptiveRefresh)
+}
+
+// cachedRequestMetadataLocked returns the cached token if it is valid, or nil
+// if it is not. If attemptPreemptiveRefresh is true, it will also trigger a
+// background refresh if the token is stale but still valid. It returns the
+// cached error if the last fetch failed and the backoff interval has not
+// expired.
+//
+// Returns (nil, nil) if the token is not valid and a new fetch is required. The
+// caller is responsible for initiating the fetch or waiting for an in-progress
+// fetch to complete.
+//
+// It must be called with mu locked.
+func (c *gcpServiceAccountIdentityCallCreds) cachedRequestMetadataLocked(attemptPreemptiveRefresh bool) (map[string]string, error) {
+ if c.token != nil && c.isTokenValidLocked() {
+ if attemptPreemptiveRefresh && c.isTokenStaleLocked() && c.fetching == nil {
+ c.fetching = make(chan struct{})
+ go c.startFetch()
+ }
+
+ return map[string]string{"authorization": "Bearer " + c.token.Value}, nil
+ }
+
+ if c.lastErr != nil && time.Now().Before(c.nextRetryTime) {
+ return nil, c.lastErr
+ }
+
+ return nil, nil
+}
+
+// RequireTransportSecurity indicates whether the credentials requires
+// transport security.
+func (c *gcpServiceAccountIdentityCallCreds) RequireTransportSecurity() bool {
+ return true
+}
+
+// isTokenStaleLocked checks if the token falls within the
+// preemptiveRefresh window. It must be called with mu locked.
+func (c *gcpServiceAccountIdentityCallCreds) isTokenStaleLocked() bool {
+ return c.preemptiveTokenRefresh.Before(time.Now())
+}
+
+// isTokenValidLocked checks if the token is not expired yet. It must be called
+// with mu locked.
+func (c *gcpServiceAccountIdentityCallCreds) isTokenValidLocked() bool {
+ return c.tokenExpiry.After(time.Now())
+}
+
+// startFetch initiates a token fetch and updates the credential
+// state upon completion.
+func (c *gcpServiceAccountIdentityCallCreds) startFetch() {
+ ctx, cancel := context.WithTimeout(c.ctx, metadataTimeout)
+ defer cancel()
+ token, err := c.creds.TokenProvider.Token(ctx)
+
+ c.mu.Lock()
+ defer c.mu.Unlock()
+
+ close(c.fetching)
+ c.fetching = nil
+ c.updateStateLocked(token, err)
+}
+
+// updateStateLocked updates the credentials local token cache and
+// backoff state based on the outcome of a background fetch attempt.
+//
+// If the fetch succeeded, the cached token is updated, and the backoff timers
+// and error are reset.
+//
+// If the fetch failed, backoff attempts are calculated and the error is mapped
+// to a gRPC status.
+// - If the HTTP request fails with a status that maps to gRPC UNAVAILABLE
+// according to HTTP to gRPC status code mappings, it returns UNAVAILABLE.
+// - All other HTTP error status codes map to UNAUTHENTICATED.
+// - Non-HTTP request failures are mapped to UNAVAILABLE.
+//
+// It must be called with mu locked.
+func (c *gcpServiceAccountIdentityCallCreds) updateStateLocked(token *auth.Token, err error) {
+ if err != nil {
+ var mappedErr error
+ var metadataErr *metadata.Error
+ if errors.As(err, &metadataErr) {
+ switch transport.HTTPStatusConvTab[metadataErr.Code] {
+ case codes.Unavailable:
+ mappedErr = status.Errorf(codes.Unavailable, "credentials: failed to fetch token from metadata server: %v", err)
+ default:
+ mappedErr = status.Errorf(codes.Unauthenticated, "credentials: failed to fetch token from metadata server: %v", err)
+ }
+ } else {
+ mappedErr = status.Errorf(codes.Unavailable, "credentials: failed to fetch ID token: %v", err)
+ }
+
+ c.lastErr = mappedErr
+ backoffDelay := c.backoff.Backoff(c.retryAttempt)
+ c.retryAttempt++
+ c.nextRetryTime = time.Now().Add(backoffDelay)
+ return
+ }
+ c.lastErr = nil
+ c.retryAttempt = 0
+ c.nextRetryTime = time.Time{}
+ c.token = token
+ // Per gRFC A83, the cached token is considered invalid 30 seconds before its
+ // actual expiration time to accommodate for clock skew.
+ c.tokenExpiry = token.Expiry.Add(-30 * time.Second)
+ c.preemptiveTokenRefresh = c.tokenExpiry.Add(-preemptiveRefresh)
+}
diff --git a/vendor/google.golang.org/grpc/credentials/google/internal/internal.go b/vendor/google.golang.org/grpc/credentials/google/internal/internal.go
new file mode 100644
index 0000000..9557d26
--- /dev/null
+++ b/vendor/google.golang.org/grpc/credentials/google/internal/internal.go
@@ -0,0 +1,35 @@
+/*
+*
+* Copyright 2026 gRPC authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+ */
+
+// Package internal contains functionality internal to the google package.
+package internal
+
+import (
+ "cloud.google.com/go/auth"
+ "cloud.google.com/go/auth/credentials/idtoken"
+ "google.golang.org/grpc/internal/backoff"
+)
+
+// The following variables are overridden in tests.
+var (
+ // BackoffStrategy is the backoff strategy to use when token fetch fails.
+ BackoffStrategy backoff.Strategy
+
+ // NewIDTokenCredentials builds idtoken credentials using specified options.
+ NewIDTokenCredentials func(opts *idtoken.Options) (*auth.Credentials, error)
+)
diff --git a/vendor/google.golang.org/grpc/internal/credentials/xds/handshake_info.go b/vendor/google.golang.org/grpc/internal/credentials/xds/handshake_info.go
index 637254e..404b9cc 100644
--- a/vendor/google.golang.org/grpc/internal/credentials/xds/handshake_info.go
+++ b/vendor/google.golang.org/grpc/internal/credentials/xds/handshake_info.go
@@ -210,6 +210,9 @@
func (hi *HandshakeInfo) buildVerifyFunc(km *certprovider.KeyMaterial, isClient bool, sni string) func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
return func(rawCerts [][]byte, _ [][]*x509.Certificate) error {
+ if len(rawCerts) == 0 {
+ return fmt.Errorf("xds: no peer certificates presented")
+ }
// Parse all raw certificates presented by the peer.
var certs []*x509.Certificate
for _, rc := range rawCerts {
diff --git a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
index 29d332e..3334481 100644
--- a/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
+++ b/vendor/google.golang.org/grpc/internal/envconfig/envconfig.go
@@ -150,8 +150,18 @@
// throttling limit if unforeseen issues arise, and it will be removed in a
// future release.
//
- // TODO: Remove this env var once v1.83.0 is release.
+ // TODO: Remove this env var once v1.83.0 is released.
ControlBufferThrottleLimit = uint64FromEnv("GRPC_GO_EXPERIMENTAL_CONTROL_BUFFER_THROTTLE_LIMIT", 100, 1, 10000)
+
+ // EnableReceiveBufferCompaction enables the compaction of data buffers
+ // to reduce the number of buffers in the receive buffer.
+ //
+ // This environment variable serves as an escape hatch to disable the
+ // feature if unforeseen issues arise, and it will be removed in a future
+ // release.
+ //
+ // TODO: Remove this env var once v1.85.0 is released.
+ EnableReceiveBufferCompaction = boolFromEnv("GRPC_GO_EXPERIMENTAL_ENABLE_RECEIVE_BUFFER_COMPACTION", true)
)
func boolFromEnv(envVar string, def bool) bool {
diff --git a/vendor/google.golang.org/grpc/internal/envconfig/xds.go b/vendor/google.golang.org/grpc/internal/envconfig/xds.go
index a2312f8..e4b6919 100644
--- a/vendor/google.golang.org/grpc/internal/envconfig/xds.go
+++ b/vendor/google.golang.org/grpc/internal/envconfig/xds.go
@@ -69,9 +69,8 @@
// https://github.com/grpc/proposal/blob/master/A87-mtls-spiffe-support.md
XDSSPIFFEEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_MTLS_SPIFFE", false)
- // XDSHTTPConnectEnabled is true if gRPC should parse custom Metadata
- // configuring use of an HTTP CONNECT proxy via xDS from cluster resources.
- // For more details, see:
+ // XDSHTTPConnectEnabled controls support for dynamic HTTP CONNECT proxying
+ // configured via the xDS control plane. For more details, see:
// https://github.com/grpc/proposal/blob/master/A86-xds-http-connect.md
XDSHTTPConnectEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_HTTP_CONNECT", false)
@@ -88,7 +87,7 @@
// XDSORCAToLRSPropEnabled controls whether ORCA metrics are explicitly
// filtered and prefix-propagated to the LRS server. For more details, see:
// https://github.com/grpc/proposal/blob/master/A85-lrs-custom-metrics-changes.md
- XDSORCAToLRSPropEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_ORCA_LRS_PROPAGATION", false)
+ XDSORCAToLRSPropEnabled = boolFromEnv("GRPC_EXPERIMENTAL_XDS_ORCA_LRS_PROPAGATION", true)
// XDSClientExtProcEnabled indicates whether ExtProc filter is enabled on
// the client side. For more details, see:
diff --git a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go
index 9b6d8a1..d4999fc 100644
--- a/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go
+++ b/vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go
@@ -20,10 +20,15 @@
import (
"context"
+ "errors"
"google.golang.org/grpc/internal/buffer"
)
+// ErrSerializerClosed is returned by ScheduleAndWait if the CallbackSerializer
+// was closed before the callback could be scheduled.
+var ErrSerializerClosed = errors.New("callback serializer is closed")
+
// CallbackSerializer provides a mechanism to schedule callbacks in a
// synchronized manner. It provides a FIFO guarantee on the order of execution
// of scheduled callbacks. New callbacks can be scheduled by invoking the
@@ -77,6 +82,27 @@
}
}
+// ScheduleAndWait schedules the provided callback function f to be executed in
+// the order it was added and blocks until f has run. If the context passed to
+// NewCallbackSerializer was canceled before this method is called, f is not run
+// and ScheduleAndWait returns ErrSerializerClosed.
+//
+// Callbacks are expected to honor the context when performing any blocking
+// operations, and should return early when the context is canceled.
+func (cs *CallbackSerializer) ScheduleAndWait(f func(ctx context.Context)) error {
+ done := make(chan struct{})
+ var err error
+ cs.ScheduleOr(func(ctx context.Context) {
+ f(ctx)
+ close(done)
+ }, func() {
+ err = ErrSerializerClosed
+ close(done)
+ })
+ <-done
+ return err
+}
+
func (cs *CallbackSerializer) run(ctx context.Context) {
defer close(cs.done)
diff --git a/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
index 2d83b2e..00aeca4 100644
--- a/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
+++ b/vendor/google.golang.org/grpc/internal/mem/buffer_pool.go
@@ -26,12 +26,26 @@
"slices"
"sort"
"sync"
+
+ "google.golang.org/grpc/internal"
)
const (
goPageSize = 4 * 1024 // 4KiB. N.B. this must be a power of 2.
)
+var (
+ // BufferPoolingThreshold is the minimum size of a buffer that can be pooled.
+ // This is used to determine whether to pool buffers or allocate them directly.
+ BufferPoolingThreshold = 1 << 10
+)
+
+func init() {
+ internal.SetBufferPoolingThresholdForTesting = func(threshold int) {
+ BufferPoolingThreshold = threshold
+ }
+}
+
var uintSize = bits.UintSize // use a variable for mocking during tests.
// bufferPool is a copy of the public bufferPool interface used to avoid
diff --git a/vendor/google.golang.org/grpc/internal/resolver/config_selector.go b/vendor/google.golang.org/grpc/internal/resolver/config_selector.go
index 6320e9b..238950b 100644
--- a/vendor/google.golang.org/grpc/internal/resolver/config_selector.go
+++ b/vendor/google.golang.org/grpc/internal/resolver/config_selector.go
@@ -24,7 +24,6 @@
"sync"
"google.golang.org/grpc/internal/serviceconfig"
- "google.golang.org/grpc/metadata"
"google.golang.org/grpc/resolver"
)
@@ -52,82 +51,7 @@
Context context.Context
MethodConfig serviceconfig.MethodConfig // configuration to use for this RPC
OnCommitted func() // Called when the RPC has been committed (retries no longer possible)
- Interceptor ClientInterceptor
-}
-
-// ClientStream is the same as grpc.ClientStream, but defined here for circular
-// dependency reasons.
-type ClientStream interface {
- // Header returns the header metadata received from the server if there
- // is any. It blocks if the metadata is not ready to read.
- Header() (metadata.MD, error)
- // Trailer returns the trailer metadata from the server, if there is any.
- // It must only be called after stream.CloseAndRecv has returned, or
- // stream.Recv has returned a non-nil error (including io.EOF).
- Trailer() metadata.MD
- // CloseSend closes the send direction of the stream. It closes the stream
- // when non-nil error is met. It is also not safe to call CloseSend
- // concurrently with SendMsg.
- CloseSend() error
- // Context returns the context for this stream.
- //
- // It should not be called until after Header or RecvMsg has returned. Once
- // called, subsequent client-side retries are disabled.
- Context() context.Context
- // SendMsg is generally called by generated code. On error, SendMsg aborts
- // the stream. If the error was generated by the client, the status is
- // returned directly; otherwise, io.EOF is returned and the status of
- // the stream may be discovered using RecvMsg.
- //
- // SendMsg blocks until:
- // - There is sufficient flow control to schedule m with the transport, or
- // - The stream is done, or
- // - The stream breaks.
- //
- // SendMsg does not wait until the message is received by the server. An
- // untimely stream closure may result in lost messages. To ensure delivery,
- // users should ensure the RPC completed successfully using RecvMsg.
- //
- // It is safe to have a goroutine calling SendMsg and another goroutine
- // calling RecvMsg on the same stream at the same time, but it is not safe
- // to call SendMsg on the same stream in different goroutines. It is also
- // not safe to call CloseSend concurrently with SendMsg.
- SendMsg(m any) error
- // RecvMsg blocks until it receives a message into m or the stream is
- // done. It returns io.EOF when the stream completes successfully. On
- // any other error, the stream is aborted and the error contains the RPC
- // status.
- //
- // It is safe to have a goroutine calling SendMsg and another goroutine
- // calling RecvMsg on the same stream at the same time, but it is not
- // safe to call RecvMsg on the same stream in different goroutines.
- RecvMsg(m any) error
-}
-
-// ClientInterceptor is an interceptor for gRPC client streams.
-type ClientInterceptor interface {
- // NewStream creates a ClientStream for an RPC.
- //
- // Implementations must delegate stream creation to the provided newStream
- // function. To intercept or override stream behavior, implementations
- // may wrap the ClientStream returned by the delegate.
- //
- // Note: RPCInfo.Context is currently unused and will be nil.
- //
- // The done function is invoked when the RPC has finished using its
- // underlying connection or if a connection could not be assigned. Because
- // interceptors operate at the application layer, RPC operations may
- // continue on the ClientStream even after done has been called. The
- // caller must ensure done is non-nil.
- //
- // To ensure RPC completion notifications propagate through the entire
- // interceptor chain, implementations must ensure that the done function
- // passed to the delegate newStream invokes the done function passed to
- // NewStream.
- NewStream(ctx context.Context, ri RPCInfo, done func(), newStream func(ctx context.Context, done func()) (ClientStream, error)) (ClientStream, error)
- // Close closes the interceptor. Once called, no new calls to NewStream are
- // accepted. Ongoing calls to NewStream are allowed to complete.
- Close()
+ Interceptor any
}
// ServerInterceptor is an interceptor for incoming RPC's on gRPC server side.
diff --git a/vendor/google.golang.org/grpc/internal/transport/client_stream.go b/vendor/google.golang.org/grpc/internal/transport/client_stream.go
index ad382b0..046f0a5 100644
--- a/vendor/google.golang.org/grpc/internal/transport/client_stream.go
+++ b/vendor/google.golang.org/grpc/internal/transport/client_stream.go
@@ -39,9 +39,8 @@
type ClientStream struct {
Stream // Embed for common stream functionality.
- ct *http2Client
- done chan struct{} // closed at the end of stream to unblock writers.
- doneFunc func() // invoked at the end of stream.
+ ct *http2Client
+ done chan struct{} // closed at the end of stream to unblock writers.
headerChan chan struct{} // closed to indicate the end of header metadata.
header metadata.MD // the received header metadata
diff --git a/vendor/google.golang.org/grpc/internal/transport/handler_server.go b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
index a8356c9..9cd8d28 100644
--- a/vendor/google.golang.org/grpc/internal/transport/handler_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/handler_server.go
@@ -424,7 +424,7 @@
st: ht,
headerWireLength: 0, // won't have access to header wire length until golang/go#18997.
}
- s.Stream.buf.init()
+ s.Stream.buf.init(ht.bufferPool)
s.readRequester = s
s.trReader = transportReader{
reader: recvBufferReader{ctx: s.ctx, ctxDone: s.ctx.Done(), recv: &s.buf},
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_client.go b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
index 822c09b..10d1977 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_client.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_client.go
@@ -498,10 +498,9 @@
ct: t,
done: make(chan struct{}),
headerChan: make(chan struct{}),
- doneFunc: callHdr.DoneFunc,
statsHandler: handler,
}
- s.Stream.buf.init()
+ s.Stream.buf.init(t.bufferPool)
s.Stream.wq.init(defaultWriteQuota, s.done)
s.readRequester = s
// The client side stream context should have exactly the same life cycle with the user provided context.
@@ -998,9 +997,6 @@
t.controlBuf.executeAndPut(addBackStreamQuota, cleanup)
// This will unblock write.
close(s.done)
- if s.doneFunc != nil {
- s.doneFunc()
- }
}
// Close kicks off the shutdown process of the transport. This should be called
diff --git a/vendor/google.golang.org/grpc/internal/transport/http2_server.go b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
index 8e9cbd3..63c6539 100644
--- a/vendor/google.golang.org/grpc/internal/transport/http2_server.go
+++ b/vendor/google.golang.org/grpc/internal/transport/http2_server.go
@@ -407,7 +407,7 @@
st: t,
headerWireLength: int(frame.Header().Length),
}
- s.Stream.buf.init()
+ s.Stream.buf.init(t.bufferPool)
var (
// if false, content-type was missing or invalid
isGRPC = false
@@ -522,12 +522,6 @@
delete(mdata, "host")
}
- // If :authority is still missing, i.e. no host or :authority header is
- // present, reject the request as invalid.
- if len(mdata[":authority"]) == 0 {
- t.writeEarlyAbort(streamID, s.contentSubtype, status.New(codes.Internal, "no host or :authority header present"), http.StatusBadRequest, !frame.StreamEnded())
- return nil
- }
if frame.StreamEnded() {
// s is just created by the caller. No lock needed.
s.state = streamReadDone
diff --git a/vendor/google.golang.org/grpc/internal/transport/transport.go b/vendor/google.golang.org/grpc/internal/transport/transport.go
index 6dfae39..5fc901e 100644
--- a/vendor/google.golang.org/grpc/internal/transport/transport.go
+++ b/vendor/google.golang.org/grpc/internal/transport/transport.go
@@ -30,11 +30,14 @@
"sync"
"sync/atomic"
"time"
+ "unsafe"
"golang.org/x/net/http2"
"google.golang.org/grpc/codes"
"google.golang.org/grpc/credentials"
"google.golang.org/grpc/internal/channelz"
+ "google.golang.org/grpc/internal/envconfig"
+ imem "google.golang.org/grpc/internal/mem"
"google.golang.org/grpc/internal/transport/internal"
"google.golang.org/grpc/keepalive"
"google.golang.org/grpc/mem"
@@ -45,7 +48,30 @@
"google.golang.org/grpc/tap"
)
-const logLevel = 2
+const (
+ logLevel = 2
+ // recvMsgSize estimates the memory overhead of a recvMsg in the backlog.
+ // It accounts for the recvMsg struct itself and the slice header of the
+ // underlying buffer's data.
+ recvMsgSize = int(unsafe.Sizeof(recvMsg{}) + unsafe.Sizeof([]byte{}))
+
+ // utilizationFactor controls when we consider memory utilization acceptable.
+ // When backlogHeapSize / payloadSize <= utilizationFactor (meaning at least
+ // 50% of the heap memory is actual payload data), compaction is skipped.
+ utilizationFactor = 2
+)
+
+var (
+ // compactionThreshold is approx 57KB (on 64-bit systems). It allows
+ // accumulating up to 1024 1-byte payloads before triggering compaction.
+ //
+ // Because individual payloads <= 1024 bytes are allocated on the heap
+ // outside mem.BufferPool, waiting for at least 1024 bytes to accumulate
+ // ensures that compaction coalesces those small heap allocations into a
+ // single large buffer from mem.BufferPool, enabling buffer reuse while
+ // avoiding frequent copying for small bursts of frames.
+ compactionThreshold = imem.BufferPoolingThreshold * (recvMsgSize + 1)
+)
func init() {
internal.TimeNowFunc = func() int64 { return time.Now().UnixNano() }
@@ -71,23 +97,31 @@
c chan recvMsg
mu sync.Mutex
backlog []recvMsg
- err error
+ // uncompactedSuffixLen tracks the number of consecutive data messages at
+ // the tail of backlog that have not been compacted.
+ uncompactedSuffixLen int
+ // uncompactedBytes tracks the total payload bytes across the trailing
+ // uncompactedSuffixLen messages.
+ uncompactedBytes int
+ err error
+ bufPool mem.BufferPool
}
// init allows a recvBuffer to be initialized in-place, which is useful
// for resetting a buffer or for avoiding a heap allocation when the buffer
// is embedded in another struct.
-func (b *recvBuffer) init() {
+func (b *recvBuffer) init(pool mem.BufferPool) {
b.c = make(chan recvMsg, 1)
+ b.bufPool = pool
}
func (b *recvBuffer) put(r recvMsg) {
b.mu.Lock()
+ defer b.mu.Unlock()
if b.err != nil {
// drop the buffer on the floor. Since b.err is not nil, any subsequent reads
// will always return an error, making this buffer inaccessible.
r.buffer.Free()
- b.mu.Unlock()
// An error had occurred earlier, don't accept more
// data or errors.
return
@@ -96,13 +130,70 @@
if len(b.backlog) == 0 {
select {
case b.c <- r:
- b.mu.Unlock()
return
default:
}
}
b.backlog = append(b.backlog, r)
- b.mu.Unlock()
+ b.compactBacklogLocked(r)
+}
+
+func (b *recvBuffer) compactBacklogLocked(r recvMsg) {
+ if !envconfig.EnableReceiveBufferCompaction {
+ return
+ }
+ if r.buffer == nil {
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
+ return
+ }
+
+ b.uncompactedSuffixLen++
+ b.uncompactedBytes += r.buffer.Len()
+ backlogHeapSize := b.uncompactedSuffixLen*recvMsgSize + b.uncompactedBytes
+
+ // If the memory overhead is less than 50% of the heap usage (e.g., because
+ // a large DATA frame arrived), the average message size in the suffix is
+ // large enough that memory bloat is not a concern. Reset suffix tracking.
+ if backlogHeapSize <= utilizationFactor*b.uncompactedBytes {
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
+ return
+ }
+ // Avoid compacting too frequently for short bursts of small frames.
+ // Wait until we have accumulated at least ~1024 small messages (~57 KB).
+ if backlogHeapSize <= compactionThreshold {
+ // Still can accumulate more payloads.
+ return
+ }
+
+ // Since the memory utilization is less than 50%, the average payload size
+ // of each recvMsg must be less than recvMsgSize (approx 56 bytes).
+ // In the worst case for bytes copied (where the average payload is just
+ // below recvMsgSize), compaction will occur once every:
+ // compactionThreshold / (recvMsgSize + avg_payload) = ~520 messages,
+ // copying ~29KB of data.
+
+ start := 0
+ newBuf := b.bufPool.Get(b.uncompactedBytes)
+ startIdx := len(b.backlog) - b.uncompactedSuffixLen
+
+ for i := startIdx; i < len(b.backlog); i++ {
+ m := b.backlog[i]
+ b.backlog[i] = recvMsg{}
+ start += copy((*newBuf)[start:], m.buffer.ReadOnlyData())
+ m.buffer.Free()
+ }
+ b.backlog[startIdx] = recvMsg{
+ buffer: mem.NewBuffer(newBuf, b.bufPool),
+ }
+ b.backlog = b.backlog[:startIdx+1]
+ // After compaction, the suffix is replaced with a single message containing
+ // the combined payload. The new utilization is close to 1.0 (overhead of
+ // one recvMsg relative to the large compacted payload), which is well
+ // below the utilization factor of 2.
+ b.uncompactedBytes = 0
+ b.uncompactedSuffixLen = 0
}
func (b *recvBuffer) load() {
@@ -110,6 +201,13 @@
if len(b.backlog) > 0 {
select {
case b.c <- b.backlog[0]:
+ // backlog[0] is only part of the tracked uncompacted suffix if the
+ // entire backlog currently consists of the suffix. If an earlier
+ // compaction or reset occurred, backlog[0] is already compacted.
+ if envconfig.EnableReceiveBufferCompaction && b.uncompactedSuffixLen == len(b.backlog) {
+ b.uncompactedSuffixLen--
+ b.uncompactedBytes -= b.backlog[0].buffer.Len()
+ }
b.backlog[0] = recvMsg{}
b.backlog = b.backlog[1:]
default:
@@ -594,8 +692,6 @@
PreviousAttempts int // value of grpc-previous-rpc-attempts header to set
- DoneFunc func() // called when the stream is finished
-
// Authority is used to explicitly override the `:authority` header.
//
// This value comes from one of two sources:
diff --git a/vendor/google.golang.org/grpc/internal/xds/balancer/cdsbalancer/configbuilder.go b/vendor/google.golang.org/grpc/internal/xds/balancer/cdsbalancer/configbuilder.go
index 336d240..6efeeb1 100644
--- a/vendor/google.golang.org/grpc/internal/xds/balancer/cdsbalancer/configbuilder.go
+++ b/vendor/google.golang.org/grpc/internal/xds/balancer/cdsbalancer/configbuilder.go
@@ -28,6 +28,7 @@
"google.golang.org/grpc/experimental/balancer/weight"
"google.golang.org/grpc/internal/envconfig"
"google.golang.org/grpc/internal/hierarchy"
+ "google.golang.org/grpc/internal/proxyattributes"
internalserviceconfig "google.golang.org/grpc/internal/serviceconfig"
xdsinternal "google.golang.org/grpc/internal/xds"
"google.golang.org/grpc/internal/xds/balancer/clusterimpl"
@@ -294,6 +295,24 @@
resolverEndpoint := endpoint.ResolverEndpoint
resolverEndpoint.Addresses = slices.Clone(endpoint.ResolverEndpoint.Addresses)
+ if clusterUpdate.IsHTTP11ProxyEnabled {
+ var proxyAddrStr string
+ if val, ok := endpoint.Metadata["envoy.http11_proxy_transport_socket.proxy_address"].(xdsresource.ProxyAddressMetadataValue); ok {
+ proxyAddrStr = val.Address
+ } else if val, ok := locality.Metadata["envoy.http11_proxy_transport_socket.proxy_address"].(xdsresource.ProxyAddressMetadataValue); ok {
+ proxyAddrStr = val.Address
+ }
+ if proxyAddrStr != "" {
+ for idx, addr := range resolverEndpoint.Addresses {
+ connectAddr := addr.Addr
+ addr.Addr = proxyAddrStr
+ resolverEndpoint.Addresses[idx] = proxyattributes.Set(addr, proxyattributes.Options{
+ ConnectAddr: connectAddr,
+ })
+ }
+ }
+ }
+
resolverEndpoint = hierarchy.SetInEndpoint(resolverEndpoint, []string{priorityName, localityStr})
resolverEndpoint = xdsinternal.SetLocalityIDInEndpoint(resolverEndpoint, locality.ID)
// "To provide the xds_wrr_locality load balancer information about
diff --git a/vendor/google.golang.org/grpc/internal/xds/balancer/clustermanager/picker.go b/vendor/google.golang.org/grpc/internal/xds/balancer/clustermanager/picker.go
index 015cd2b..97a1670 100644
--- a/vendor/google.golang.org/grpc/internal/xds/balancer/clustermanager/picker.go
+++ b/vendor/google.golang.org/grpc/internal/xds/balancer/clustermanager/picker.go
@@ -43,7 +43,7 @@
}
func (pg *pickerGroup) Pick(info balancer.PickInfo) (balancer.PickResult, error) {
- cluster := getPickedCluster(info.Ctx)
+ cluster := PickedCluster(info.Ctx)
if p := pg.pickers[cluster]; p != nil {
return p.Pick(info)
}
@@ -52,17 +52,12 @@
type clusterKey struct{}
-func getPickedCluster(ctx context.Context) string {
+// PickedCluster returns the cluster name stored in the context.
+func PickedCluster(ctx context.Context) string {
cluster, _ := ctx.Value(clusterKey{}).(string)
return cluster
}
-// GetPickedClusterForTesting returns the cluster in the context; to be used
-// for testing only.
-func GetPickedClusterForTesting(ctx context.Context) string {
- return getPickedCluster(ctx)
-}
-
// SetPickedCluster adds the selected cluster to the context for the
// xds_cluster_manager LB policy to pick.
func SetPickedCluster(ctx context.Context, cluster string) context.Context {
diff --git a/vendor/google.golang.org/grpc/internal/xds/httpfilter/fault/fault.go b/vendor/google.golang.org/grpc/internal/xds/httpfilter/fault/fault.go
index 2d6f8af..58f3486 100644
--- a/vendor/google.golang.org/grpc/internal/xds/httpfilter/fault/fault.go
+++ b/vendor/google.golang.org/grpc/internal/xds/httpfilter/fault/fault.go
@@ -29,6 +29,7 @@
"sync/atomic"
"time"
+ "google.golang.org/grpc"
"google.golang.org/grpc/codes"
iresolver "google.golang.org/grpc/internal/resolver"
"google.golang.org/grpc/internal/xds/httpfilter"
@@ -104,7 +105,7 @@
return false
}
-func (builder) BuildClientFilter() httpfilter.ClientFilter {
+func (builder) BuildClientFilter(httpfilter.ClientFilterOptions) httpfilter.ClientFilter {
return clientFilter{}
}
@@ -114,7 +115,7 @@
func (clientFilter) Close() {}
-func (clientFilter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (iresolver.ClientInterceptor, error) {
+func (clientFilter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (httpfilter.ClientInterceptor, error) {
if cfg == nil {
return nil, fmt.Errorf("fault: nil config provided")
}
@@ -147,12 +148,12 @@
var activeFaults uint32 // global active faults; accessed atomically
-func (i *interceptor) NewStream(ctx context.Context, _ iresolver.RPCInfo, done func(), newStream func(ctx context.Context, done func()) (iresolver.ClientStream, error)) (iresolver.ClientStream, error) {
+func (i *interceptor) NewStream(ctx context.Context, _ iresolver.RPCInfo, newStream func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error), opts ...grpc.CallOption) (grpc.ClientStream, error) {
if maxAF := i.config.GetMaxActiveFaults(); maxAF != nil {
defer atomic.AddUint32(&activeFaults, ^uint32(0)) // decrement counter
if af := atomic.AddUint32(&activeFaults, 1); af > maxAF.GetValue() {
// Would exceed maximum active fault limit.
- return newStream(ctx, done)
+ return newStream(ctx, opts...)
}
}
@@ -166,7 +167,7 @@
}
return nil, err
}
- return newStream(ctx, done)
+ return newStream(ctx, opts...)
}
func (i *interceptor) Close() {}
diff --git a/vendor/google.golang.org/grpc/internal/xds/httpfilter/httpfilter.go b/vendor/google.golang.org/grpc/internal/xds/httpfilter/httpfilter.go
index b37ed9d..cc31e75 100644
--- a/vendor/google.golang.org/grpc/internal/xds/httpfilter/httpfilter.go
+++ b/vendor/google.golang.org/grpc/internal/xds/httpfilter/httpfilter.go
@@ -21,6 +21,9 @@
package httpfilter
import (
+ "context"
+
+ "google.golang.org/grpc"
iresolver "google.golang.org/grpc/internal/resolver"
"google.golang.org/protobuf/proto"
)
@@ -66,11 +69,34 @@
IsTerminal() bool
}
+// ClientInterceptor is an interceptor for gRPC client streams.
+type ClientInterceptor interface {
+ // NewStream creates a ClientStream for an RPC.
+ //
+ // Implementations may delegate stream creation to the provided newStream
+ // function, passing the provided CallOption slice along with any new
+ // CallOption instances they wish to add. To intercept or override stream
+ // behavior, implementations may wrap the ClientStream returned by the
+ // delegate.
+ //
+ // Note: RPCInfo.Context is currently unused and will be nil.
+ NewStream(ctx context.Context, ri iresolver.RPCInfo, newStream func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error), opts ...grpc.CallOption) (grpc.ClientStream, error)
+
+ // Close closes the interceptor. Once called, no new calls to NewStream are
+ // accepted. Ongoing calls to NewStream are allowed to complete.
+ Close()
+}
+
+// ClientFilterOptions contains options for building a client filter.
+type ClientFilterOptions struct {
+ FilterName string // FilterName is the filter name from the xDS configuration.
+}
+
// ClientFilterBuilder is an optional interface that a Builder can implement to
// indicate its capability to build client-side filters.
type ClientFilterBuilder interface {
// BuildClientFilter constructs a ClientFilter.
- BuildClientFilter() ClientFilter
+ BuildClientFilter(opts ClientFilterOptions) ClientFilter
}
// ClientFilter represents the actual filter implementation on the client side.
@@ -84,7 +110,7 @@
//
// It is valid for this method to return a nil Interceptor and a nil error.
// In this case, the RPC will not be intercepted by this filter.
- BuildClientInterceptor(config, override FilterConfig) (iresolver.ClientInterceptor, error)
+ BuildClientInterceptor(config, override FilterConfig) (ClientInterceptor, error)
// Close is called when the filter is no longer needed.
Close()
diff --git a/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go b/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
index eb42a7f..1af2c20 100644
--- a/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
+++ b/vendor/google.golang.org/grpc/internal/xds/httpfilter/rbac/rbac.go
@@ -32,6 +32,7 @@
"google.golang.org/protobuf/types/known/anypb"
v3rbacpb "github.com/envoyproxy/go-control-plane/envoy/config/rbac/v3"
+ v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
rpb "github.com/envoyproxy/go-control-plane/envoy/extensions/filters/http/rbac/v3"
)
@@ -68,36 +69,25 @@
}
// "It is also a validation failure if Permission or Principal has a
- // header matcher for a grpc- prefixed header name or :scheme." - A41
- for _, principal := range policy.Principals {
- name := principal.GetHeader().GetName()
- if name == ":scheme" || strings.HasPrefix(name, "grpc-") {
- return nil, fmt.Errorf("rbac: principal header matcher for %v is :scheme or starts with grpc", name)
+ // header matcher for a grpc- prefixed header name or :scheme." - A41.
+ //
+ // "Envoy aliases :authority and Host in its header map implementation,
+ // so they should be treated equivalent for the RBAC matchers; there must
+ // be no behavior change depending on which of the two header names is
+ // used in the RBAC policy." - A41. Any header matcher with value "host"
+ // is rewritten to ":authority", as that is what grpc-go shifts both
+ // headers to in the transport layer.
+ //
+ // Both rules apply to header matchers nested inside and/or/not rules, so
+ // the whole permission and principal trees are walked.
+ for _, principal := range policy.GetPrincipals() {
+ if err := normalizePrincipalHeaders(principal); err != nil {
+ return nil, err
}
}
- for _, permission := range policy.Permissions {
- name := permission.GetHeader().GetName()
- if name == ":scheme" || strings.HasPrefix(name, "grpc-") {
- return nil, fmt.Errorf("rbac: permission header matcher for %v is :scheme or starts with grpc", name)
- }
- }
- }
-
- // "Envoy aliases :authority and Host in its header map implementation, so
- // they should be treated equivalent for the RBAC matchers; there must be no
- // behavior change depending on which of the two header names is used in the
- // RBAC policy." - A41. Loop through config's principals and policies, change
- // any header matcher with value "host" to :authority", as that is what
- // grpc-go shifts both headers to in transport layer.
- for _, policy := range rbacCfg.GetRules().GetPolicies() {
- for _, principal := range policy.Principals {
- if principal.GetHeader().GetName() == "host" {
- principal.GetHeader().Name = ":authority"
- }
- }
- for _, permission := range policy.Permissions {
- if permission.GetHeader().GetName() == "host" {
- permission.GetHeader().Name = ":authority"
+ for _, permission := range policy.GetPermissions() {
+ if err := normalizePermissionHeaders(permission); err != nil {
+ return nil, err
}
}
}
@@ -126,6 +116,82 @@
return config{chainEngine: ce}, nil
}
+// normalizePermissionHeaders applies the A41 header-name rules to every header
+// matcher reachable from permission, including those nested inside and/or/not
+// rules.
+func normalizePermissionHeaders(permission *v3rbacpb.Permission) error {
+ switch p := permission.GetRule().(type) {
+ case *v3rbacpb.Permission_Header:
+ return normalizeHeaderMatcher(p.Header)
+ case *v3rbacpb.Permission_AndRules:
+ for _, rule := range p.AndRules.GetRules() {
+ if err := normalizePermissionHeaders(rule); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Permission_OrRules:
+ for _, rule := range p.OrRules.GetRules() {
+ if err := normalizePermissionHeaders(rule); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Permission_NotRule:
+ return normalizePermissionHeaders(p.NotRule)
+ }
+ return nil
+}
+
+// normalizePrincipalHeaders applies the A41 header-name rules to every header
+// matcher reachable from principal, including those nested inside and/or/not
+// ids.
+func normalizePrincipalHeaders(principal *v3rbacpb.Principal) error {
+ switch p := principal.GetIdentifier().(type) {
+ case *v3rbacpb.Principal_Header:
+ return normalizeHeaderMatcher(p.Header)
+ case *v3rbacpb.Principal_AndIds:
+ for _, id := range p.AndIds.GetIds() {
+ if err := normalizePrincipalHeaders(id); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Principal_OrIds:
+ for _, id := range p.OrIds.GetIds() {
+ if err := normalizePrincipalHeaders(id); err != nil {
+ return err
+ }
+ }
+ case *v3rbacpb.Principal_NotId:
+ return normalizePrincipalHeaders(p.NotId)
+ }
+ return nil
+}
+
+// normalizeHeaderMatcher lowercases the name of a header matcher, rejects the
+// names that A41 forbids (:scheme or a grpc- prefixed name) and rewrites a
+// "host" matcher to ":authority".
+func normalizeHeaderMatcher(header *v3routepb.HeaderMatcher) error {
+ // The keys of the metadata the matchers run against are always lowercase,
+ // so a name that contains an uppercase character matches no header at all
+ // and the rule using it never fires. Lowercase the name, as Envoy and
+ // grpc-java do, both to make it match and to keep the checks below from
+ // being evaded by the case of the name.
+ name := header.GetName()
+ lowerName := strings.ToLower(name)
+ if lowerName != name {
+ header.Name = lowerName
+ }
+ if lowerName == ":scheme" {
+ return fmt.Errorf("rbac: header matcher for %q is %q", name, ":scheme")
+ }
+ if strings.HasPrefix(lowerName, "grpc-") {
+ return fmt.Errorf("rbac: header matcher for %q starts with %q", name, "grpc-")
+ }
+ if lowerName == "host" {
+ header.Name = ":authority"
+ }
+ return nil
+}
+
func (builder) ParseFilterConfig(cfg proto.Message) (httpfilter.FilterConfig, error) {
if cfg == nil {
return nil, fmt.Errorf("rbac: nil configuration message provided")
diff --git a/vendor/google.golang.org/grpc/internal/xds/httpfilter/router/router.go b/vendor/google.golang.org/grpc/internal/xds/httpfilter/router/router.go
index 7118ea1..9545282 100644
--- a/vendor/google.golang.org/grpc/internal/xds/httpfilter/router/router.go
+++ b/vendor/google.golang.org/grpc/internal/xds/httpfilter/router/router.go
@@ -76,7 +76,7 @@
return true
}
-func (builder) BuildClientFilter() httpfilter.ClientFilter {
+func (builder) BuildClientFilter(httpfilter.ClientFilterOptions) httpfilter.ClientFilter {
return filter{}
}
@@ -91,7 +91,7 @@
func (filter) Close() {}
-func (filter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (iresolver.ClientInterceptor, error) {
+func (filter) BuildClientInterceptor(cfg, override httpfilter.FilterConfig) (httpfilter.ClientInterceptor, error) {
if _, ok := cfg.(config); !ok {
return nil, fmt.Errorf("router: incorrect config type provided (%T): %v", cfg, cfg)
}
diff --git a/vendor/google.golang.org/grpc/internal/xds/resolver/serviceconfig.go b/vendor/google.golang.org/grpc/internal/xds/resolver/serviceconfig.go
index b19bb7e..94801b7 100644
--- a/vendor/google.golang.org/grpc/internal/xds/resolver/serviceconfig.go
+++ b/vendor/google.golang.org/grpc/internal/xds/resolver/serviceconfig.go
@@ -35,6 +35,7 @@
"google.golang.org/grpc/internal/wrr"
"google.golang.org/grpc/internal/xds/balancer/clusterimpl"
"google.golang.org/grpc/internal/xds/balancer/clustermanager"
+ "google.golang.org/grpc/internal/xds/httpfilter"
"google.golang.org/grpc/internal/xds/xdsclient/xdsresource"
"google.golang.org/grpc/metadata"
"google.golang.org/grpc/status"
@@ -104,15 +105,15 @@
// routeCluster holds information about a cluster as referenced by a route.
type routeCluster struct {
- name string // Name of the cluster.
- interceptor iresolver.ClientInterceptor // HTTP filters to run for RPCs matching this route.
+ name string // Name of the cluster.
+ interceptor httpfilter.ClientInterceptor // HTTP filters to run for RPCs matching this route.
}
type route struct {
- m *xdsresource.CompositeMatcher // converted from route matchers
- actionType xdsresource.RouteActionType // holds route action type
- clusters wrr.WRR // holds *routeCluster entries
- interceptors []iresolver.ClientInterceptor // Interceptors across clusters belonging to this route
+ m *xdsresource.CompositeMatcher // converted from route matchers
+ actionType xdsresource.RouteActionType // holds route action type
+ clusters wrr.WRR // holds *routeCluster entries
+ interceptors []httpfilter.ClientInterceptor // Interceptors across clusters belonging to this route
maxStreamDuration time.Duration
retryConfig *xdsresource.RetryConfig
hashPolicies []*xdsresource.HashPolicy
diff --git a/vendor/google.golang.org/grpc/internal/xds/resolver/xds_resolver.go b/vendor/google.golang.org/grpc/internal/xds/resolver/xds_resolver.go
index 3d4932b..8dfa684 100644
--- a/vendor/google.golang.org/grpc/internal/xds/resolver/xds_resolver.go
+++ b/vendor/google.golang.org/grpc/internal/xds/resolver/xds_resolver.go
@@ -27,6 +27,7 @@
"strings"
"sync/atomic"
+ "google.golang.org/grpc"
estats "google.golang.org/grpc/experimental/stats"
"google.golang.org/grpc/internal"
"google.golang.org/grpc/internal/grpclog"
@@ -414,7 +415,7 @@
for i, rt := range r.xdsConfig.VirtualHost.Routes {
clusters := rinternal.NewWRR.(func() wrr.WRR)()
- interceptors := []iresolver.ClientInterceptor{}
+ interceptors := []httpfilter.ClientInterceptor{}
// TODO: Carve out the common logic between the ClusterSpecifierPlugin
// and WeightedClusters.
if rt.ClusterSpecifierPlugin != "" {
@@ -594,8 +595,8 @@
// followed by the route override, and finally the virtual host override.
//
// Only executed in the context of a serializer callback.
-func (r *xdsResolver) newInterceptor(filters []xdsresource.HTTPFilter, clusterOverride, routeOverride, virtualHostOverride map[string]httpfilter.FilterConfig) (_ iresolver.ClientInterceptor, err error) {
- interceptors := make([]iresolver.ClientInterceptor, 0, len(filters))
+func (r *xdsResolver) newInterceptor(filters []xdsresource.HTTPFilter, clusterOverride, routeOverride, virtualHostOverride map[string]httpfilter.FilterConfig) (_ httpfilter.ClientInterceptor, err error) {
+ interceptors := make([]httpfilter.ClientInterceptor, 0, len(filters))
defer func() {
// Clean up any interceptors that were successfully built before the
// error occurred, to avoid leaking resources.
@@ -652,18 +653,18 @@
// interceptorList is a client interceptor that contains a list of client
// interceptors to execute in order.
type interceptorList struct {
- interceptors []iresolver.ClientInterceptor
+ interceptors []httpfilter.ClientInterceptor
}
-func (il *interceptorList) NewStream(ctx context.Context, ri iresolver.RPCInfo, _ func(), newStream func(ctx context.Context, _ func()) (iresolver.ClientStream, error)) (iresolver.ClientStream, error) {
+func (il *interceptorList) NewStream(ctx context.Context, ri iresolver.RPCInfo, newStream func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error), opts ...grpc.CallOption) (grpc.ClientStream, error) {
for idx := len(il.interceptors) - 1; idx >= 0; idx-- {
ns := newStream
i := il.interceptors[idx]
- newStream = func(ctx context.Context, done func()) (iresolver.ClientStream, error) {
- return i.NewStream(ctx, ri, done, ns)
+ newStream = func(ctx context.Context, opts ...grpc.CallOption) (grpc.ClientStream, error) {
+ return i.NewStream(ctx, ri, ns, opts...)
}
}
- return newStream(ctx, func() {})
+ return newStream(ctx, opts...)
}
func (il *interceptorList) Close() {
@@ -684,7 +685,7 @@
return clientFilter
}
- cf := builder.BuildClientFilter()
+ cf := builder.BuildClientFilter(httpfilter.ClientFilterOptions{FilterName: key.name})
r.httpFilters[key] = cf
return cf
}
diff --git a/vendor/google.golang.org/grpc/internal/xds/server/listener_wrapper.go b/vendor/google.golang.org/grpc/internal/xds/server/listener_wrapper.go
index 92b654b..e53a4bd 100644
--- a/vendor/google.golang.org/grpc/internal/xds/server/listener_wrapper.go
+++ b/vendor/google.golang.org/grpc/internal/xds/server/listener_wrapper.go
@@ -439,7 +439,13 @@
}
l := lw.parent
ilc := update.TCPListener
- // Make sure that the socket address on the received Listener resource
+
+ // A server-side listener update must contain inbound listener configuration
+ // (TCPListener). If it is nil, it indicates that a client-side listener (API
+ // Listener) resource was received instead. In this case, we transition the
+ // server to non-serving mode.
+ //
+ // Also, make sure that the socket address on the received Listener resource
// matches the address of the net.Listener passed to us by the user. This
// check is done here instead of at the XDSClient layer because of the
// following couple of reasons:
@@ -451,11 +457,16 @@
// What this means is that the XDSClient has ACKed a resource which can push
// the server into a "not serving" mode. This is not ideal, but this is
// what we have decided to do.
- if ilc.Address != l.addr || ilc.Port != l.port {
+ if ilc == nil || (ilc.Address != l.addr || ilc.Port != l.port) {
// TODO(purnesh42h): Are there any other cases where this can be
// treated as an ambient error?
l.mu.Lock()
- err := fmt.Errorf("[xDS node id: %v]: %w", l.xdsNodeID, fmt.Errorf("address (%s:%s) in Listener update does not match listening address: (%s:%s)", ilc.Address, ilc.Port, l.addr, l.port))
+ var err error
+ if ilc == nil {
+ err = fmt.Errorf("[xDS node id: %v]: %w", l.xdsNodeID, fmt.Errorf("received client-side listener resource %q on server-side", lw.name))
+ } else {
+ err = fmt.Errorf("[xDS node id: %v]: %w", l.xdsNodeID, fmt.Errorf("address (%s:%s) in Listener update does not match listening address: (%s:%s)", ilc.Address, ilc.Port, l.addr, l.port))
+ }
l.switchModeLocked(connectivity.ServingModeNotServing, err)
l.mu.Unlock()
return
diff --git a/vendor/google.golang.org/grpc/internal/xds/server/routing.go b/vendor/google.golang.org/grpc/internal/xds/server/routing.go
index 7068725..67dd760 100644
--- a/vendor/google.golang.org/grpc/internal/xds/server/routing.go
+++ b/vendor/google.golang.org/grpc/internal/xds/server/routing.go
@@ -62,14 +62,11 @@
if !ok {
return errors.New("missing metadata in incoming context")
}
- // A41 added logic to the core grpc implementation to guarantee that once the
- // RPC gets to this point, there will be a single, unambiguous authority
- // present in the header map. But add a defensive check to ensure authority
- // header is present.
+ // A41 added logic to the core grpc implementation to guarantee that once
+ // the RPC gets to this point, there will be a single, unambiguous authority
+ // present in the header map.
authority := md.Get(":authority")
- if len(authority) == 0 {
- return rc.statusErrWithNodeID(codes.Internal, "no :authority header present")
- }
+ // authority[0] is safe because of the guarantee mentioned above.
vh := findBestMatchingVirtualHostServer(authority[0], rc.vhs)
if vh == nil {
return rc.statusErrWithNodeID(codes.Unavailable, "the incoming RPC did not match a configured Virtual Host")
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/matcher.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/matcher.go
index c9202fc..3eef12f 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/matcher.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/matcher.go
@@ -50,14 +50,8 @@
var matcherT matcher.HeaderMatcher
invert := h.InvertMatch != nil && *h.InvertMatch
switch {
- case h.ExactMatch != nil && *h.ExactMatch != "":
- matcherT = matcher.NewHeaderExactMatcher(h.Name, *h.ExactMatch, invert)
case h.RegexMatch != nil:
matcherT = matcher.NewHeaderRegexMatcher(h.Name, h.RegexMatch, invert)
- case h.PrefixMatch != nil && *h.PrefixMatch != "":
- matcherT = matcher.NewHeaderPrefixMatcher(h.Name, *h.PrefixMatch, invert)
- case h.SuffixMatch != nil && *h.SuffixMatch != "":
- matcherT = matcher.NewHeaderSuffixMatcher(h.Name, *h.SuffixMatch, invert)
case h.RangeMatch != nil:
matcherT = matcher.NewHeaderRangeMatcher(h.Name, h.RangeMatch.Start, h.RangeMatch.End, invert)
case h.PresentMatch != nil:
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/metadata.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/metadata.go
index 4d915c5..bde5eb7 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/metadata.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/metadata.go
@@ -22,6 +22,7 @@
"net/netip"
"google.golang.org/grpc/internal/envconfig"
+ "google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version"
"google.golang.org/protobuf/types/known/anypb"
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
@@ -30,10 +31,10 @@
func init() {
if envconfig.XDSHTTPConnectEnabled {
- registerMetadataConverter("type.googleapis.com/envoy.config.core.v3.Address", proxyAddressConvertor{})
+ registerMetadataConverter(version.V3AddressURL, proxyAddressConverter{})
}
if envconfig.GCPAuthenticationFilterEnabled {
- registerMetadataConverter("type.googleapis.com/envoy.extensions.filters.http.gcp_authn.v3.Audience", audienceConverter{})
+ registerMetadataConverter(version.V3AudienceURL, audienceConverter{})
}
}
@@ -61,10 +62,41 @@
return metadataRegistry[typeURL]
}
-// unregisterMetadataConverterForTesting removes a converter from the registry.
-// For testing only.
-func unregisterMetadataConverterForTesting(typeURL string) {
+// RegisterMetadataConverterForTesting registers the converter for testing
+// purposes and returns a cleanup function to restore the registry to its
+// previous state.
+func RegisterMetadataConverterForTesting(typeURL string) (func(), error) {
+ var conv metadataConverter
+ switch typeURL {
+ case version.V3AddressURL:
+ conv = proxyAddressConverter{}
+ case version.V3AudienceURL:
+ conv = audienceConverter{}
+ default:
+ return nil, fmt.Errorf("unknown typeURL for testing: %s", typeURL)
+ }
+ curConverter, found := metadataRegistry[typeURL]
+ registerMetadataConverter(typeURL, conv)
+ return func() {
+ if found {
+ metadataRegistry[typeURL] = curConverter
+ return
+ }
+ delete(metadataRegistry, typeURL)
+ }, nil
+}
+
+// UnregisterMetadataConverterForTesting unregisters the converter for testing
+// purposes and returns a cleanup function to restore the registry to its
+// previous state.
+func UnregisterMetadataConverterForTesting(typeURL string) func() {
+ curConverter, found := metadataRegistry[typeURL]
delete(metadataRegistry, typeURL)
+ return func() {
+ if found {
+ metadataRegistry[typeURL] = curConverter
+ }
+ }
}
// StructMetadataValue stores the values in a google.protobuf.Struct from
@@ -85,9 +117,9 @@
// proxyAddressConvertor implements the metadataConverter interface to handle
// the conversion of envoy.config.core.v3.Address protobuf messages into an
// internal representation.
-type proxyAddressConvertor struct{}
+type proxyAddressConverter struct{}
-func (proxyAddressConvertor) convert(anyProto *anypb.Any) (any, error) {
+func (proxyAddressConverter) convert(anyProto *anypb.Any) (any, error) {
addressProto := &v3corepb.Address{}
if err := anyProto.UnmarshalTo(addressProto); err != nil {
return nil, fmt.Errorf("failed to unmarshal resource from Any proto: %v", err)
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_cds.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_cds.go
index f206382..6c35905 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_cds.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_cds.go
@@ -86,6 +86,10 @@
// Metadata contains the metadata from the cluster resource.
Metadata map[string]any
+
+ // IsHTTP11ProxyEnabled is true if the cluster transport socket is wrapped
+ // in Http11ProxyUpstreamTransport.
+ IsHTTP11ProxyEnabled bool
}
// LRSReportEndpointMetricsConfig holds the configuration for propagating ORCA
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_rds.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_rds.go
index 48e8051..1cddfa5 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_rds.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/type_rds.go
@@ -166,14 +166,12 @@
HTTPFilterConfigOverride map[string]httpfilter.FilterConfig
}
-// HeaderMatcher represents header matchers.
+// HeaderMatcher represents header matchers. Exact, prefix, suffix and contains
+// matches are represented as a StringMatch.
type HeaderMatcher struct {
Name string
InvertMatch *bool
- ExactMatch *string
RegexMatch *regexp.Regexp
- PrefixMatch *string
- SuffixMatch *string
RangeMatch *Int64Range
PresentMatch *bool
StringMatch *matcher.StringMatcher
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_cds.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_cds.go
index 151143a..ea6d001 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_cds.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_cds.go
@@ -29,6 +29,7 @@
v3clusterpb "github.com/envoyproxy/go-control-plane/envoy/config/cluster/v3"
v3corepb "github.com/envoyproxy/go-control-plane/envoy/config/core/v3"
v3aggregateclusterpb "github.com/envoyproxy/go-control-plane/envoy/extensions/clusters/aggregate/v3"
+ v3http11proxypb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3"
v3tlspb "github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3"
"google.golang.org/grpc/internal/envconfig"
@@ -161,7 +162,8 @@
// Process security configuration received from the control plane iff the
// corresponding environment variable is set.
var sc *SecurityConfig
- if sc, err = securityConfigFromCluster(cluster); err != nil {
+ var isHTTP11ProxyEnabled bool
+ if sc, isHTTP11ProxyEnabled, err = securityConfigFromCluster(cluster); err != nil {
return ClusterUpdate{}, err
}
@@ -232,6 +234,7 @@
TelemetryLabels: telemetryLabels,
LRSReportEndpointMetrics: lrsReportEndpointMetrics,
Metadata: metadata,
+ IsHTTP11ProxyEnabled: isHTTP11ProxyEnabled,
}
if lrs := cluster.GetLrsServer(); lrs != nil {
@@ -318,50 +321,67 @@
// securityConfigFromCluster extracts the relevant security configuration from
// the received Cluster resource.
-func securityConfigFromCluster(cluster *v3clusterpb.Cluster) (*SecurityConfig, error) {
+func securityConfigFromCluster(cluster *v3clusterpb.Cluster) (*SecurityConfig, bool, error) {
if tsm := cluster.GetTransportSocketMatches(); len(tsm) != 0 {
- return nil, fmt.Errorf("unsupported transport_socket_matches field is non-empty: %+v", tsm)
+ return nil, false, fmt.Errorf("unsupported transport_socket_matches field is non-empty: %+v", tsm)
}
// The Cluster resource contains a `transport_socket` field, which contains
// a oneof `typed_config` field of type `protobuf.Any`. The any proto
// contains a marshaled representation of an `UpstreamTlsContext` message.
ts := cluster.GetTransportSocket()
if ts == nil {
- return nil, nil
+ return nil, false, nil
}
- if name := ts.GetName(); name != transportSocketName {
- return nil, fmt.Errorf("transport_socket field has unexpected name: %s", name)
- }
+ var isHTTP11ProxyEnabled bool
tc := ts.GetTypedConfig()
- if typeURL := tc.GetTypeUrl(); typeURL != version.V3UpstreamTLSContextURL {
- return nil, fmt.Errorf("transport_socket missing typed_config or wrong type_url: %q", typeURL)
+ typeURL := tc.GetTypeUrl()
+
+ if envconfig.XDSHTTPConnectEnabled && typeURL == version.V3HTTP11ProxyUpstreamTransportURL {
+ isHTTP11ProxyEnabled = true
+ http11Proxy := &v3http11proxypb.Http11ProxyUpstreamTransport{}
+ if err := proto.Unmarshal(tc.GetValue(), http11Proxy); err != nil {
+ return nil, false, fmt.Errorf("failed to unmarshal Http11ProxyUpstreamTransport in CDS response: %v", err)
+ }
+ ts = http11Proxy.GetTransportSocket()
+ if ts == nil {
+ return nil, true, nil
+ }
+ tc = ts.GetTypedConfig()
+ typeURL = tc.GetTypeUrl()
+ }
+
+ if name := ts.GetName(); name != transportSocketName {
+ return nil, false, fmt.Errorf("transport_socket field has unexpected name: %s", name)
+ }
+ if typeURL != version.V3UpstreamTLSContextURL {
+ return nil, false, fmt.Errorf("transport_socket missing typed_config or wrong type_url: %q", typeURL)
}
upstreamCtx := &v3tlspb.UpstreamTlsContext{}
if err := proto.Unmarshal(tc.GetValue(), upstreamCtx); err != nil {
- return nil, fmt.Errorf("failed to unmarshal UpstreamTlsContext in CDS response: %v", err)
+ return nil, false, fmt.Errorf("failed to unmarshal UpstreamTlsContext in CDS response: %v", err)
}
// The following fields from `UpstreamTlsContext` are ignored:
// - allow_renegotiation
// - max_session_keys
if upstreamCtx.GetCommonTlsContext() == nil {
- return nil, errors.New("UpstreamTlsContext in CDS response does not contain a CommonTlsContext")
+ return nil, false, errors.New("UpstreamTlsContext in CDS response does not contain a CommonTlsContext")
}
sc, err := securityConfigFromCommonTLSContext(upstreamCtx.GetCommonTlsContext(), false)
if err != nil {
- return nil, err
+ return nil, false, err
}
// Set SNI related fields in SecurityConfig from UpstreamTlsContext if
// `GRPC_EXPERIMENTAL_XDS_SNI` is enabled.
if envconfig.XDSSNIEnabled {
sc.SNI = upstreamCtx.GetSni()
if len(sc.SNI) > maxSNILength {
- return nil, fmt.Errorf("SNI value %q in UpstreamTlsContext in CDS response exceeds max length of %d", sc.SNI, maxSNILength)
+ return nil, false, fmt.Errorf("SNI value %q in UpstreamTlsContext in CDS response exceeds max length of %d", sc.SNI, maxSNILength)
}
sc.UseAutoHostSNI = upstreamCtx.GetAutoHostSni()
sc.AutoSNISANValidation = upstreamCtx.GetAutoSniSanValidation()
}
- return sc, nil
+ return sc, isHTTP11ProxyEnabled, nil
}
// common is expected to be not nil.
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_rds.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_rds.go
index 15a8e10..a053db2 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_rds.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/unmarshal_rds.go
@@ -33,6 +33,7 @@
"google.golang.org/protobuf/types/known/anypb"
v3routepb "github.com/envoyproxy/go-control-plane/envoy/config/route/v3"
+ v3matcherpb "github.com/envoyproxy/go-control-plane/envoy/type/matcher/v3"
v3typepb "github.com/envoyproxy/go-control-plane/envoy/type/v3"
)
@@ -256,9 +257,13 @@
for _, h := range match.GetHeaders() {
var header HeaderMatcher
+ // The deprecated exact/prefix/suffix/contains match fields are
+ // converted to the equivalent StringMatcher so that
+ // StringMatcherFromProto owns validation for all of them.
+ var smProto *v3matcherpb.StringMatcher
switch ht := h.GetHeaderMatchSpecifier().(type) {
case *v3routepb.HeaderMatcher_ExactMatch:
- header.ExactMatch = &ht.ExactMatch
+ smProto = &v3matcherpb.StringMatcher{MatchPattern: &v3matcherpb.StringMatcher_Exact{Exact: ht.ExactMatch}}
case *v3routepb.HeaderMatcher_SafeRegexMatch:
regex := ht.SafeRegexMatch.GetRegex()
re, err := matcher.CompileSafeRegex(regex)
@@ -274,18 +279,26 @@
case *v3routepb.HeaderMatcher_PresentMatch:
header.PresentMatch = &ht.PresentMatch
case *v3routepb.HeaderMatcher_PrefixMatch:
- header.PrefixMatch = &ht.PrefixMatch
+ smProto = &v3matcherpb.StringMatcher{MatchPattern: &v3matcherpb.StringMatcher_Prefix{Prefix: ht.PrefixMatch}}
case *v3routepb.HeaderMatcher_SuffixMatch:
- header.SuffixMatch = &ht.SuffixMatch
+ smProto = &v3matcherpb.StringMatcher{MatchPattern: &v3matcherpb.StringMatcher_Suffix{Suffix: ht.SuffixMatch}}
+ case *v3routepb.HeaderMatcher_ContainsMatch:
+ smProto = &v3matcherpb.StringMatcher{MatchPattern: &v3matcherpb.StringMatcher_Contains{Contains: ht.ContainsMatch}}
case *v3routepb.HeaderMatcher_StringMatch:
- sm, err := matcher.StringMatcherFromProto(ht.StringMatch)
- if err != nil {
- return nil, nil, fmt.Errorf("route %+v has an invalid string matcher: %v", err, ht.StringMatch)
+ if ht.StringMatch == nil {
+ return nil, nil, fmt.Errorf("route %+v has an empty string matcher", r)
}
- header.StringMatch = &sm
+ smProto = ht.StringMatch
default:
return nil, nil, fmt.Errorf("route %+v has an unrecognized header matcher: %+v", r, ht)
}
+ if smProto != nil {
+ sm, err := matcher.StringMatcherFromProto(smProto)
+ if err != nil {
+ return nil, nil, fmt.Errorf("route %+v has an invalid header matcher: %v", r, err)
+ }
+ header.StringMatch = &sm
+ }
header.Name = h.GetName()
invert := h.GetInvertMatch()
header.InvertMatch = &invert
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version/version.go b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version/version.go
index 82ad5fe..b194592 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version/version.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsclient/xdsresource/version/version.go
@@ -30,12 +30,15 @@
V3ClusterType = "envoy.config.cluster.v3.Cluster"
V3EndpointsType = "envoy.config.endpoint.v3.ClusterLoadAssignment"
- V3ResourceWrapperURL = googleapiPrefix + "envoy.service.discovery.v3.Resource"
- V3ListenerURL = googleapiPrefix + V3ListenerType
- V3RouteConfigURL = googleapiPrefix + V3RouteConfigType
- V3ClusterURL = googleapiPrefix + V3ClusterType
- V3EndpointsURL = googleapiPrefix + V3EndpointsType
- V3HTTPConnManagerURL = googleapiPrefix + "envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
- V3UpstreamTLSContextURL = googleapiPrefix + "envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext"
- V3DownstreamTLSContextURL = googleapiPrefix + "envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext"
+ V3ResourceWrapperURL = googleapiPrefix + "envoy.service.discovery.v3.Resource"
+ V3ListenerURL = googleapiPrefix + V3ListenerType
+ V3RouteConfigURL = googleapiPrefix + V3RouteConfigType
+ V3ClusterURL = googleapiPrefix + V3ClusterType
+ V3EndpointsURL = googleapiPrefix + V3EndpointsType
+ V3HTTPConnManagerURL = googleapiPrefix + "envoy.extensions.filters.network.http_connection_manager.v3.HttpConnectionManager"
+ V3UpstreamTLSContextURL = googleapiPrefix + "envoy.extensions.transport_sockets.tls.v3.UpstreamTlsContext"
+ V3DownstreamTLSContextURL = googleapiPrefix + "envoy.extensions.transport_sockets.tls.v3.DownstreamTlsContext"
+ V3HTTP11ProxyUpstreamTransportURL = googleapiPrefix + "envoy.extensions.transport_sockets.http_11_proxy.v3.Http11ProxyUpstreamTransport"
+ V3AddressURL = googleapiPrefix + "envoy.config.core.v3.Address"
+ V3AudienceURL = googleapiPrefix + "envoy.extensions.filters.http.gcp_authn.v3.Audience"
)
diff --git a/vendor/google.golang.org/grpc/internal/xds/xdsdepmgr/xds_dependency_manager.go b/vendor/google.golang.org/grpc/internal/xds/xdsdepmgr/xds_dependency_manager.go
index 7ce0218..c0a7a58 100644
--- a/vendor/google.golang.org/grpc/internal/xds/xdsdepmgr/xds_dependency_manager.go
+++ b/vendor/google.golang.org/grpc/internal/xds/xdsdepmgr/xds_dependency_manager.go
@@ -498,6 +498,16 @@
}
func (m *DependencyManager) onListenerResourceUpdate(update *xdsresource.ListenerUpdate, onDone func()) {
+ // A client-side listener update must contain API listener configuration. If
+ // it is nil, it indicates that a server-side listener (TCP Listener) resource
+ // was received instead. We report this error to the resolver watcher so it
+ // can transition the channel into TRANSIENT_FAILURE.
+ if update.APIListener == nil {
+ err := fmt.Errorf("client-side listener resource %q does not contain API listener configuration", m.ldsResourceName)
+ m.onListenerResourceError(err, onDone)
+ return
+ }
+
m.mu.Lock()
defer m.mu.Unlock()
@@ -512,7 +522,7 @@
m.listenerWatcher.setLastUpdate(update)
- if update.APIListener != nil && update.APIListener.InlineRouteConfig != nil {
+ if update.APIListener.InlineRouteConfig != nil {
// If there was a previous route config watcher because of a non-inline
// route configuration, cancel it.
m.rdsResourceName = ""
@@ -527,10 +537,6 @@
// We get here only if there was no inline route configuration. If the route
// config name has not changed, send an update with existing route
// configuration and the newly received listener configuration.
- if update.APIListener == nil {
- m.logger.Errorf("Received a listener resource with no api_listener configuration")
- return
- }
if m.rdsResourceName == update.APIListener.RouteConfigName {
m.maybeSendUpdateLocked()
return
diff --git a/vendor/google.golang.org/grpc/mem/buffer_pool.go b/vendor/google.golang.org/grpc/mem/buffer_pool.go
index 3b02b90..aa12137 100644
--- a/vendor/google.golang.org/grpc/mem/buffer_pool.go
+++ b/vendor/google.golang.org/grpc/mem/buffer_pool.go
@@ -59,10 +59,6 @@
internal.SetDefaultBufferPool = func(pool BufferPool) {
defaultBufferPool = pool
}
-
- internal.SetBufferPoolingThresholdForTesting = func(threshold int) {
- bufferPoolingThreshold = threshold
- }
}
// DefaultBufferPool returns the current default buffer pool. It is a BufferPool
diff --git a/vendor/google.golang.org/grpc/mem/buffers.go b/vendor/google.golang.org/grpc/mem/buffers.go
index 2b410b1..9b355d4 100644
--- a/vendor/google.golang.org/grpc/mem/buffers.go
+++ b/vendor/google.golang.org/grpc/mem/buffers.go
@@ -29,6 +29,8 @@
"fmt"
"sync"
"sync/atomic"
+
+ "google.golang.org/grpc/internal/mem"
)
// A Buffer represents a reference counted piece of data (in bytes) that can be
@@ -63,8 +65,6 @@
}
var (
- bufferPoolingThreshold = 1 << 10
-
bufferObjectPool = sync.Pool{New: func() any { return new(buffer) }}
)
@@ -72,7 +72,7 @@
// equal to the threshold for buffer pooling. This is used to determine whether
// to pool buffers or allocate them directly.
func IsBelowBufferPoolingThreshold(size int) bool {
- return size <= bufferPoolingThreshold
+ return size <= mem.BufferPoolingThreshold
}
type buffer struct {
diff --git a/vendor/google.golang.org/grpc/stream.go b/vendor/google.golang.org/grpc/stream.go
index 4aac644..51aff85 100644
--- a/vendor/google.golang.org/grpc/stream.go
+++ b/vendor/google.golang.org/grpc/stream.go
@@ -201,6 +201,15 @@
}
}
+// clientInterceptor is structurally identical to the ClientInterceptor defined
+// in internal/xds/httpfilter/httpfilter.go. It is defined locally here so that
+// we can type-assert the generic Interceptor field in iresolver.RPCConfig
+// without introducing a dependency on xDS packages.
+type clientInterceptor interface {
+ NewStream(ctx context.Context, ri iresolver.RPCInfo, newStream func(ctx context.Context, opts ...CallOption) (ClientStream, error), opts ...CallOption) (ClientStream, error)
+ Close()
+}
+
func newClientStream(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, opts ...CallOption) (_ ClientStream, err error) {
if channelz.IsOn() {
cc.incrCallsStarted()
@@ -244,8 +253,11 @@
mc := &emptyMethodConfig
var onCommit func()
- newStream := func(ctx context.Context, done func()) (iresolver.ClientStream, error) {
- return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, done, nameResolutionDelayed, opts...)
+ newStream := func(ctx context.Context, filterOpts ...CallOption) (ClientStream, error) {
+ if filterOpts != nil {
+ opts = combine(opts, filterOpts)
+ }
+ return newClientStreamWithParams(ctx, desc, cc, method, mc, onCommit, nameResolutionDelayed, opts...)
}
rpcInfo := iresolver.RPCInfo{Context: ctx, Method: method}
@@ -270,20 +282,24 @@
if rpcConfig.Interceptor != nil {
rpcInfo.Context = nil
ns := newStream
- newStream = func(ctx context.Context, done func()) (iresolver.ClientStream, error) {
- cs, err := rpcConfig.Interceptor.NewStream(ctx, rpcInfo, done, ns)
- if err != nil {
- return nil, toRPCErr(err)
+ if interceptor, ok := rpcConfig.Interceptor.(clientInterceptor); ok {
+ newStream = func(ctx context.Context, filterOpts ...CallOption) (ClientStream, error) {
+ cs, err := interceptor.NewStream(ctx, rpcInfo, ns, filterOpts...)
+ if err != nil {
+ return nil, toRPCErr(err)
+ }
+ return cs, nil
}
- return cs, nil
+ } else {
+ return nil, status.Errorf(codes.Internal, "invalid client interceptor type %T", rpcConfig.Interceptor)
}
}
}
- return newStream(ctx, func() {})
+ return newStream(ctx)
}
-func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc *serviceconfig.MethodConfig, onCommit, doneFunc func(), nameResolutionDelayed bool, opts ...CallOption) (_ iresolver.ClientStream, err error) {
+func newClientStreamWithParams(ctx context.Context, desc *StreamDesc, cc *ClientConn, method string, mc *serviceconfig.MethodConfig, onCommit func(), nameResolutionDelayed bool, opts ...CallOption) (_ ClientStream, err error) {
callInfo := defaultCallInfo()
if mc.WaitForReady != nil {
callInfo.failFast = !*mc.WaitForReady
@@ -321,7 +337,6 @@
Host: cc.authority,
Method: method,
ContentSubtype: callInfo.contentSubtype,
- DoneFunc: doneFunc,
Authority: callInfo.authority,
}
if allowed := callInfo.acceptedResponseCompressors; len(allowed) > 0 {
diff --git a/vendor/google.golang.org/grpc/version.go b/vendor/google.golang.org/grpc/version.go
index a9dbafb..64ec3b3 100644
--- a/vendor/google.golang.org/grpc/version.go
+++ b/vendor/google.golang.org/grpc/version.go
@@ -19,4 +19,4 @@
package grpc
// Version is the current grpc version.
-const Version = "1.82.2"
+const Version = "1.83.1"
diff --git a/vendor/google.golang.org/grpc/xds/googledirectpath/googlec2p.go b/vendor/google.golang.org/grpc/xds/googledirectpath/googlec2p.go
index 50f6488..ed0e8e2 100644
--- a/vendor/google.golang.org/grpc/xds/googledirectpath/googlec2p.go
+++ b/vendor/google.golang.org/grpc/xds/googledirectpath/googlec2p.go
@@ -136,24 +136,38 @@
return nil, fmt.Errorf("google-c2p URI scheme does not support authorities")
}
- if !runDirectPath() {
+ isGCE := onGCE()
+ // We check only for the presence of the "force-xds" query parameter key,
+ // and do not evaluate its value.
+ _, forceXDS := t.URL.Query()["force-xds"]
+ if !forceXDS && !isGCE {
// If not xDS, fallback to DNS.
t.URL.Scheme = dnsName
return resolver.Get(dnsName).Build(t, cc, opts)
}
- // Note that the following calls to getZone() and getIPv6Capable() does I/O,
- // and has 10 seconds timeout each.
- //
- // This should be fine in most of the cases. In certain error cases, this
- // could block Dial() for up to 10 seconds (each blocking call has its own
- // goroutine).
- zoneCh, ipv6CapableCh := make(chan string), make(chan bool)
- go func() { zoneCh <- getZone(httpReqTimeout) }()
- go func() { ipv6CapableCh <- getIPv6Capable(httpReqTimeout) }()
+ var zone string
+ var ipv6Capable bool
+ if forceXDS {
+ // If the force-xds query parameter is present, GCE metadata server
+ // queries are bypassed.
+ zone = ""
+ ipv6Capable = true
+ } else {
+ // Note that the following calls to getZone() and getIPv6Capable() does I/O,
+ // and has 10 seconds timeout each.
+ //
+ // This should be fine in most of the cases. In certain error cases, this
+ // could block Dial() for up to 10 seconds (each blocking call has its own
+ // goroutine).
+ var wg sync.WaitGroup
+ wg.Go(func() { zone = getZone(httpReqTimeout) })
+ wg.Go(func() { ipv6Capable = getIPv6Capable(httpReqTimeout) })
+ wg.Wait()
+ }
xdsServerURI := getXdsServerURI()
- nodeCfg := newNodeConfig(<-zoneCh, <-ipv6CapableCh)
+ nodeCfg := newNodeConfig(zone, ipv6Capable, forceXDS)
xdsServerCfg := newXdsServerConfig(xdsServerURI)
authoritiesCfg := newAuthoritiesConfig(xdsServerCfg)
@@ -203,10 +217,16 @@
return c2pScheme
}
-func newNodeConfig(zone string, ipv6Capable bool) map[string]any {
+func newNodeConfig(zone string, ipv6Capable bool, forceXDS bool) map[string]any {
+ prefix := "C2P"
+ if forceXDS {
+ prefix = "C2P-non-gcp"
+ }
node := map[string]any{
- "id": fmt.Sprintf("C2P-%d", randInt()),
- "locality": map[string]any{"zone": zone},
+ "id": fmt.Sprintf("%s-%d", prefix, randInt()),
+ }
+ if zone != "" {
+ node["locality"] = map[string]any{"zone": zone}
}
// Enable dualstack endpoints in TD.
if ipv6Capable {
@@ -228,10 +248,3 @@
"server_features": []any{"ignore_resource_deletion"},
}
}
-
-// runDirectPath returns whether this resolver should use direct path.
-//
-// direct path is enabled if this client is running on GCE.
-func runDirectPath() bool {
- return onGCE()
-}
diff --git a/vendor/modules.txt b/vendor/modules.txt
index e59b13b..0a2a244 100644
--- a/vendor/modules.txt
+++ b/vendor/modules.txt
@@ -8,10 +8,12 @@
cloud.google.com/go/internal/optional
cloud.google.com/go/internal/trace
cloud.google.com/go/internal/version
-# cloud.google.com/go/auth v0.18.1
+# cloud.google.com/go/auth v0.18.2
## explicit; go 1.24.0
cloud.google.com/go/auth
cloud.google.com/go/auth/credentials
+cloud.google.com/go/auth/credentials/idtoken
+cloud.google.com/go/auth/credentials/impersonate
cloud.google.com/go/auth/credentials/internal/externalaccount
cloud.google.com/go/auth/credentials/internal/externalaccountuser
cloud.google.com/go/auth/credentials/internal/gdch
@@ -44,7 +46,7 @@
cloud.google.com/go/logging/apiv2
cloud.google.com/go/logging/apiv2/loggingpb
cloud.google.com/go/logging/internal
-# cloud.google.com/go/longrunning v0.7.0
+# cloud.google.com/go/longrunning v0.8.0
## explicit; go 1.24.0
cloud.google.com/go/longrunning
cloud.google.com/go/longrunning/autogen
@@ -134,6 +136,7 @@
github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/ring_hash/v3
github.com/envoyproxy/go-control-plane/envoy/extensions/load_balancing_policies/wrr_locality/v3
github.com/envoyproxy/go-control-plane/envoy/extensions/rbac/audit_loggers/stream/v3
+github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/http_11_proxy/v3
github.com/envoyproxy/go-control-plane/envoy/extensions/transport_sockets/tls/v3
github.com/envoyproxy/go-control-plane/envoy/service/discovery/v3
github.com/envoyproxy/go-control-plane/envoy/service/load_stats/v3
@@ -252,7 +255,7 @@
## explicit; go 1.25.0
github.com/googleapis/enterprise-certificate-proxy/client
github.com/googleapis/enterprise-certificate-proxy/client/util
-# github.com/googleapis/gax-go/v2 v2.16.0
+# github.com/googleapis/gax-go/v2 v2.17.0
## explicit; go 1.24.0
github.com/googleapis/gax-go/v2
github.com/googleapis/gax-go/v2/apierror
@@ -455,7 +458,7 @@
# golang.org/x/time v0.15.0
## explicit; go 1.25.0
golang.org/x/time/rate
-# google.golang.org/api v0.262.0
+# google.golang.org/api v0.264.0
## explicit; go 1.24.0
google.golang.org/api/googleapi
google.golang.org/api/googleapi/transport
@@ -474,7 +477,7 @@
google.golang.org/api/transport
google.golang.org/api/transport/grpc
google.golang.org/api/transport/http
-# google.golang.org/genproto v0.0.0-20251202230838-ff82c1b0f217
+# google.golang.org/genproto v0.0.0-20260128011058-8636f8732409
## explicit; go 1.24.0
google.golang.org/genproto/googleapis/logging/type
google.golang.org/genproto/googleapis/type/calendarperiod
@@ -495,7 +498,7 @@
google.golang.org/genproto/googleapis/rpc/code
google.golang.org/genproto/googleapis/rpc/errdetails
google.golang.org/genproto/googleapis/rpc/status
-# google.golang.org/grpc v1.82.2
+# google.golang.org/grpc v1.83.1
## explicit; go 1.25.0
google.golang.org/grpc
google.golang.org/grpc/attributes
@@ -534,6 +537,7 @@
google.golang.org/grpc/credentials/alts/internal/handshaker/service
google.golang.org/grpc/credentials/alts/internal/proto/grpc_gcp
google.golang.org/grpc/credentials/google
+google.golang.org/grpc/credentials/google/internal
google.golang.org/grpc/credentials/insecure
google.golang.org/grpc/credentials/jwt
google.golang.org/grpc/credentials/oauth