Vault cleanup: dead ctEqual, and a PrincipalKind union #145
Labels
No labels
bug
duplicate
enhancement
help wanted
invalid
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lz/agent-nexus#145
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?
Two small items from the
/pr-reviewpass overfeat/mcp. Neither is urgent; both are cheap.1.
ctEqualis dead codecrypto/vault.ts:39. Grepped: the only callers are its own tests (crypto/vault.test.ts). It was written for the verifier check, but even onmainthat check usedpt.equals(VERIFIER_PLAINTEXT), notctEqual— so it has been dead since before envelope encryption, not because of it.feat/mcpretires the verifier entirely, so its docstring ("Constant-time compare for verifier checks etc.") now names a concept that no longer exists.Either delete it plus its three tests (~5 + ~12 lines), or keep it and fix the comment. Deleting is my preference — a constant-time compare is easy to re-add correctly, and a dead one invites someone to reach for it in a context where
timingSafeEqual's length-leak matters.Same file, unrelated:
callerSidinrotate-passphrase/+server.tsis accepted,void-ed, and documented as "for future use". Also pre-existing.2.
principal_kind/principal_idare barestringauth/vault-envelope.tsandVaultKeysTableindb/schema.ts. The schema comment already names the intended vocabulary ('master' | 'user' | 'token') but the type does not enforce it, so a typo compiles clean.Failure mode if one ever slipped through:
principalExistsreturns false →isSetupCompletefalse →/api/statesaysneeds-setup→ operator is routed to/setup→ new DEK over a live vault. Same endpoint as #143, different cause.A union type makes it a compile error. This was deliberately deferred when the table landed (one principal, no second caller yet); worth revisiting when the second principal arrives — i.e. alongside #140.