Skip to Content
LYNKORIADocs

Security findings register

Vulnerabilities and hardening items from the 2026-11-13 audit, with fixes, verification and remaining risk.

Audit date: 2026-11-13. Scope: API, sockets, console sign-in, attachments, scanner, webhooks, configuration, static sites, CI and deployment templates. Method: manual code review, targeted tests and dependency audits. This is not a penetration test. Earlier fixes are recorded in the 2026-11-12 review.

Severity reflects impact if exploited in the documented deployment. Status values match the implementation tracker.

SEC-01: Scanned attachments could be replaced before download

FieldValue
SeverityHigh
Componentapps/api/src/modules/attachments/attachments.routes.ts, storage.ts
Root causeThe presigned PUT URL (valid 5 minutes) targeted the same object key that downloads used. After complete scanned and released the file, the uploader could PUT different bytes of the same size and type, and recipients downloaded unscanned content.
FixUploads go to quarantine/<key>; completion scans those bytes and the server writes exactly the scanned buffer to <key>, then deletes the quarantine object (ADR 020). Retention deletes both keys; a lifecycle rule expires quarantine/ after a day.
VerificationNew test re-uploading through the presigned URL after a clean scan cannot replace the file (apps/api/test/scanning.test.ts) fails on the old code and passes with the fix; attachment, scanning and review suites pass.
Remaining riskUploads in flight during the deploy must be retried.
External actionOpenTofu applies the lifecycle rules (infra/opentofu/platform/storage.tf).
StatusCompleted (code); lifecycle rule Pending (external)

SEC-02: Client IP could be spoofed through proxy headers

FieldValue
SeverityMedium
Componentapps/api/src/lib/http.ts (console sign-in limits, LiveKit webhook limits, audit IPs)
Root causeWith TRUST_PROXY=true the API used the first present of CF-Connecting-IP, DO-Connecting-IP and the leftmost X-Forwarded-For entry. A client could send whichever header the ingress does not overwrite, a new value per request, to bypass per-IP sign-in limits and forge audit IPs.
FixOnly the single header named by CLIENT_IP_HEADER (default do-connecting-ip) is read; for x-forwarded-for the last, proxy-appended entry is used. The App Platform template sets it explicitly.
Verificationapps/api/src/lib/http.test.ts: other headers are ignored, the last XFF entry is used, nothing is trusted without an ingress.
Remaining riskThe ingress must overwrite the configured header. The per-email limit (10/min) and the account lockout still apply.
External actionConfirm on staging that a client-supplied DO-Connecting-IP is replaced by App Platform; set CLIENT_IP_HEADER=cf-connecting-ip if Cloudflare proxies the API.
StatusCompleted (code); ingress confirmation Pending

SEC-03: Unbounded concurrent password hashing

FieldValue
SeverityMedium
Componentpackages/auth/src/password.ts
Root causeEach scrypt derivation uses 128 MiB and a libuv worker thread. Sign-in attempts, including the unknown-account timing equalizer, ran in parallel without a cap, so a burst could exhaust memory or starve DNS/file I/O on the thread pool.
FixA FIFO concurrency limit of 2 derivations (256 MiB maximum).
VerificationconcurrencyLimit unit test (peak 2, FIFO order); console-auth integration tests pass.
Remaining riskQueued sign-ins slow down under a sustained flood; rate limits bound the queue.
StatusCompleted

SEC-04: API responses had no Content-Security-Policy

FieldValue
SeverityLow
Componentapps/api/src/app.ts
FixsecureHeaders now sends default-src 'none'; frame-ancestors 'none' on every response.
VerificationAPI test suite passes; JSON responses do not render.
StatusCompleted

SEC-05: Static sites lacked HSTS; docs lacked CSP

FieldValue
SeverityLow
Componentapps/admin/public/_headers, apps/docs/public/_headers
FixHSTS (1 year, subdomains) on both; docs CSP with object-src 'none', frame-ancestors 'none', connect-src 'self'. The static export needs 'unsafe-inline' scripts.
VerificationDocs export served locally with the header: navigation and search work, no CSP violations.
Remaining riskConsole connect-src still allows any https: origin (SEC-11).
External actionAdd the HSTS preload only after every subdomain serves HTTPS.
StatusCompleted

SEC-06: Scanner image was not built or scanned in CI

FieldValue
SeverityLow
Component.github/workflows/ci.yml
FixThe image job is a matrix over api and scanner; both are built and Trivy-scanned (high/critical, fixable).
VerificationWorkflow edited only; it has not run in hosted CI from this checkout.
StatusPartially Completed (needs a CI run)

SEC-07: No statement or idle-transaction timeouts for the runtime role

FieldValue
SeverityLow (availability)
Componentinfra/opentofu/platform/files/database-grants.sql
FixALTER ROLE lynkoria_app SET statement_timeout = '30s' and idle_in_transaction_session_timeout = '60s'. Role settings work through PgBouncer transaction pooling, where connection parameters would be rejected.
VerificationSQL reviewed; not applied to a managed database.
External actionRe-run the grants script on existing databases.
StatusPending (external apply)

SEC-08: Mutable ClamAV image tag

FieldValue
SeverityLow (supply chain)
Componentinfra/scanner/compose.yaml, infra/local/compose.yaml (clamav/clamav:1.4)
FixNot changed: the digest must be resolved and recorded by an operator.
External actionPin clamav/clamav:1.4@sha256:… after reviewing the image.
StatusPending

SEC-09: Development-only esbuild advisory

FieldValue
SeverityInformational
Componentdrizzle-kit → @esbuild-kit/core-utils → esbuild@≤0.24.2 (GHSA-67mh-4wv8-2f99)
AssessmentThe advisory concerns esbuild's development server; drizzle-kit generate only transpiles. Not in production dependencies.
StatusCompleted: a pnpm override moves @esbuild-kit/core-utils to esbuild 0.25.12; pnpm audit reports no advisories

SEC-10: Per-event socket revalidation cost

FieldValue
SeverityInformational (performance)
Componentapps/api/src/sockets/setup.ts
AssessmentEvery socket event re-reads the environment and suspension (two indexed lookups) so project disables take effect on the next event. Throttling would weaken that guarantee, so it was kept. Revisit with a cache invalidated by pub/sub when the API scales out.
StatusNot Applicable (deliberate)

SEC-11: Console CSP allows any HTTPS connect target

FieldValue
SeverityLow
Componentapps/admin/public/_headers
Assessmentconnect-src 'self' https: exists because VITE_API_ORIGIN is chosen at build time.
External actionReplace https: with the deployed API origin in the Pages project's _headers.
StatusPending

Previously accepted risks (unchanged)

These are product or infrastructure decisions, tracked in blockers: self-hosted LiveKit cannot revoke an unexpired 5-minute token; one API instance by default (cross-instance fan-out and revocation now work, ADR 021); presence is tenant-wide; service keys are environment-wide trusted credentials; Fidescript media isolation needs a separate stack.

On this page