{"record":{"id":"9a8703b48fa1e7a8","repo":"kubernetes/kops","slug":"attested-document-subscriptionid-is-required","errorCode":null,"errorMessage":"attested document subscriptionId is required","messagePattern":"attested document subscriptionId is required","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/attest.go","lineNumber":288,"sourceCode":"// azuremetadata implementation keeps the authenticator and verifier sides identical.\nfunc nonceForBody(body []byte) string {\n\treturn azuremetadata.NonceForBody(body)\n}\n\n// parseAndValidateAttestedDocumentContent unmarshals the signed attestation payload and validates\n// its nonce and freshness timestamps.\nfunc parseAndValidateAttestedDocumentContent(content []byte, body []byte) (*attestedData, error) {\n\tvar data attestedData\n\tif err := json.Unmarshal(content, &data); err != nil {\n\t\treturn nil, fmt.Errorf(\"unmarshalling attested data: %w\", err)\n\t}\n\tklog.V(4).Infof(\"Attested document content: vmId=%q subscriptionId=%q createdOn=%q expiresOn=%q\", data.VMId, data.SubscriptionId, data.TimeStamp.CreatedOn, data.TimeStamp.ExpiresOn)\n\n\tif data.VMId == \"\" {\n\t\treturn nil, fmt.Errorf(\"attested document vmId is required\")\n\t}\n\tif data.SubscriptionId == \"\" {\n\t\treturn nil, fmt.Errorf(\"attested document subscriptionId is required\")\n\t}\n\n\t// Verify the nonce matches the request body hash (replay protection).\n\texpectedNonce := nonceForBody(body)\n\tif data.Nonce != expectedNonce {\n\t\treturn nil, fmt.Errorf(\"attested document nonce mismatch: got=%q expected=%q\", data.Nonce, expectedNonce)\n\t}\n\n\tnow := time.Now().UTC()\n\tif data.TimeStamp.CreatedOn == \"\" {\n\t\treturn nil, fmt.Errorf(\"attested document createdOn is required\")\n\t}\n\tcreatedOn, err := time.Parse(attestedDocumentTimeFormat, data.TimeStamp.CreatedOn)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing attested document creation: %w\", err)\n\t}\n\tif createdOn.After(now.Add(attestedDocumentMaxClockSkew)) {\n\t\treturn nil, fmt.Errorf(\"attested document createdOn %s is too far in the future\", data.TimeStamp.CreatedOn)","sourceCodeStart":270,"sourceCodeEnd":306,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/attest.go#L270-L306","documentation":"Guard on the unmarshalled attested document: subscriptionId is empty, so the attested subscription cannot be compared with the verifier's subscription for anti-replay-across-tenants protection. The signed payload is missing required identity data.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/azure/attest.go:288 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the attestation token","Regenerate the token on the node","Update kOps if Azure changed the attested document fields"],"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"}