{"record":{"id":"877c7bd07363b687","repo":"kubernetes/kops","slug":"parsing-resource-id-w","errorCode":null,"errorMessage":"parsing resource ID: %w","messagePattern":"parsing resource ID: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"upup/pkg/fi/cloudup/azure/verifier.go","lineNumber":118,"sourceCode":"\n// VerifyToken validates the Azure attestation token, confirms the claimed VM through the Azure API,\n// and returns the node bootstrap identity.\nfunc (a azureVerifier) VerifyToken(ctx context.Context, rawRequest *http.Request, token string, body []byte) (*bootstrap.VerifyResult, error) {\n\tif !strings.HasPrefix(token, azuremetadata.AzureAuthenticationTokenPrefix) {\n\t\treturn nil, bootstrap.ErrNotThisVerifier\n\t}\n\n\t// Token format: \"x-azure-id <resourceID> <base64-pkcs7-signature>\"\n\ttokenPayload := strings.TrimPrefix(token, azuremetadata.AzureAuthenticationTokenPrefix)\n\tresourceID, signature, ok := strings.Cut(tokenPayload, \" \")\n\tif !ok || resourceID == \"\" || signature == \"\" {\n\t\treturn nil, fmt.Errorf(\"incorrect token format\")\n\t}\n\n\t// Parse the resource ID early to reject malformed tokens before expensive crypto.\n\tres, err := arm.ParseResourceID(resourceID)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"parsing resource ID: %w\", err)\n\t}\n\tvmLogID := vmLogIDFromResource(res)\n\tresourceType := res.ResourceType.String()\n\tklog.V(4).Infof(\"Azure verifier for VM %q parsed resource ID: subscription=%q resourceGroup=%q\", vmLogID, res.SubscriptionID, res.ResourceGroupName)\n\n\t// Reject resource IDs outside the verifier's own subscription / resource group. The Azure API lookup below\n\t// is already scoped to kops-controller's subscription and resource group, so any claim that names a different\n\t// location cannot describe a cluster VM. Failing here avoids a wasted Azure API call and makes the scope\n\t// explicit instead of implicit.\n\tif !strings.EqualFold(res.SubscriptionID, a.client.subscriptionID) {\n\t\treturn nil, fmt.Errorf(\"resource ID subscription %q does not match verifier subscription %q\", res.SubscriptionID, a.client.subscriptionID)\n\t}\n\tif !strings.EqualFold(res.ResourceGroupName, a.client.resourceGroup) {\n\t\treturn nil, fmt.Errorf(\"resource ID resource group %q does not match verifier resource group %q\", res.ResourceGroupName, a.client.resourceGroup)\n\t}\n\tswitch resourceType {\n\tcase vmResourceType:\n\tcase vmssVMResourceType:","sourceCodeStart":100,"sourceCodeEnd":136,"githubUrl":"https://github.com/kubernetes/kops/blob/4c8573c808a73d578c5eadc86d410646ea0b0d73/upup/pkg/fi/cloudup/azure/verifier.go#L100-L136","documentation":"The <resourceID> part of the Azure attestation token could not be parsed into an Azure resource ID (subscription/resource group/type/name structure), so the claimed VM cannot be resolved through the Azure API.","triggerScenarios":"Thrown at upup/pkg/fi/cloudup/azure/verifier.go:118 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Reject the bootstrap token; the resource ID is malformed or forged","Regenerate the token on the node","Verify the node is constructing the token from genuine IMDS-provided metadata"],"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"}