Repository navigation
Security follow-up: transfer v2, entry signing, Argon2id, limits and docs - #125
Merged
johnwmail merged 5 commits intoDec 3, 2026
Merged
Conversation
… approval secret - Mix a random link secret (URL fragment, never sent to a server) into the PBKDF2 input so the pairing code cannot be brute-forced offline from the server-held ciphertext. - Derive separate AES-GCM and HMAC keys with HKDF (no key reuse for the proof). - Envelope fetch is now POST and requires the one-time link token. - Approve/deny require a secret only the creating device holds (hash uploaded). - v1 envelopes/links are rejected; create a new link after upgrading. Co-authored-by: Cursor <cursoragent@cursor.com>
…c rate - X-Forwarded-Proto is only honoured from TRUSTED_PROXIES. - Audit log retention/pruning (AUDIT_RETENTION_DAYS, AUDIT_MAX_ROWS_PER_ACCOUNT) and unknown-account logins no longer create unbounded rows. - Global registration-code failure counter (429 when locked). - Atomic TOTP replay claim; minimum TOTP secret length. - Shallow clones with size/file-count watchdog (GIT_MAX_REPO_MB). - Per-account push/pull budget (GIT_SYNC_RATE_LIMIT). Co-authored-by: Cursor <cursoragent@cursor.com>
- Sign-then-encrypt entries with the PGP key (opt-in per device); a present but invalid signature blocks the entry, unsigned entries are flagged when signing is on. Settings: toggle + 'Sign all entries'. - Opt-in Argon2id S2K when changing the PGP passphrase (shows current mode). - Unit + E2E tests. Co-authored-by: Cursor <cursoragent@cursor.com>
- frontend/public/_headers: CSP and security headers for Cloudflare Pages. - CSP allows 'wasm-unsafe-eval' (Argon2id key unlock needs WebAssembly). - docker-compose publishes on 127.0.0.1 by default (BIND_ADDRESS/HOST_PORT). - window.__webpass only exists in VITE_E2E builds; CI checks the prod bundle. - Server does not serve _headers/.gitkeep. Co-authored-by: Cursor <cursoragent@cursor.com>
README, AGENTS.md, CONTRIBUTING.md, .env.example and the OpenBSD env example describe the new behaviour, limits, E2E build flavour and compatibility. Co-authored-by: Cursor <cursoragent@cursor.com>
johnwmail
added a commit
that referenced
this pull request
Dec 3, 2026
* Harden backend: git SSRF checks, rate limits, CSRF, size limits - Git: enforce the remote address policy at connect time (HTTP dial control and SSH host-key callback), stricter URL/scp host validation, re-validate the stored URL on push/pull, per-account repo lock, context-aware clone/push with timeouts, read .gpg-id as a regular file only, validate trusted host-key fingerprints. - Remove the server-side git token cache and /git/session; push/pull require the token in the request body. Remove dead toggle-sync route. - Rate limiting: validate the fingerprint before keying, check IP first, group IPv6 by /64, authenticate key-transfer before limiting, and add a shared budget for endpoints that re-verify the login password. - CSRF exemptions match exact login paths only. - Fail closed when session info cannot be loaded (deleted account). - Reject oversized entries with 413 instead of truncating; cap the decompressed tar stream including skipped entries. - WebAuthn: store challenge expiry in UTC, reject clone warnings. - SQLite: apply pragmas to every pooled connection; single connection for in-memory databases. - Reject JWT_SECRET placeholders, including the shipped examples. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden frontend: transfer link validation, logout, clipboard - Validate transfer links (https server URL, fingerprint and token format) and require confirmation before sending the login password to a server on another origin. - Require pairing codes of at least 8 characters. - Log out on the server before clearing the local session in Settings. - Encode entry path segments in API URLs. - Keep the clipboard wipe timer alive after the component unmounts and wipe decrypted text copied from the Encrypt/Decrypt tool. - Send git credentials only with push/pull; drop setGitSession. Co-authored-by: Cursor <cursoragent@cursor.com> * Ops: dockerignore secrets, relayd forwarded headers, pin CI tools - .dockerignore: exclude env files, databases and keys in any directory. - OpenBSD: set X-Forwarded-For/Proto in relayd and TRUSTED_PROXIES so rate limits are per client, not per proxy. - Release/deploy workflows: persist-credentials: false; pin wrangler. - README: update git sync endpoints. Co-authored-by: Cursor <cursoragent@cursor.com> * Security follow-up: transfer v2, entry signing, Argon2id, limits and docs (#125) * Device transfer v2: link secret in URL fragment, HKDF key separation, approval secret - Mix a random link secret (URL fragment, never sent to a server) into the PBKDF2 input so the pairing code cannot be brute-forced offline from the server-held ciphertext. - Derive separate AES-GCM and HMAC keys with HKDF (no key reuse for the proof). - Envelope fetch is now POST and requires the one-time link token. - Approve/deny require a secret only the creating device holds (hash uploaded). - v1 envelopes/links are rejected; create a new link after upgrading. Co-authored-by: Cursor <cursoragent@cursor.com> * Harden proxy trust, audit log, registration, TOTP, git clones and sync rate - X-Forwarded-Proto is only honoured from TRUSTED_PROXIES. - Audit log retention/pruning (AUDIT_RETENTION_DAYS, AUDIT_MAX_ROWS_PER_ACCOUNT) and unknown-account logins no longer create unbounded rows. - Global registration-code failure counter (429 when locked). - Atomic TOTP replay claim; minimum TOTP secret length. - Shallow clones with size/file-count watchdog (GIT_MAX_REPO_MB). - Per-account push/pull budget (GIT_SYNC_RATE_LIMIT). Co-authored-by: Cursor <cursoragent@cursor.com> * Optional entry signing and Argon2id key protection - Sign-then-encrypt entries with the PGP key (opt-in per device); a present but invalid signature blocks the entry, unsigned entries are flagged when signing is on. Settings: toggle + 'Sign all entries'. - Opt-in Argon2id S2K when changing the PGP passphrase (shows current mode). - Unit + E2E tests. Co-authored-by: Cursor <cursoragent@cursor.com> * Pages _headers, loopback compose bind, test hooks only in E2E builds - frontend/public/_headers: CSP and security headers for Cloudflare Pages. - CSP allows 'wasm-unsafe-eval' (Argon2id key unlock needs WebAssembly). - docker-compose publishes on 127.0.0.1 by default (BIND_ADDRESS/HOST_PORT). - window.__webpass only exists in VITE_E2E builds; CI checks the prod bundle. - Server does not serve _headers/.gitkeep. Co-authored-by: Cursor <cursoragent@cursor.com> * Docs: transfer v2, entry signing, Argon2id, new env vars, upgrade notes README, AGENTS.md, CONTRIBUTING.md, .env.example and the OpenBSD env example describe the new behaviour, limits, E2E build flavour and compatibility. Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: rdu64 <rdu64@arm64.dev> Co-authored-by: Cursor <cursoragent@cursor.com> --------- Co-authored-by: rdu64 <rdu64@arm64.dev> Co-authored-by: Cursor <cursoragent@cursor.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.
Follow-up to #124 (stacked on
security/hardening-2026-12; retarget tomainafter #124 merges). Implements items #1–#4 and #6–#13 of the security review; #5 (pin GitHub Actions to commit SHAs) is intentionally skipped.Changes
POSTand needs the one-time link token; approve/deny need an approval secret that only the creating device holds'wasm-unsafe-eval')frontend/public/_headers– CSP/security headers for Cloudflare PagesX-Forwarded-Protohonoured only fromTRUSTED_PROXIESdocker-compose.ymlpublishes on127.0.0.1(BIND_ADDRESS/HOST_PORTto override)REGISTRATION_MAX_FAILURES)GIT_MAX_REPO_MB)GIT_SYNC_RATE_LIMIT)window.__webpassonly inVITE_E2Ebuilds; CI fails if it is in the production bundleCompatibility (details in README "Upgrading from v0.10.x")
TRUSTED_PROXIESthat relied onX-Forwarded-Proto, direct LAN access to the compose port.Tests
go vet,gofmt,golangci-lintclean;go test ./...(alsoTZ=Asia/Hong_Kong), OpenBSD cross-build.tsc, Vitest (159), prod bundle contains no__webpass.playwright-e2e-test.sh: 88/88 passed (new: signing, Argon2id, transfer v2 link secret).X-Forwarded-Proto.