Repository navigation
PrintVect 0.5.8: security fixes from the design review - #23
Merged
Merged
Conversation
From the owner's security review: the header carried SHA-256(PIN), which anyone who saw it could reuse as the password forever, and the host never slowed down wrong guesses. - PinProof (replaces PinHash): each job and hello carries nonce, time and pinProof = PBKDF2-HMAC-SHA256(PIN, salt = label, type, nonce, time, printerId, jobId, size; 20,000 rounds). JobClient makes it just before sending (fresh for every try). A proof made for another job, printer or size does not match; one more than 24 h from the host's clock is refused. The old "pin" hash is never compared: a host tells such a sender to update. - PinAttemptLimiter: 5 wrong PINs from one address -> the host checks that address again only after 15 minutes, doubling to at most 4 hours; a right PIN or a quiet day starts afresh. Refusals keep the job for Retry. - Hello: with a PIN, only PCs that prove it are listed under "PCs that use this PC". A client whose hello is refused stops saying hello to that host until its PIN changes, so a wrong PIN does not keep counting as tries. - PIN hints advise 8 or more characters. - Tests for the proof, replay, clock, outdated hash, the wait, and hello. - Version 0.5.8; protocol.md, README, SECURITY.md, CLAUDE.md, CHANGELOG, testing.md steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
From the owner's security review: when a host stopped answering, the client followed any PC that answered with the same PC name or printer id, both broadcast openly, and sent documents and the PIN proof there. A random host id alone would not help: any PC can ask the host for it. - HostIdentity: each host makes an RSA-2048 key on first start, kept in config.json (HostKey) protected with DPAPI for that PC (MachineProtection). Discovery and list replies carry the public key; a list request with a challenge gets hostSig over challenge, host name and the address the request reached (HostKeys). - RemotePrinter.HostKeyId: the key's fingerprint, proven with a challenge when the printer is added, or after the host's next answered hello for printers added before. - MovedHostCheck: following a host to a new address (discovery, or the search after a failed job, now trying every address heard for the name) and the PC-name fallback of TcpJobSender need the remembered key proven for that address. A refused PC gets nothing and the waiting job says why. Printers with no key yet, and hosts before 0.5.8, work as before. - Diagnostics shows whether the key is kept and how many printers know their host's key. - Tests: signatures, follow/refuse decisions (impostor, copied key, relayed answer, no key), a real host over loopback, the stored key. - protocol.md, SECURITY.md, README, CLAUDE.md, CHANGELOG, testing.md. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
From the owner's security review: every user may write in %ProgramData%\PrintVect, and PrintVect.Elevate (administrator) granted Users:Modify on spool\<id> without checking for a junction, so a standard user could plant one to a system folder before an admin added a printer. The same held for the folders it creates and deletes and for its log and result file. - SafeFolders (Core/Elevation): FirstLink walks every folder from the data folder down and reports a junction or symbolic link; CreateFolder and RefuseLinks throw LinkFoundException with a plain message. GrantUsersModify opens spool\<id> without following a link, checks it is that very folder (GetFinalPathNameByHandle against the data folder's real path) and sets the rule through that handle (NativeObjectSecurity), so it cannot be swapped in between. - PrintVect.Elevate: refuses to start when the data, spool or logs folder is a link; add-printer, folder deletion and the result file go through SafeFolders. The app checks the same before asking for permission, so the person sees the reason. - Tests: links found on the way (junction on Windows, symlink on Mono), nothing created through a linked parent, rights granted on the real folder and refused through a junction (Windows). - CHANGELOG, SECURITY.md, CLAUDE.md, testing.md steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
From the owner's security review: the host had no limit on connections, kept files that were not XPS (up to 200 MB each) and failed prints, and cleaned up old files only when sharing started. - ConnectionLimiter: at most 32 connections at once, 8 per address and 120 new ones a minute per address; more are closed at once and logged once a minute per address. - A connection must send its request header within 15 s (HeaderTimeout); the transfer then has its 5 minutes as before. - spool\incoming\ holds at most 1 GB (MaxIncomingBytes, with sizes of transfers in progress reserved) and a job must leave 256 MB free on the disk; older files no job waits for are deleted first, oldest first, and a job that still does not fit is refused with retry:true. - A file that is not XPS is deleted at once; files kept after a failed print are deleted after 24 hours by an hourly clean-up. Files of jobs still waiting or printing are never touched. - Tests: limiter rules, a silent connection closed, a third connection from one PC closed, the size cap with eviction, junk deleted, the sweep. - protocol.md, README, CLAUDE.md, CHANGELOG, testing.md steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
From the owner's security review: a release without a .sha256 installed after a size check only, and the verified setup program waited in %ProgramData%\PrintVect\updates, where every user may write, between its check and its start. - UpdateChecker.DownloadAsync refuses a release without a checksum file (nothing is downloaded) and returns a VerifiedSetup (path, SHA-256, size). - UpdateInstaller.Hold opens the setup with FileShare.Read, so nobody can write, delete or rename it or a folder above it, and checks size and SHA-256 again through that handle; Start launches the held file. The hold lasts until the setup ends (or this program is ended by it). A changed file is not started: "The update was not started: ...". - Tests: no checksum refused, the verified file held unchangeable (Windows), a file swapped after the download refused. - README, SECURITY.md, docs/releasing.md, CLAUDE.md, CHANGELOG, testing.md. Code signing remains the real fix (CODE_SIGNING.md). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
…elog From the owner's security review: every release reached every PC within a day, tested or not (0.5.4 to 0.5.7 all "awaiting test"), and the release text did not say what changed. - release.yml publishes a TEST version by default (Run workflow, stage test; a pushed tag too): a GitHub pre-release, which installed PCs never take because they ask for the "latest release". Stage everyone publishes straight to every PC. A release made on the website keeps the owner's choice and gets the text when none was typed. - promote.yml (Run workflow): checks the release has the setup program and its .sha256, makes it a full release marked latest and rewrites its text without the test note. - tools/release_notes.py writes the text from the version's CHANGELOG.md section (paragraphs unwrapped for GitHub) and fails when there is none. - docs/releasing.md rewritten for the test-then-promote flow; CLAUDE.md, CHANGELOG, testing.md steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
…s the repo From the owner's security review (smaller points; the hello PIN check was already done with the PIN proof): - config.json no longer holds the sharing PIN in plain text: AppConfig.Pin is in memory only ([JsonIgnore]) and the file keeps PinProtected (DPAPI for this PC, MachineProtection, as the host key). A plain "Pin" written before 0.5.8 is read once and the file saved again without it. A value protected on another PC cannot be read: the PC then has no PIN and the log says to set it again. - docs/media/printvect-demo.mp4 (10.8 MB) and its poster removed: nothing refers to them; the README plays the copy uploaded to GitHub. Past commits still hold the video until the history is rewritten. - Tests: the PIN is not in the saved file; a plain PIN is converted. - SECURITY.md, CLAUDE.md, CHANGELOG, testing.md steps. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JFV1W7wPfiMU9itafQutsk
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.
This PR fixes the problems found in the owner's security review, one commit per item. Each item has its own test steps in
docs/testing.mdunder "0.5.8", sections 1 to 7.Changes
PinProof): PBKDF2-SHA256 of the PIN, salted with the request's nonce, time, printer, job id and size.pinhash is never compared; the sender is told to update.PinAttemptLimiter).HostIdentity), kept inconfig.jsonand protected with DPAPI.MovedHostCheck). This applies to discovery, to the search after a failed job, and to the PC-name fallback.SafeFoldersrefuses any junction or symlink in the data folder.spool\<id>through a handle to the folder that was checked.spool\incomingholds at most 1 GB, and a job must leave at least 256 MB free on the disk. Unused files are deleted first; if a job still doesn't fit, it is refused withretry..sha256is not installed.release.ymlpublishes a test version (pre-release) by default. Installed PCs ignore it, because they ask GitHub for the "latest release".promote.ymlmakes it the latest release for every PC.CHANGELOG.mdsection (tools/release_notes.py).config.jsonkeeps the PIN protected with DPAPI. A plain PIN from before 0.5.8 is converted at the first start.Version 0.5.8. Also updated:
protocol.md,SECURITY.md,README.md(troubleshooting rows),docs/releasing.md(rewritten),CLAUDE.mdandCHANGELOG.md.Compatibility: with a sharing PIN, PCs on 0.5.7 and 0.5.8 cannot print to each other until both are updated. Without a PIN, mixed versions work.
Checked
tools/release_notes.pywas run on real versions, and the promote script was run against a stand-in forgh.Generated by Claude Code