Skip to content

fix: cancel failed sessions, 0-byte files, no symlinks, 0600 manifest, push skips dotfiles - #13

Merged
chogarcia merged 1 commit into
mainfrom
fix/batch-i-hardening
Oct 12, 2026
Merged

chogarcia merged 1 commit into
mainfrom
fix/batch-i-hardening

Conversation

@chogarcia

@chogarcia chogarcia commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Batch I (10-10 remediation plan), CLI items. Each checked against origin/main first; all six were still open.

  • Cancel pending session on failure. Any error after create-upload-session now calls POST /api/files/delete {ids:[fileId]} (the web app's cancel path: cancels the B2 large file and drops the non-ready row). Best-effort; the original error is rethrown. Skipped when the complete-upload request itself threw (outcome unknown), so a finalized file is never binned.
  • 0-byte files. Before: failed with "Encrypted stream has no chunks". Now the CLI asks GET /api/files/upload-capabilities; if emptyCipherV3 is true it uploads the header-only object with the server's empty-file proof (base64([3][3] || HMAC(proofKey, [3][3] || header)), matching web utils/emptyFileUploadProofClient.ts). If false (the prod default while EMPTY_V3_UPLOADS_ENABLED is unset) the file is skipped before any session exists, push prints skipped <name> and exits 2.
  • README/npm encryption claim. The README said the only bytes leaving the machine were ciphertext plus a proof and that every request body is ciphertext; the npm description implied PQ encryption for everything. Now: contents AES-256-GCM under the ML-KEM-1024 + X25519 hybrid key, names AES-256-GCM under the vault key (not PQ), and size, part SHA-1s, wrapped keys, proof and timestamps are visible to the server.
  • lstat, not stat in push/encrypt listing, sync scan and the agent's upload; files opened with O_NOFOLLOW to close the swap race.
  • Manifest 0600, including a stale .tmp left by a crashed run (handle.chmod).
  • push skips dotfiles by default; --include-dotfiles to include. Sync already skipped them.

Tests: npm test 151/151 locally, including new test/upload.hardening.test.mjs (7 cases). Not released; founder publishes.


View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.

…, push skips dotfiles

- Cancel the pending upload session on failure (not when only the finalize
  answer was lost).
- Upload 0-byte files as a header-only cipher-v3 object when the server
  advertises emptyCipherV3; otherwise skip before creating a session.
- lstat instead of stat when listing; open with O_NOFOLLOW.
- Write the sync manifest with mode 0600.
- push skips dotfiles unless --include-dotfiles.
- README and npm description state the actual encryption scheme.
@chogarcia
chogarcia merged commit 8138e6e into main Oct 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant