Repository navigation
Security hardening: git SSRF, rate limits, CSRF, transfer links - #124
Merged
Merged
Conversation
- 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>
- 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>
- .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>
…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>
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.
Summary
Security review of
main(7db4994) and fixes for the verified findings.Backend
/git/sessionis removed; push/pull require the token in the request body. The deadtoggle-syncroute is removed too..gpg-idread as a regular file only (no symlinks), re-init only on an empty remote, host-key fingerprint format validation./login, e.g. an entry named.../login, skipped CSRF in cookie mode).DB_PATH=:memory:).Frontend
Ops / docs
.dockerignoreexcludes env files, databases and keys in any directory.X-Forwarded-For/X-Forwarded-Proto; example env setsTRUSTED_PROXIES=127.0.0.1(otherwise all clients share one rate-limit budget).persist-credentials: false; wrangler is pinned.Test plan
go fmt,go vet,golangci-lint run(0 issues),go test ./...(also withTZ=Asia/Hong_Kong)npm run typecheck,npm run build,vitest(148 passed)