Derive Ed25519 signing key from JWT secret instead of storing in DB #121
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Current State
The Ed25519 config signing key pair is persisted in the
server_configPostgreSQL table as plaintext Base64 (commit81f1339). This was added to fix agents rejecting commands after server restarts (the key was previously ephemeral).Problem
The private signing key is stored unencrypted in the database. Anyone with DB read access can extract it and forge signed config payloads.
Proposed Fix
Derive the Ed25519 key deterministically from
CAMELEER_JWT_SECRETusing HKDF."cameleer3-ed25519-signing") to derive a 32-byte seedBenefits
CAMELEER_JWT_SECRETserver_configload/persist logicImplementation
Ed25519SigningServiceImpl(JdbcTemplate)constructor withEd25519SigningServiceImpl(String jwtSecret)javax.crypto.Macwith HMAC-SHA256 or a proper HKDF implementation to derive the 32-byte seedEdDSAParameterSpecor Bouncy CastleRisk