Repository navigation
Conversation
keys.tdb only holds the hash, so a passphrase cannot be recovered from it. keydb.py now records the plaintext in keys.passphrases.tdb, which the daemon never opens, after its keys.tdb commit. A record is only returned while it still matches the entry's key.
The admin edit page gets a Show button that fetches the passphrase on demand. Admin add, admin edit and owner changes record it once keys.tdb has committed, and delete forgets it. Each view is logged. Sessions are now tied to the entry's key as well as its port2, so a cookie for a deleted entry cannot be reused when the port is given to a new (possibly admin) entry, and a passphrase change ends other sessions.
|
Automated review note — AI-generated (Claude+Codex), validated against the live diff. Please sanity-check before acting. Reviewed at head This adds a careful admin passphrase view with no blocking issues; there are two low-severity suggestions. Suggestions
Minor (1)
|
|
Not a good idea @tridge . I don't think the plain text passphrase should be stored or viewable. This should have the same protections as a password on Unix. |
I keep getting users asking me what their passphrase is, I can reset it for them, but that means transmitting it to them over discord or similar, this seems a lesser evil |
Sorry, it may be more convenient for you, but it's very bad security practice. Sending passwords "out of band" is actually far better than storing them, but the right answer is to provide a self serve password reset option. |
timtuxworth
left a comment
There was a problem hiding this comment.
Codex provided adversarial review:-
Security review of SupportProxy PR #58
Request changes. The linked comment identifies the right product fix. Give users a way to set a new passphrase. The PR gives every web admin access to existing credentials that work for both dashboard login and MAVLink signing. I reviewed all 14 changed files at 619f923eb2 and traced the daemon’s key-loading path. These are static findings. I ran no tests and made no requests to a deployed proxy. PR #58 · Linked discussion
PR findings
[P1] One compromised admin session can expose every recorded passphrase
passdb_lib.record() saves the original text, including passphrases owners set themselves. show_passphrase() returns it to any current admin with a valid session and CSRF token, with no fresh authentication. Admins can already reset an entry. Reading its existing secret leaves the owner’s login and clients working, so the owner may see no disruption. 0600 limits filesystem access, no-store limits HTTP caching, and the audit entry records the disclosure after access is granted. Plaintext store · Reveal route
Suggested change. Drop the plaintext database and Show route. Keep the transaction-time admin checks and replace Show with reset.
[P1] Revoked web sessions can become valid again
The session fingerprint is deterministic for a given signing key. At the same port2, restoring a prior passphrase restores the prior session fingerprint. Deleting and recreating an entry with the same port and passphrase has the same result, and the old cookie picks up the replacement entry’s current role. The port-reuse test only covers a replacement with a different passphrase. Session validation · Port-reuse test
Suggested change. Persist a random per-entry session generation, bind the cookie to it, and replace it transactionally on creation and credential rotation. Retain the signing-key fingerprint to detect daemon-side key changes, and update the generation on that path too.
[P2] The reveal releases its authorization transaction before reading the secret
A demotion can commit after still_admin() succeeds and before passdb_lib.lookup() retrieves the plaintext. The existing test covers demotion before the second authorization check. Reveal transaction · Demotion test
Suggested change. If Show survives review, keep the lookup inside the same keys.tdb transaction as the caller and target checks.
How I’d implement reset
Start with admin-issued, owner-completed reset. SupportProxy identifies owners by port and passphrase today. Fully self-service recovery needs a verified recovery channel first. An admin can verify the owner through an established contact and send a short-lived, single-use reset link. Generate the token with secrets.token_urlsafe(32) and store only its digest, expiry, and entry generation. Consume it on the reset POST in the same transaction that calls ke.set_passphrase(), changes the session generation, and saves the entry. Audit the reset without logging the token or either passphrase. Current login flow · OWASP reset guidance
Make the reset revoke live signing access too. This is an existing gap the reset would inherit. The daemon loads the signing key when a channel initializes, and the listener reload doesn’t look at changes to that key. Have the daemon retire or rekey affected signed connections when the key changes, and have its signing-key update handler compare the channel’s key with the current database key before accepting a change. Test that an established connection using the retired key loses access. Channel initialization · Listener reload · Signing-key update
The PR reports that it was deployed on FireVPS. If that deployment recorded real credentials, disable reveal, coordinate rotation for the affected entries, and handle the plaintext database and any retained copies as credential material. Deployment note
you (and codex) are wrong. The way the signing system works if you have a copy of the hash (which is what we store now) then you can login. So having the plain-text makes no difference at all to the security of the system. You've probably read something about the password hashes in unix systems and they work quite differently. There are good reasons for the way signing works, and the design is a widely used one for auth systems. |
keys.tdb only holds sha256(passphrase), which is the MAVLink signing key, so an admin had no way to look up an ID's passphrase. This records the plaintext in a separate database so admins can view it from the admin edit page.
Storage
keys.passphrases.tdbsits next to keys.tdb and is created mode 0600. Only the webadmin andkeydb.pyuse it; the daemon never opens it, and the keys.tdb record layout is unchanged.keydb.py add/setpass. Deleting an ID (keydb.py remove, admin delete) forgets it. Writes happen only after the keys.tdb commit, and are best effort: a failure is logged and reported, but does not undo the saved change.Viewing
/admin/<port2>/passphrase, which returns JSON withCache-Control: no-store. The passphrase is never rendered into the page, and the page clears it onpagehideso going back doesn't show it from the page cache.Sessions
Testing
Known limits
docker/Dockerfilenow copiespassdb_lib.py, whichkeydb.pyimports.