{"record":{"id":"9d287e80c7bbc2b4","repo":"passbolt/passbolt_api","slug":"the-sso-key-id-should-be-a-uuid","errorCode":null,"errorMessage":"The SSO key id should be a uuid.","messagePattern":"The SSO key id should be a uuid\\.","errorType":"http","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Controller/Keys/SsoKeysDeleteController.php","lineNumber":35,"sourceCode":"namespace Passbolt\\Sso\\Controller\\Keys;\n\nuse App\\Controller\\AppController;\nuse Cake\\Http\\Exception\\BadRequestException;\nuse Cake\\Validation\\Validation;\nuse Passbolt\\Sso\\Service\\SsoKeys\\SsoKeysDeleteService;\n\nclass SsoKeysDeleteController extends AppController\n{\n    /**\n     * Delete a given SSO Passphrase Key\n     *\n     * @param string $id uuid key id\n     * @return void\n     */\n    public function delete(string $id): void\n    {\n        if (!Validation::uuid($id)) {\n            throw new BadRequestException(__('The SSO key id should be a uuid.'));\n        }\n\n        $uac = $this->User->getAccessControl();\n        (new SsoKeysDeleteService())->delete($uac, $id);\n\n        $this->success(__('The operation was successful'));\n    }\n}\n","sourceCodeStart":17,"sourceCodeEnd":44,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Controller/Keys/SsoKeysDeleteController.php#L17-L44","documentation":"Thrown by SsoKeysDeleteController::delete() when the {id} route parameter is not a valid UUID. The key id path segment must be a uuid before SsoKeysDeleteService attempts deletion; anything else is rejected with a 400.","triggerScenarios":"DELETE /sso/keys/<id> where <id> is an integer, a name like 'my-key', an empty string, or a malformed/truncated uuid.","commonSituations":"Client stored key id from a different API shape (numeric primary key); URL interpolation bug producing 'undefined' or 'null' in the path; copy-paste with trailing characters.","solutions":["Pass the SSO key's uuid as returned by the SSO keys list/create endpoints","Fix client URL interpolation — log the final URL to catch 'undefined' ids","Validate the id with a UUID regex before issuing the DELETE","Check for double-encoding or truncation of the id in transit"],"exampleFix":"// before\nawait api.delete(`/sso/keys/${key.numeric_id}`);\n// after\nawait api.delete(`/sso/keys/${key.id}`); // key.id = 'e3b0c442-98fc-...uuid'","handlingStrategy":"validation","validationCode":"const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;\nif (!UUID_RE.test(keyId)) throw new Error(`SSO key id must be a uuid, got: ${keyId}`);","typeGuard":"function isUuid(v: unknown): v is string {\n  return typeof v === 'string' && /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i.test(v);\n}","tryCatchPattern":"try {\n  await deleteSsoKey(keyId);\n} catch (e) {\n  if (e.response?.status === 400 && e.response?.data?.message?.includes('should be a uuid')) {\n    // re-fetch the key list to get valid uuid ids\n  }\n}","preventionTips":["Store key ids exactly as returned by the API (uuids)","Log interpolated URLs to catch undefined/null ids","Validate route params with a uuid regex before HTTP calls"],"tags":["sso","bad-request","uuid"],"backgroundTag":"invalid-identifier-format","analyzedSha":"31c1bbc10f32808a607fa9bd81891e898779c0bc","analyzedAt":"2026-09-17T00:04:38.960Z","contentChangedAt":"2026-09-17T00:04:38.960Z","schemaVersion":2},"datasetVersion":"2026-09-21T04:17:39.646Z"}