Skip to content
Website

Security

This page is for security reviewers and administrators operating Patchwork.

  • Passwords: Hashed with argon2id. Complexity rules are enforced server-side from SecuritySettingsSchema.
  • Sessions: Stored in PostgreSQL (sessions), delivered via HttpOnly cookies, and validated against both expiresAt and optional sessionIdleTimeoutMs.
  • CSRF Protection: State-changing API requests require a matching x-csrf-token header checked against the session’s csrfToken.
  • Authorization: Every route verifies organization and team RBAC roles server-side (src/lib/rbac.ts).

During installation, scripts/setup.mjs encrypts the one-time Admin Setup Token with AES-256-GCM using TOKEN_ENCRYPTION_KEY and deletes the ciphertext as soon as /setup verifies it. Never regenerate TOKEN_ENCRYPTION_KEY while an unconfirmed setup token is pending.

  • Uploads validate MIME type, extension, and byte size against StorageSettingsSchema and MAX_ATTACHMENT_BYTES.
  • Exported filenames pass through sanitizeFilename().
  • Security headers (X-Frame-Options, X-Content-Type-Options, Referrer-Policy, etc.) are applied across responses.

See SECURITY.md at the repository root: do not file public issues for security bugs. Open a private GitHub Security Advisory or email security@example.com.

When the installer downloads MinIO (RELEASE.2025-09-07T16-13-09Z), it enforces fail-closed verification:

  • Downloads only over HTTPS (honoring HTTPS_PROXY and NO_PROXY).
  • Displays binary name, size, and source URL for user confirmation before downloading (unless --yes / --non-interactive is passed).
  • Fetches the official .sha256sum file over HTTPS, streams into a .part file inside ./data/cache/, verifies byte length and SHA-256 digest, and deletes any mismatched or truncated file before copying to ./bin/.
  • Never executes an unverified binary and re-verifies cached binaries against .sha256sum before reuse.
  • Read-time authorization: Watcher lists, notifications, digests, SSE streams, and presence rooms enforce current ticket/team access at read and send time. If access is revoked, notifications redact to "You no longer have access to this ticket".
  • Encrypted secrets: SMTP passwords and webhook signing secrets are encrypted at rest with AES-256-GCM (TOKEN_ENCRYPTION_KEY), write-only in the UI, and never returned in API responses or logs.
  • SSRF protection: Outbound webhooks resolve DNS at connect time, block loopback/private/link-local/metadata/multicast IPv4 and IPv6 ranges, pin the resolved IP, and never follow redirects (unless an admin explicitly enables private-network webhooks).
  • What is stored & who can see what:
    • ticket_watchers: stores ticket_id, user_id, source, and muted state; visible (names and avatars only, never emails) to users who can view the ticket.
    • notifications: stores minimal event metadata and up to 140-character snippets for mentions/comments; visible only to the recipient.
    • email_outbox & webhook_deliveries: delivery logs mask recipient emails (al***@example.com) and redact secrets/errors; visible to organization admins only.
    • Presence & typing: strictly in-memory (presenceHub) and LISTEN/NOTIFY ephemeral messages; never written to the database and never contains draft text.