create_account persists the generated nsec as plaintext hex in the config file #58
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
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?
src/daemon/admin/commands/create_account.ts:204writescurrentConfig.keys[keyName] = { key: Buffer.from(sk).toString('hex') }andrun.ts:213-222loads such entries unencrypted at boot. Keys created viaadd/create_new_keygo throughencryptNsec; signup keys bypass encryption-at-rest entirely and leave two storage formats the loader treats differently.Impact: on any deployment that enables the signup flow, one config-file disclosure is a full key compromise for every hosted account. (Our
create_new_keypath is not affected.)Fix direction: route signup keys through
encryptNsecunder the daemon's autounlock master secret (NSEC_BUNKER_AUTOUNLOCK_PASSPHRASE[_FILE], already resolved inrun.ts maybeAutounlock), and fail closed — refuse the signup — when no master secret is configured. Unify the stored shape so the loader never accepts a raw{key}. Sandbox PR sandbox-team/nsecbunkerd#25 commit 2 (resolveMasterPassphraseshared by autounlock and create_account,tests/account-key-encryption.test.ts) is a ready port. Do this together with or after the KDF/AEAD fix.Found during reforge run #1 (sandbox nsecbunkerd#6).