Security model
How work protects itself, why, and where it still falls short. Read this before you change anything that touches authentication, authorization, files, outgoing requests or third parties. To report a vulnerability see SECURITY.md.
Design rules
Reviewers hold changes to these:
- Secrets come from the environment only. No defaults, no committed credentials; startup fails when one is missing or weak (
apps/docs/src/CONFIGURATION.md). - Every protected handler takes an
AuthUserand checks the caller's role on the resource's project insecurity/authz.rsbefore touching data. Non-members get404, so ids cannot be probed. Roles are read from the database on every call, never from a token. - Request bodies are explicit structs. Nothing is deserialized straight into a database row, so a client can never set a role, an owner or a password hash.
- All SQL uses bound parameters. Sort and filter columns come from closed enums or allow-lists.
- Short-lived access tokens in memory; the refresh token is an
HttpOnly; SameSite=Strictcookie, rotated on use, with reuse detection. - The backend is never published. It is reached only through the frontend's
/api/v1proxy. - Untrusted content is rendered by React from a validated structure, never as HTML. Uploaded files are sniffed, served as attachments with a sandboxing policy, and only through the authenticated API.
- Outgoing requests go through the SSRF guard and never follow redirects.
- Every administrator action is written to an audit log, and admin endpoints answer
404to everybody else.
Protections, feature by feature
Each feature is a way to attack the system, so each has its own tests (apps/backend/src/tests/, apps/frontend-e2e).
| Feature | Risk | Protection | Test |
|---|---|---|---|
API tokens (wrk_..., Bearer or Jira-style Basic email:token) | A leaked token is a long-lived credential. | Only a SHA-256 is stored; the secret is shown once. Scope read (safe methods only) or write; optional expiry; instant revocation; per-token rate limit. Tokens act with the owner's permissions, never more. Managing tokens, changing the password, deleting the account and linking integrations need a real session, so a leaked token cannot mint tokens or lock the owner out. Basic auth must name the token's owner. | api_tokens_work_like_jira_tokens_and_cannot_escalate, api-tokens.spec.ts |
| Limited access (a member who sees only the projects they were added to) | A guest, invited to one project, sees the rest of the workspace. | A restricted member is always a workspace viewer and treats every space and project as private: only an explicit grant opens one (restricted on project_members, checked in authz.rs, visible_cards_sql and the workspace tree). Search, "my issues", activity feeds, child issues and the member list are filtered the same way; a list invite creates exactly such a member plus a grant; removing a member removes their grants. Project admins can invite only up to their own role. | restricted_members_only_see_lists_they_hold_a_grant_on, list_invites_add_people_to_one_list, project-settings.spec.ts |
Incoming webhooks (POST /hooks/{id}/{secret}) | Unauthenticated endpoint. | 256-bit secret in the URL, stored hashed, compared in constant time; shown once; rotation kills the old URL. Unknown id, wrong secret, disabled and deleted automations are indistinguishable (404). Body limit 64 KB, per-IP and per-automation rate limit. A card_id in the body must belong to the automation's workspace. Runs execute with the automation owner's rights and stop if they lost access. | incoming_webhooks_trigger_automations, webhooks.spec.ts |
| Outgoing webhooks (automation action) | SSRF: an admin could make the server call internal services or cloud metadata. | https only (http opt-in), no credentials in URLs, destination resolved and every address checked against loopback/private/link-local/CGNAT/multicast/documentation ranges (incl. IPv4-mapped and NAT64 IPv6), connection pinned to the checked address (no DNS rebinding), redirects not followed, 10 s timeout. The URL itself is never templated. Payloads are signed (X-Work-Signature, HMAC-SHA256, key derived from the server secret, readable by admins only). Creating automations needs project admin rights. | ssrf.rs unit tests, outgoing_webhooks_cannot_reach_internal_addresses, outgoing_webhooks_are_signed |
| Automation e-mail | Spam relay / phishing from the product's own sender. | Recipients must be project members (operator can opt in to external addresses); bodies are escaped; 20 mails per automation and hour. | automations_send_mail_only_to_project_members |
| Password reset | Account takeover, user enumeration. | Same answer for known and unknown addresses; 3 mails per address and hour; random single-use token stored hashed, 60-minute expiry, redeemed atomically; all sessions revoked afterwards. | password_reset_by_email, mail.spec.ts |
| Invitations by e-mail | Link forwarded to someone else. | The invite is bound to the invited address: only an account with that e-mail can redeem it; single use; expiring. | invite_by_email_is_bound_to_the_address |
| Realtime (SSE) | Reading other users' events. | The stream is bound to the user id in the verified token; clients cannot choose or join channels. no-transform keeps proxies from buffering it. | hub unit test, collab.spec.ts |
| File uploads / downloads | Stored XSS, path traversal, quota bypass. | Server-chosen storage keys, magic-byte sniffing with an allow-list (no HTML/SVG/executables), nosniff, attachment unless a safe image, sandbox CSP, authenticated and project-scoped, quota enforced under an advisory lock. | files_are_sniffed_scoped_and_served_safely |
| Filter engine | SQL injection through user-defined filters and sorts. | Closed AST, allow-listed targets, typed comparisons, bound parameters only; depth/size limits. | filters.rs unit tests, filters_sorting_and_pagination_are_safe_and_correct |
| OAuth (Slack) | Login CSRF, token theft. | One-time server-side state bound to the user's session; tokens encrypted at rest (AES-256-GCM, bound to the user). | integrations.rs unit tests |
| S3 / Azure file storage | A public bucket, guessable object names, one tenant reading another's file. | Objects are named by a server-generated UUID, written once (PutMode::Create), and the bucket must be private: files are only served through the authenticated, project-scoped API, which keeps sniffing, nosniff, attachment and the sandbox CSP. Credentials come from the environment only (or the environment's own identity); a plain http:// endpoint needs an explicit opt-in. | local_disk_storage, s3_storage, azure_storage (against S3Mock and Azurite) |
| Scheduler (date triggers) | Runs piling up, double firing across instances, a flood after downtime, SQL through a field name. | One advisory lock per tick so a single instance works at a time; each (automation, card, date) fires once; the catch-up after downtime is limited to one hour; the field name is validated against the slug charset and bound as a parameter; runs use the automation owner's rights and stop if they lost access. | date_triggers_fire_once_per_date_and_respect_scope_and_state, only_one_scheduler_works_at_a_time_and_downtime_catches_up_a_bounded_window |
| CRM layouts | A javascript: URL in the website field becomes a link. | The company header only links http(s) URLs, with rel="noopener noreferrer"; e-mail and phone links are built from escaped values; values are rendered by React (always escaped). | features.spec.ts |
| Single sign-on (OAuth) | Login CSRF, code injection, account takeover through unverified provider e-mails, SSRF. | Random one-time state (hashed, 10 min) tied to the starting browser by an HttpOnly cookie; PKCE (S256); fixed provider endpoints (no user-supplied URLs); identity = provider subject; only an e-mail the provider vouches for (GitHub: primary and verified; Microsoft only with a pinned tenant) can create an account; an existing address is never merged, the owner links the provider from a password session; linking and unlinking need a real session; the last way in cannot be removed; failures redirect with a fixed code and never echo provider text. | oauth_sign_in_creates_and_reuses_an_account_and_rejects_forgeries, oauth_never_merges_accounts_by_email_and_linking_needs_a_session, an_sso_only_account_cannot_remove_its_last_way_in, github_only_trusts_the_primary_verified_address |
| SAML | Signature wrapping, forged or replayed assertions, unsolicited responses, IdP confusion. | Pure-Rust saml crate (duplicate IDs rejected, only the signed element is used, weak algorithms off, DTD/XXE refused); signed assertions required; audience, destination, time window and InResponseTo checked against a request tracker that is sealed (AES-GCM, key derived from the server secret) and kept with the one-time state; unsolicited responses refused; state is single use and bound to the browser (SameSite=None; Secure cookie, because the answer is a cross-site POST). The IdP comes from the operator's metadata file only. | saml_sign_in_accepts_only_signed_answers_to_this_browsers_request (genuine answer, replay, other browser, edited subject/address, foreign signing key, unsolicited) |
| Password policy | Weak, breached or personal passwords. | 12-128 characters, a blocklist of common passwords (compared ignoring case and punctuation), no part of the account's name or e-mail address, no near-constant strings. Applies to sign-up, change and reset; a rejected reset password does not burn the link. | policy.rs unit tests, password_policy_applies_to_every_way_of_setting_a_password |
| Account lock-out | Online password guessing. | 5 failures lock the account for 15 minutes, doubling with every further failure up to 24 hours; failures older than an hour are forgotten once the lock ended; the owner gets a mail. A locked account answers exactly like a wrong password or an unknown account. A password reset lifts the lock. Per-IP and per-account throttling stays in front. | repeated_failures_lock_the_account_without_revealing_it |
| Two-factor authentication | Stolen password, TOTP brute force, enrolment by a hijacked session. | TOTP (RFC 6238) with a one-step drift window; a code is accepted once (replay guard, atomic); the secret is AES-256-GCM encrypted and bound to the user, so MFA is off without WORK_ENCRYPTION_KEY. The sign-in challenge is random, hashed, lives 5 minutes and allows 5 tries; every miss also counts toward the lock-out, and the failure counter is only cleared once the second factor succeeded. Enrolling, disabling and new recovery codes need a real session and the password (disabling also a code); recovery codes are 50-bit, hashed, single use. | totp.rs unit tests (RFC vectors), two_factor_enrolment_sign_in_replay_and_recovery, guessing_second_factor_codes_is_capped_and_locks_the_account, security.spec.ts |
| E-mail confirmation at sign-up | Account enumeration, pre-registration of somebody else's address. | A sign-up only creates a pending row (hashed single-use token, 24 h); the account exists once the link is used. Known and unknown addresses get the same answer; a known address gets a notice mail instead of a link; the newest registration for an address replaces older ones and kills their links. At most 3 mails per address and hour. | sign_up_needs_a_confirmed_address_and_hides_existing_accounts, security.spec.ts |
| Shared rate limiter | Per-instance counters multiply the budget when scaling out. | WORK_RATE_LIMIT_BACKEND=postgres keeps fixed-window counters in a table with an atomic upsert; a database failure denies the request (it does not fail open). | shared_rate_limiter_counts_in_the_database |
| Content-Security-Policy | Script injection through inline scripts. | script-src 'self' 'nonce-…' 'strict-dynamic': a fresh nonce per request, set by the Next proxy and picked up by Next for its bootstrap scripts; no 'unsafe-inline' for scripts. Pages are rendered per request. | security.spec.ts |
| OpenID Connect (generic) | A forged or replayed ID token, algorithm confusion, a provider that lies about its own issuer. | Discovery at startup (the document must name the configured issuer; https endpoints; PKCE offered). The ID token is verified on every sign-in: signature against the issuer's keys with the algorithm pinned to RS256 or ES256 (none and HMAC are refused), iss, aud (and azp for several audiences), exp, sub, and the nonce of this very sign-in; the userinfo sub must equal the token's. Unverified addresses only count when the operator vouches for the provider. | openid_connect_verifies_the_id_token_before_believing_it, unverified_addresses_need_the_operator_to_vouch_for_the_provider, discovery_insists_on_the_right_issuer_and_https |
| Passkeys (WebAuthn) | Phishing, a credential made for another site, replay, cloned authenticators, planting a passkey from a hijacked session. | Challenges are random, single use, five minutes. Checked per the specification: ceremony type, exact challenge and origin, rpIdHash of our domain, user presence and verification, ES256 signature over authenticatorData and the client-data hash, a signature counter that must advance. Adding one needs a real session and the password; the last way to sign in cannot be removed; failures all answer 401. | webauthn.rs unit tests (software authenticator), passkeys_register_sign_in_and_reject_forgeries, security.spec.ts (Chrome's virtual authenticator) |
| Rich text | Script or markup in a description or comment; a javascript: link; a document bomb. | A document is accepted only if it could have come from the editor: allow-listed nodes, marks and attributes, links limited to http(s) and mailto, bounded depth, node count and size. It is rendered by React from that structure, never as HTML. | rich.rs unit tests, rich_text_is_validated_and_outside_writes_end_the_session, rich.spec.ts |
| Live collaborative editing | A viewer writing, another tenant joining, a malformed update, content doubling. | Role checked on every call (viewers read, members write; only rich fields of the card's own type). Updates are applied on a blocking thread, so a malformed one cannot touch the server; size caps; the first seed wins, so content never doubles; an outside write to the field ends the session. | editors_converge_content_never_doubles_and_roles_are_enforced, rich.spec.ts |
| Admin panel and branding | Privilege escalation, an administrator locking everybody out, a hostile favicon, secrets leaking through the overview. | Admin rights are read from the database on every call and need a session (never an API token); everybody else gets 404. The instance always keeps an administrator and nobody disables themselves. The favicon is sniffed (PNG, JPEG, WebP, ICO, or an SVG without script, handlers, external references or entities), capped at 256 KB and served with a sandboxing policy. The accent colour must be #RRGGBB. The overview contains counts and non-secret settings only. Every change is audited. | only_admins_get_in_and_everything_they_change_is_logged, admin.spec.ts |
| Upstream import | Writing around the API's rules, a poisoned source, stolen passwords. | Writes go through the server's own API (all validation applies); the source schema name is checked against a strict pattern; bcrypt hashes are kept but upgraded to Argon2id at the next sign-in; unusable hashes become "no password"; nothing is dropped silently (report). | the_import_keeps_structure_authors_and_dates_and_reports_what_it_cannot_take |
Not verified
- Dependency vulnerabilities are checked in CI (
cargo audit,npm audit); results depend on the advisory database at that time. - SSO, SAML, S3 and Azure were exercised against local stand-ins, not the real services. The SAML library is a pre-release crate without an independent audit.
- The automation engine was written against the behaviour of the project this one replaces; it re-implements it with owner-rights checks, a depth limit against loops and non-evaluating placeholders.
Known residual risks
- Without SMTP, e-mail confirmation is off and registration reveals whether an e-mail exists (
409). - Lock-out can be used to lock a known account out for a while (denial of service against one user). The owner is told by mail, a password reset lifts the lock, and the per-IP limit bounds how many accounts one source can lock.
- Signing in through SSO, OpenID Connect or SAML does not ask for the local second factor (the provider authenticates the person). A passkey counts as two factors on its own.
- Passkeys: only ES256 credentials, and attestation is not verified ("none"), so the authenticator's make and model are not checked.
- Live editing and notifications fan out in process: with several backend instances, route the editors of one card to the same instance (the saved content is shared through the database either way). Saved content is whatever the last saving editor sent; two editors saving in the same instant can briefly disagree until the next edit.
- SAML relies on a pre-release library without an independent audit, and on
SameSite=Nonefor the response cookie (so SAML needs https). Over plainhttp://localhostSAML does not work. Single logout and encrypted assertions are not supported. - Replay protection for SAML assertions is per instance (the one-time
staterow, which is shared, is the primary guard). style-srcstill allows'unsafe-inline'(the UI kit sets style attributes). Inline styles cannot run script.- Style attributes aside, the interface sets no colour inline; the accent colour is validated as
#RRGGBBbefore it reaches a style. - The default rate limiter is per instance; set
WORK_RATE_LIMIT_BACKEND=postgreswhen running several. - Dependency audits (
cargo audit,npm audit) run in CI; results depend on the advisory database at that time.