{"record":{"id":"112f555dee061950","repo":"kubernetes/kops","slug":"fetched-certificate-is-required","errorCode":null,"errorMessage":"fetched certificate is required","messagePattern":"fetched certificate is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/attest.go","lineNumber":465,"sourceCode":"\t\treturn nil, fmt.Errorf(\"intermediate certificate from %s exceeds %d bytes\", url, intermediateCertMaxResponseBytes)\n\t}\n\n\tcert, err := x509.ParseCertificate(body)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing intermediate certificate from %s: %w\", url, err)\n\t}\n\treturn cert, nil\n}\n\n// validateFetchedIntermediateForSigner checks that a fetched intermediate is actually the issuer\n// referenced by the signer certificate before it is used or cached. This is a structural check\n// only; the cryptographic signature is verified later by verifySignerCertChain.\nfunc validateFetchedIntermediateForSigner(signer *x509.Certificate, cert *x509.Certificate) error {\n\tif signer == nil {\n\t\treturn fmt.Errorf(\"signer certificate is required\")\n\t}\n\tif cert == nil {\n\t\treturn fmt.Errorf(\"fetched certificate is required\")\n\t}\n\tif !cert.IsCA {\n\t\treturn fmt.Errorf(\"fetched certificate is not a CA certificate\")\n\t}\n\t// Require at least one issuer identifier so the per-field length guards below cannot silently\n\t// degrade to \"no identity check\" if both fields happen to be empty.\n\tif len(signer.RawIssuer) == 0 && len(signer.AuthorityKeyId) == 0 {\n\t\treturn fmt.Errorf(\"signer certificate has neither RawIssuer nor AuthorityKeyId set\")\n\t}\n\tif len(signer.RawIssuer) > 0 && !bytes.Equal(cert.RawSubject, signer.RawIssuer) {\n\t\treturn fmt.Errorf(\"fetched certificate subject does not match signer issuer\")\n\t}\n\tif len(signer.AuthorityKeyId) > 0 && !bytes.Equal(cert.SubjectKeyId, signer.AuthorityKeyId) {\n\t\treturn fmt.Errorf(\"fetched certificate subject key identifier does not match signer authority key identifier\")\n\t}\n\n\treturn nil\n}","sourceCodeStart":447,"sourceCodeEnd":483,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/attest.go#L447-L483","documentation":"Guard in validateFetchedIntermediateForSigner: the candidate certificate argument is nil, so issuer matching cannot proceed. A caller bug in the intermediate-fetch path, not attacker input.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/azure/attest.go:465 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the caller to pass the parsed (non-nil) intermediate certificate","Check the fetch step for how a nil certificate escaped"],"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-12T07:17:12.445Z"}