Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,15 @@ func parseClaim(raw []byte, name string, v interface{}) error {
//
// token, err := verifier.Verify(ctx, rawIDToken)
func (v *IDTokenVerifier) Verify(ctx context.Context, rawIDToken string) (*IDToken, error) {
if strings.Count(rawIDToken, ".") > 2 {
// Older versions of go-jose are vulnerable to a scenario where
// strings.Cut(token, ".") can lead to excessive allocations. Since the
// "v2" branch of this repo explicitly doesn't update its dependencies
// at the request of Kubernetes, add a check here first.
//
// https://github.com/go-jose/go-jose/security/advisories/GHSA-c6gw-w398-hv78
return nil, fmt.Errorf("oidc: malformed jwt")
}
jws, err := jose.ParseSigned(rawIDToken)
if err != nil {
return nil, fmt.Errorf("oidc: malformed jwt: %v", err)
Expand Down
Loading