{"record":{"id":"efa20992e7e96731","repo":"kubernetes/kops","slug":"parsing-sts-request-url-v","errorCode":null,"errorMessage":"parsing STS request URL: %v","messagePattern":"parsing STS request URL: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bootstrap/awsbootstrap/verifier.go","lineNumber":233,"sourceCode":"\n\ttokenBytes, err := base64.StdEncoding.DecodeString(token)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding authorization token: %v\", err)\n\t}\n\tvar decoded awsV2Token\n\tif err := json.Unmarshal(tokenBytes, &decoded); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshalling authorization token: %v\", err)\n\t}\n\n\t// Verify the token has signed the body content.\n\tsha := sha256.Sum256(body)\n\tif decoded.SignedHeader.Get(\"X-Kops-Request-SHA\") != base64.RawStdEncoding.EncodeToString(sha[:]) {\n\t\treturn nil, fmt.Errorf(\"incorrect SHA\")\n\t}\n\n\treqURL, err := url.Parse(decoded.URL)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing STS request URL: %v\", err)\n\t}\n\tsignedHeaders := sets.New(strings.Split(reqURL.Query().Get(\"X-Amz-SignedHeaders\"), \";\")...)\n\tif !signedHeaders.Has(\"x-kops-request-sha\") {\n\t\treturn nil, fmt.Errorf(\"unexpected signed headers value\")\n\t}\n\n\tif !a.stsRequestValidator.isValidV2(reqURL) {\n\t\treturn nil, fmt.Errorf(\"invalid STS url: host=%q, path=%q\", reqURL.Host, reqURL.Path)\n\t}\n\n\tcallerIdentity, err := a.stsRequestValidator.getCallerIdentityV2(ctx, &a.client, &decoded)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\n\treturn verifyCallerIdentity(ctx, callerIdentity)\n}\n","sourceCodeStart":215,"sourceCodeEnd":251,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/bootstrap/awsbootstrap/verifier.go#L215-L251","documentation":"verifyTokenV2 wraps url.Parse failure on decoded.URL — the STS endpoint URL embedded in the signed token. A malformed URL means the token cannot be replayed to STS for GetCallerIdentity, so verification aborts; later checks further restrict the URL host to legitimate STS endpoints.","triggerScenarios":"Thrown at pkg/bootstrap/awsbootstrap/verifier.go:233 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Regenerate the presigned URL","Avoid characters that break URL parsing","Use matching kOps client/server versions"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4c8573c808a73d578c5eadc86d410646ea0b0d73","analyzedAt":"2026-09-05T04:13:19.212Z","contentChangedAt":"2026-09-05T04:13:19.212Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}