Security overview
Security architecture, implemented protections, checks performed and known remaining risks.
Last reviewed 2026-11-13 (see the audit and findings register). Engineering controls, not legal advice; Fidescript and any regulated data need a separate security and privacy review. No penetration test has been performed. This page does not claim the platform is fully secure: it records what is implemented, how it was checked, and what remains.
Credentials
| Credential | Holder | In browser/mobile? | Storage |
|---|---|---|---|
Service key lynk_live_…/lynk_test_… | Product backend | Never | Lynkoria stores keyId + HMAC-SHA256(pepper, secret), prefix/suffix |
| Messaging JWT (ES256, 10 min) | Client | Yes | Signed with MESSAGING_JWT_PRIVATE_KEY; previous public keys accepted during rotation |
| LiveKit room JWT (5 min) | Client | Yes | Signed with the project environment's LiveKit key |
| LiveKit API key/secret | Control plane only | Never | LIVEKIT_KEYS_JSON (secret manager) |
| Webhook signing secret | Product backend | Never | Derived: HMAC(WEBHOOK_SECRET_MASTER, env + version); shown once |
| Console session | Console user | HttpOnly cookie | __Host- cookie, SameSite=Strict; SHA-256 of a 32-byte token; 30 min idle, 12 h max |
| Console password | Console user | Never stored | scrypt (N=2^17); 14+ characters; lockout after 5 failures; accounts only from the CLI |
| Scanner consumer token | API (server) | Never | SCANNER_TOKEN / SCANNER_TOKENS_JSON; constant-time compare; sent only over TLS with a pinned private CA (ADR 023) |
Pepper, webhook master, messaging key, LiveKit secrets and database/Redis credentials live in the secret manager / App Platform encrypted env vars — never in Git, images, logs or cloud-init in the repo. Config validation reports variable names only, never values.
Controls by layer
| Layer | Implementation |
|---|---|
| Product auth | middleware/service-key.ts: constant-time digest compare, no cache (revocation is immediate), mode must match the deployment (lynk_test_ never reaches production), scopes, disabled environments rejected |
| Console auth | modules/admin/console-auth.ts + middleware/admin-identity.ts: password sign-in (no registration), server-side sessions, per-IP and per-email limits, lockout; optional Cloudflare Access identity must match; console_roles → owner/admin manage, developer/auditor read; cross-origin mutations rejected |
| Authorization | All queries scoped by environment_id (+ tenant_id); other projects' ids return 404; sender identity from the token only |
| Tenancy in schema | Composite FKs (conversation_id, environment_id, tenant_id) on members, messages, attachments |
| API | zod validation on every input; 256 KiB body limit; message byte cap; rate limits per service key/user/admin and socket flood limits; strict CORS; secure headers incl. default-src 'none' CSP; client IP from one configured ingress header |
| WebSockets | Origin allowlist (global + per environment); token on handshake; per-event authorization; rooms from claims only; event flood cutoff; expiry revalidation; suspension disconnect |
| LiveKit | auto_create: false; per-environment maxParticipants; 5-min tokens; role-derived grants (canPublishData: false, no metadata self-update); removeParticipant with revokeTokenTs |
| Webhooks | Inbound: raw-body signature + event-id dedupe. Outbound: operator-approved HTTPS origins, timestamped HMAC, at-least-once, redirects not followed |
| Files | Private bucket; presigned PUT (signed type/length) to a quarantine/ key; HEAD verification; magic-byte type check, archive-bomb limits and ClamAV scan; only the scanned bytes are published; fail closed; presigned GET (5 min, attachment disposition) after membership checks |
| Logging | pino redaction of tokens, secrets, authorization headers and message bodies; metrics without key/user/room labels |
| Static sites | _headers: HSTS, X-Frame-Options: DENY, nosniff, Permissions-Policy, CSP (console: script-src 'self'; docs: inline scripts required by the static export) |
| Supply chain | Lockfile, pinned action SHAs and images, gitleaks, pnpm audit, SBOM, Trivy scans of the API and scanner images, built-asset secret grep, OIDC publishing |
Negative tests (CI)
Implemented in apps/api/test/*.test.ts against real PostgreSQL, Redis, LiveKit and S3-compatible storage:
- VibeLynk-style key A cannot read, join or end project B's call
- Body/query parameters cannot override the key's project or environment
-
lynk_live_key against a staging deployment (mode/environment mismatch) - Workspace A cannot read workspace B messages; other projects with identical user/tenant ids are isolated
- Sending after membership removal
- Revoked service key fails on the next request
- Viewer tokens cannot publish (grants derived server-side)
- Expired / foreign-project / service-key-as-JWT messaging tokens
- Socket handshake from a non-allowlisted Origin, without or with an invalid token
- Reusing another user's attachment, or an attachment twice; non-member download
- Non-member sending over the socket; presence leakage across tenants
- Suspended user obtaining a new room token; suspended user's sockets disconnected
- Joining a room the control plane did not create (real LiveKit)
- LiveKit webhook with an invalid signature; replayed event id
- Admin endpoint without a valid Access JWT; service key on admin endpoints; developer creating keys; auditor mutating
- Composite FK rejects a message pointing at another tenant's or environment's conversation
Known limits
-
Self-hosted LiveKit cannot revoke an arbitrary unexpired token;
removeParticipantrequests token invalidation but this is not treated as a verified self-hosted revocation guarantee. TTL is 5 minutes; hard bans should recreate the room. -
Socket revalidation is per instance, but suspensions disconnect sockets on every instance through the Redis Streams adapter (ADR 021).
-
Rate limits fail closed with 503 while Redis is unavailable; persisted data remains in PostgreSQL.
-
Attachments uploaded before scanning was enabled stay
not_scannedand are not served while a scanner is configured; no rescan backfill exists. -
Scanner throughput, and ClamAV detection quality beyond EICAR and archive bombs, are unmeasured.
-
Per-environment LiveKit keys support rotation and attribution, not SFU tenant isolation. A separate Fidescript media deployment currently requires a separate API deployment because each API has one LiveKit endpoint.
-
v1 has no row-level security policy or cross-node socket adapter; application checks and composite foreign keys enforce the tested boundaries (database). Production IAM/network and restore controls require infrastructure verification.
-
The console CSP allows
connect-src https:because the API origin is a build-time variable; tighten it per deployment. -
Presence is visible tenant-wide and service keys are environment-wide trusted credentials; product backends must enforce contact/block rules.
Security checks performed (2026-11-13)
| Check | Result |
|---|---|
| Manual code review | Auth, sockets, attachments, console sign-in, webhooks, scanner, config; findings in register |
pnpm audit --prod | No known vulnerabilities |
pnpm audit (incl. dev) | 1 moderate: esbuild ≤0.24.2 via drizzle-kit (dev-only, no dev server used); accepted |
| Negative/integration tests | API suite against real PostgreSQL, Redis, LiveKit, S3-compatible storage and a scanner |
| Static site CSP | Docs export served with its CSP: navigation and search work, no violations in the console |
| Secret scanning, image scans | Run in CI (gitleaks, Trivy); not re-run locally in this audit |
Use the pre-deploy checklist before every production deployment.
Rotation
See operations.