{"record":{"id":"8f717b73d2571c02","repo":"passbolt/passbolt_api","slug":"the-anonymous-user-id-should-be-a-uuid","errorCode":null,"errorMessage":"The anonymous user id should be a UUID","messagePattern":"The anonymous user id should be a UUID","errorType":"exception","errorClass":"InternalErrorException","httpStatus":500,"severity":"error","filePath":"config/Migrations/20200108135000_V2130DropLegacyAnonymousUser.php","lineNumber":34,"sourceCode":"use Migrations\\AbstractMigration;\nuse Cake\\Validation\\Validation;\nuse Cake\\Http\\Exception\\InternalErrorException;\n\nclass V2130DropLegacyAnonymousUser extends AbstractMigration\n{\n    /**\n     * Up\n     *\n     * @return void\n     */\n    public function up()\n    {\n        // Some instances coming from v1 still have this unused user and should be dropped\n        $user = $this->fetchRow(\"SELECT id from users where username='anonymous@passbolt.com'\");\n        if(isset($user['id'])) {\n            $id = $user['id'];\n            if (!Validation::uuid($id)) {\n                throw new InternalErrorException('The anonymous user id should be a UUID');\n            }\n            $this->execute(\"DELETE from users where id='$id'\");\n            $this->execute(\"DELETE from gpgkeys where user_id='$id'\");\n            $this->execute(\"DELETE from profiles where user_id='$id'\");\n            $this->execute(\"DELETE from secrets where user_id='$id'\");\n            $this->execute(\"DELETE from authentication_tokens where user_id='$id'\");\n        }\n    }\n}\n","sourceCodeStart":16,"sourceCodeEnd":44,"githubUrl":"https://github.com/passbolt/passbolt_api/blob/31c1bbc10f32808a607fa9bd81891e898779c0bc/config/Migrations/20200108135000_V2130DropLegacyAnonymousUser.php#L16-L44","documentation":"Thrown by Gnupg::setSignKey when gnupg_addsignkey() fails for the just-imported armored key. GnuPG refused to register the key as a signing key — usually the passphrase is wrong, or the key lacks a secret signing-capable primary/subkey. The gnupg exception message is appended.","triggerScenarios":"Calling setSignKey($armoredKey, $passphrase) where import succeeds but addsignkey throws: wrong passphrase, public-only key, expired key, or key without signing capability.","commonSituations":"Configuring the server's public key instead of private for signing; passphrase mismatch after key rotation; expired/revoked server key; sign-only subkey stripped from an exported key.","solutions":["Verify the passphrase is correct.","Ensure the armored key is the private key and contains a signing-capable secret key/subkey.","Check key expiration/revocation with `gpg --list-keys`; extend or regenerate if expired.","Use gpg manually (`--sign` with the key) to isolate the gnupg-level cause.","Read the appended gnupg exception message for the exact error."],"exampleFix":"// before\n$gpg->setSignKey($publicArmoredKey, $pass); // cannot sign with public key\n// after\n$gpg->setSignKey($privateArmoredKey, $correctPass);","handlingStrategy":"validation","validationCode":"if (strpos($armoredKey, 'BEGIN PGP PRIVATE KEY BLOCK') === false) {\n    throw new InvalidArgumentException('setSignKey requires a private (secret) key');\n}\n","typeGuard":"function isArmoredPrivateKey(string $s): bool {\n    return is_string($s) && strpos($s, 'BEGIN PGP PRIVATE KEY BLOCK') !== false;\n}\n","tryCatchPattern":"try {\n    $gpg->setSignKey($key, $pass);\n} catch (\\Cake\\Core\\Exception\\Exception $e) {\n    $this->log('sign key rejected: ' . $e->getMessage());\n    throw new ServerKeyConfigurationException(previous: $e);\n}\n","preventionTips":["Verify key expiry dates before configuring a signing key.","Test signing manually: `gpg --local-user <fp> --clearsign /tmp/t`.","Confirm the exported private key retains signing-capable subkeys.","Validate passphrase + key pair once at application boot."],"tags":["openpgp","gnupg","signing","passphrase"],"backgroundTag":"invalid-argument-value","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"}