fix(diag): keep dezhban's own file paths out of the hostname pass - #70
Merged
Merged
Conversation
`doctor`'s control check names the socket it probed, and a default bundle reported it as `/var/db/dezhban/host-1`. The path is the answer to "which socket" — replacing it throws the diagnosis away and hides nothing, the direction docs/contribute/testing.md names by itself. It also counted a hostname in the legend that stands for a filename. `control.sock` satisfies hostRe (dotted, alphabetic last label) and keptSuffixes did not list `.sock`. Nor `.lock`, which has the same problem wherever a startup failure carries the run lock's path into the log. Both pass the two rules that list states: neither is a delegated TLD, and both names are dezhban's. Pre-existing — reproduced against v0.14.0's internal/redact, so it is not a regression from #67; found while probing the redactor after that release. `.zip` is NOT added and the comment now says why, because the bundle's own filename ends in it and that makes it the obvious next thing to add: `.zip` is a delegated gTLD, so rule 1 refuses it. TestADelegatedTLDIsNeverTreatedAsAFileExtension fails on `mullvad.zip` if anyone tries — a real provider name waved through by a suffix that looks like a file extension, which is the whole reason that rule exists. `.pkg` is left out for want of a root-zone check rather than a decision. Verified: task check, and a real `dezhban report` whose doctor.json now reads `unreachable (/var/db/dezhban/control.sock)` with nothing else leaked. Closes #68 Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Self-review of the previous commit, before anyone else read it. It added `.sock` and `.lock` to keptSuffixes, and that breaks rule 2 on that very list — the part in front has to be dezhban's, not the user's. `control.socket` is a config key. A suffix rule keeps whatever it points at, so a socket sitting beside the VPN it serves — `/var/run/nordvpn.sock` — would have shipped verbatim in a default bundle. That names the provider as plainly as a server address does, and it is exactly the trap `.conf` and `.ovpn` are kept off the list for. So: an exact-name map instead. `control.sock` is controlSocketPath's default basename and `dezhban.lock` is a constant; both are ours, neither is configurable, and a socket the user renamed goes back to being redacted. TestASocketTheUserNamedIsStillRedacted fails against the suffix version on nordvpn.sock, mullvad.sock and proton.lock. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #68.
doctor's control check names the socket it probed, and a default (redacted) bundle reported it as:The path is the answer to "which socket did it probe". Replacing it throws the diagnosis away and hides no identity — the direction
docs/contribute/testing.mdcalls out by itself — and it counts a hostname in the legend that stands for a filename.Why
control.socksatisfieshostRe(dotted, alphabetic last label), andkeepHostkept neither it nordezhban.lock, whose path a startup failure carries into the log.By name, not by file ending
The obvious fix is
.sockand.lockinkeptSuffixes. That is wrong, and this PR's first commit made the mistake before its second reverted it.control.socketis a config key. A suffix rule keeps whatever it points at, so a socket sitting beside the VPN it serves —/var/run/nordvpn.sock— would have shipped verbatim in a default bundle, naming the provider as plainly as a server address does. That is rule 2 onkeptSuffixes' own doc comment, and exactly why.confand.ovpnare kept off that list.So: a new exact-match
keptNames, consulted bykeepHostbesideallowedHosts.control.sockiscontrolSocketPath's default basename anddezhban.lockis a constant — both are dezhban's, neither is configurable, and a socket the user renamed goes back to being redacted..zipis deliberately NOT addedThe report bundle's own filename ends in
.zip, which makes it the obvious next thing someone adds — and it is what rule 1 refuses, because.zipis a delegated gTLD.TestADelegatedTLDIsNeverTreatedAsAFileExtensionfails onmullvad.zipif anyone tries: a real provider name waved straight through by a suffix that looks like a file extension..pkgis left out for want of a root-zone check rather than a decision; it reaches no bundle entry.Not a regression
Reproduced against
v0.14.0'sinternal/redact, so it predates #67 and the v0.15.0 release:Found while probing the redactor after that release.
Review loop
The loop's own finding is the
.sock/.locksuffix mistake above — named rather than absorbed, because it is the interesting part of this change and the first commit on the branch still contains it.Verification
task checkgreen; CI green. Every test was run against the code it guards:keptNames:control.sock was treated as a hostname: "wrote host-1", the socket path returns/var/db/dezhban/host-1, and the legend reads2 distinct hostnames → host-1 … host-2nordvpn.sock survived,mullvad.sock survived,proton.lock survived.zipwrongly added:mullvad.zip survived — a delegated TLD was treated as one of dezhban's file endingsPlus a real
dezhban report, whosedoctor.jsonnow readsunreachable (/var/db/dezhban/control.sock)with nothing else leaked.Still open from the same probe
#69 —
control.groupships unredacted in bothconfig.jsonand doctor's prose. Filed as a decision rather than a bug, and deliberately untouched here: a one-sided fix would leave the two entries disagreeing about the same value.🤖 Generated with Claude Code