{"record":{"id":"1a8d6e46e783bc18","repo":"kubernetes/kops","slug":"decoding-sts-response-v","errorCode":null,"errorMessage":"decoding STS response: %v","messagePattern":"decoding STS response: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bootstrap/awsbootstrap/verifier.go","lineNumber":430,"sourceCode":"\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"sending STS request: %v\", err)\n\t}\n\tif response != nil {\n\t\tdefer response.Body.Close()\n\t}\n\n\tresponseBody, err := io.ReadAll(response.Body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"reading STS response: %v\", err)\n\t}\n\tif response.StatusCode != 200 {\n\t\treturn nil, fmt.Errorf(\"received status code %d from STS: %s\", response.StatusCode, string(responseBody))\n\t}\n\n\tcallerIdentity := &GetCallerIdentityResponse{}\n\terr = xml.NewDecoder(bytes.NewReader(responseBody)).Decode(callerIdentity)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"decoding STS response: %v\", err)\n\t}\n\n\treturn callerIdentity, nil\n}\n\n// GetCallerIdentityV1 will request the presigned token URL, and decode the returned identity.\nfunc (s *stsRequestValidator) getCallerIdentityV1(ctx context.Context, httpClient *http.Client, decoded awsV1Token) (*GetCallerIdentityResponse, error) {\n\t// Well-known V1 request body\n\tbody := []byte(\"Action=GetCallerIdentity&Version=2011-06-15\")\n\n\t// The host is not passed in V1 (a shortcoming of V1)\n\thost := s.Host\n\tstsURL := \"https://\" + host + \"/\"\n\n\treq, err := http.NewRequest(\"POST\", stsURL, bytes.NewReader(body))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"build STS request: %w\", err)\n\t}","sourceCodeStart":412,"sourceCodeEnd":448,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/pkg/bootstrap/awsbootstrap/verifier.go#L412-L448","documentation":"getCallerIdentityV2 wraps the XML decode failure of the STS GetCallerIdentity response. STS replies in XML; an undecodable body means a non-STS response was received (proxy error page, truncated body), and the node's caller identity cannot be verified.","triggerScenarios":"Thrown at pkg/bootstrap/awsbootstrap/verifier.go:430 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check for proxies rewriting STS responses","Retry the request","Verify the STS endpoint is genuine"],"exampleFix":null,"handlingStrategy":"retry","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-12T07:17:12.445Z"}