{"record":{"id":"7521fa230b7ced77","repo":"passbolt/passbolt_api","slug":"the-sso-setting-id-should-be-a-uuid-ssosettingsdeleteservice","errorCode":null,"errorMessage":"The SSO setting id should be a uuid.","messagePattern":"The SSO setting id should be a uuid\\.","errorType":"exception","errorClass":"BadRequestException","httpStatus":400,"severity":"error","filePath":"plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsDeleteService.php","lineNumber":50,"sourceCode":"    /**\n     * Event names\n     */\n    public const AFTER_DELETE_ACTIVE_SSO_SETTINGS_EVENT = 'sso.ssosettings.delete.active';\n\n    /**\n     * Delete a setting identified with its id\n     *\n     * @param \\App\\Utility\\ExtendedUserAccessControl $uac user access control\n     * @param string $id uuid setting id\n     * @throws \\Cake\\Http\\Exception\\BadRequestException if $id is not a valid uuid\n     * @throws \\Cake\\Http\\Exception\\NotFoundException if settings cannot be found\n     * @throws \\Cake\\Http\\Exception\\InternalErrorException if the settings could not be deleted\n     * @return void\n     */\n    public function delete(ExtendedUserAccessControl $uac, string $id): void\n    {\n        if (!Validation::uuid($id)) {\n            throw new BadRequestException(__('The SSO setting id should be a uuid.'));\n        }\n        $uac->assertIsAdmin();\n\n        $ssoSettingsTable = TableRegistry::getTableLocator()->get('Passbolt/Sso.SsoSettings');\n\n        try {\n            /** @var \\Passbolt\\Sso\\Model\\Entity\\SsoSetting $ssoSetting */\n            $ssoSetting = $ssoSettingsTable->find()->where(['id' => $id])->firstOrFail();\n        } catch (RecordNotFoundException $exception) {\n            throw new NotFoundException(__('The SSO setting does not exist.'), 404, $exception);\n        }\n\n        try {\n            $ssoSettingsTable->deleteQuery()\n                ->where(['id' => $id])\n                ->execute();\n        } catch (Exception $exception) {\n            throw new InternalErrorException(__('Could not delete the SSO settings.'), 500, $exception);","sourceCodeStart":32,"sourceCodeEnd":68,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/plugins/PassboltEe/Sso/src/Service/SsoSettings/SsoSettingsDeleteService.php#L32-L68","documentation":"SsoSettingsDeleteService::delete() validates the settings id with Validation::uuid() before any permission check or lookup. A malformed id yields BadRequestException 'The SSO setting id should be a uuid.'","triggerScenarios":"Calling delete($uac, $id) with an empty string, integer id, slug, or truncated UUID as $id.","commonSituations":"Frontend routing bugs passing URL segments instead of the id; legacy integer ids; copy/paste truncation; encoding artifacts (quotes, whitespace) around the id.","solutions":["Pass the settings entity UUID as returned by the API","Trim/validate the id client-side with a UUID check before calling delete()","Fix route/parameter extraction so the id comes from the correct request attribute"],"exampleFix":"// before\n$service->delete($uac, $this->request->getParam('pass')[0]); // may be a slug\n// after\n$id = $this->request->getParam('pass')[0];\nif (!Validation::uuid($id)) { throw new BadRequestException(__('The SSO setting id should be a uuid.')); }\n$service->delete($uac, $id);","handlingStrategy":"validation","validationCode":"if (!Validation::uuid($id)) { throw new BadRequestException(__('The SSO setting id should be a uuid.')); }","typeGuard":"function isUuid(?string $id): bool { return is_string($id) && (bool)preg_match('/^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$/i', $id); }","tryCatchPattern":"try { $service->delete($uac, $id); } catch (BadRequestException $e) { // surface id format error to the client }","preventionTips":["Validate UUIDs in controller/route layers","Never pass route segments blindly as ids","Trim and sanitize ids extracted from URLs"],"tags":["sso","validation","uuid","bad-request","passbolt"],"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"}