Linora

Security review, November 2026

Reviewer: SR (independent). Date: 2026-11-28. Code reviewed: main at 7e799f3. Line numbers refer to that commit; other agents were editing the working tree during the review.

Status on 2026-11-30: both Highs and all six Mediums are fixed on main, and every fix has a test that passes. The Lows are fixed or partly fixed; the Info items are fixed or accepted as product calls. Each finding’s status, fix and test are in Status, and the second pass covers what this review did not: the S3 client, the prod compose file and the code changed after 7e799f3. The findings below describe the code as it was at 7e799f3. The CodeQL triage of 2026-12-01 is an addendum: the first public code-scanning run, alert by alert.

Threat model: ../architecture/security.md (malicious client, stolen token, resource exhaustion, cross-tenant access). ADRs read: 0011, 0023, 0101, 0302, 0303, 0304, 0702.

Summary

Severity Count
Critical 0
High 2
Medium 6
Low 10
Info 6

I found no cross-tenant read or write path and no authentication bypass. Both High findings are cheap, cross-tenant denial of service on shared tiers. They need only a self-registered account, because signup is open and makes the caller owner (and so editor) of their own project.

Id Sev Title Owner Status (2026-11-30)
SR-01 High nameRegex search can block a shared doc worker for minutes S1 (apps/docworker), DC2 (packages/doc find) Fixed
SR-02 High MCP id-run expansion runs before the 10,000-id cap: a 14 KB call OOMs the hosted adapter main (apps/mcp) Fixed
SR-03 Medium DELETE id lists: 18x gateway-to-owner amplification; rate limits count ops, not ids DC2 (scan.ts), R1 (gateway) Fixed
SR-04 Medium Revocation fails open: a LISTEN gap loses events, and open sockets are never re-checked R1 Fixed
SR-05 Medium Per-IP connection cap trusts a client-sent PROXY v2 header R1, O1 Fixed
SR-06 Medium Hosted MCP: unauthenticated body buffering, a shared API IP bucket, no per-token session cap main (apps/mcp), S1 Fixed
SR-07 Medium One HMAC keyring and one DB role for every tier: a doc worker can mint any user’s realtime token S1 (server-common), O1 Fixed
SR-08 Medium render builds the full SVG (text included) before its size cap, on the event loop DC2 (toSvg), S1 (render.ts) Fixed
SR-09 Low Denylist compares API-clock iat with realtime-clock receipt time R1, S1 Fixed
SR-10 Low Rate-limit and cap keys use the full IPv6 address; bucket eviction resets depleted buckets S1, R1 Fixed
SR-11 Low The web app’s CSP and framing headers are documented but not served O1, ED1 Fixed
SR-12 Low The “unsafe() banned outside migrations” lint does not exist O1 Fixed
SR-13 Low Per-email login lockout lets anyone lock a victim out S1 Fixed
SR-14 Low Rejected binary batches are decoded to JS arrays outside the body budget S1 Fixed
SR-15 Low Text with XML-illegal characters breaks every render of its region DC2 Fixed
SR-16 Low Realtime inflates structure sections with no output cap R1 Fixed
SR-17 Low NODE_ENV defaults to development, which turns off Secure cookies and HSTS S1, O1 Fixed
SR-18 Low Metrics listeners bind to the service host (0.0.0.0 in production) S1, R1, O1 Fixed
SR-19 Info Account enumeration via signup 409 and addMember 404/409 S1 (product call) Partly fixed (product call)
SR-20 Info MCP prompt-injection exposure from names and text main (apps/mcp) Mostly fixed
SR-21 Info Open signup makes the editor role free (amplifies SR-01/03/05/06/08) product Partly fixed (product call)
SR-22 Info uWS comes from a GitHub tarball with prebuilt binaries (integrity-pinned) O1 Fixed / accepted
SR-23 Info Web reads linora_csrf, but production sets __Host-linora_csrf ED1 Fixed
SR-24 Info Realtime subscribe skips files:read; writer mode is open to any editor client R1 Fixed; hidden write mode accepted

Method

Findings

SR-01 (High): nameRegex search can block a shared doc worker for minutes

Where

Evidence

Impact

Fix

  1. Give find a work budget (names tested, or performance.now() checked every 1,024 nodes). When it runs out, return a partial page with truncated: true and a cursor, or a 503 with Retry-After.
  2. Test the regex against at most the first 256 characters of a name, and/or reject patterns whose l-mode program is large (for example, more than 20 quantifiers).
  3. Allow at most one concurrent searchNodes per user in the API proxy.
  4. Longer term, run queries in a worker thread with a hard timeout (ADR 0702 already lists this alternative).

SR-02 (High): MCP id-run expansion runs before the 10,000-id cap

Where

Evidence

Impact

Fix

SR-03 (Medium): DELETE id lists amplify 18x between gateway and owner; rate limits count ops, not ids

Where

Evidence

Impact

Fix

SR-04 (Medium): Revocation fails open: lost LISTEN events, and open sockets never re-checked

Where

Evidence

Impact

Fix

SR-05 (Medium): Per-IP connection cap trusts a client-sent PROXY v2 header

Where: apps/realtime/src/gateway/gateway.ts:221-226.

Evidence

Impact

Fix

SR-06 (Medium): Hosted MCP: unauthenticated buffering, a shared API IP bucket, no per-token session cap

Where: apps/mcp/src/http.ts:49-59,92-117,71; the API client sends no client address (apps/mcp/src/api.ts:73).

Evidence

Impact

Fix

SR-07 (Medium): One HMAC keyring and one DB role for every tier

Where

Evidence

Impact

Fix

SR-08 (Medium): render builds the whole SVG before its size cap, on the event loop

Where: packages/doc/src/query/index.ts:436 onward (toSvg) and apps/docworker/src/queries/render.ts:88-90.

Evidence

Impact

Fix

SR-09 (Low): Denylist compares API-clock iat with realtime-clock receipt time

Where: apps/realtime/src/supervisor.ts:163 (atS = realtime Date.now() at receipt) and apps/realtime/src/auth.ts:176-186 (a.iat <= at).

Evidence

Fix

SR-10 (Low): Rate-limit and cap keys use the full IPv6 address; eviction resets depleted buckets

Where: apps/api/src/http.ts:153-162, apps/api/src/ratelimit.ts:52-62, apps/realtime/src/gateway/gateway.ts:222-226.

Evidence

Fix

SR-11 (Low): The web app’s CSP and framing headers are documented but not served

Where

Impact

Fix: O1 should serve the app with:

Add a test that fetches the built app and checks these headers.

SR-12 (Low): The “unsafe() banned outside migrations” lint does not exist

Where: security.md “SQL injection” row; tools/check-deps.mjs has no such rule.

Evidence

Fix: Add a check-deps rule that rejects .unsafe( in apps/*/src and packages/*/src, except in migrate.ts and testing.ts.

SR-13 (Low): Per-email login lockout lets anyone lock a victim out

Where: apps/api/src/routes/auth.ts:75-79.

Evidence: The lockout bucket is keyed by email only. Ten failed logins from anywhere leave the real owner one attempt per minute.

Fix

SR-14 (Low): Rejected binary batches are decoded to JS arrays outside the body budget

Where: apps/api/src/content/ops.ts:52,62 (readOps on the raw body when any op was rejected).

Evidence

Fix: Decode only the rejected ops, by offset (the ACK gives their indices; scanBatch gives offsets), or skip hints when raw.length is over 256 KiB.

SR-15 (Low): Text with XML-illegal characters breaks every render of its region

Where: packages/doc/src/query/index.ts:416 (esc handles &<>"' only), and string checks in packages/doc/src/codec/block.ts:159-162 (only a leading BOM is rejected).

Evidence: Probe svgctl.mjs: resvg refuses SVG text containing U+0001 or U+FFFE (“a non-XML character found”). The worker then answers 500 internal.

Impact

Fix: In esc, replace characters outside the XML 1.0 Char production (\x00-\x08\x0B\x0C\x0E-\x1F, ￾, ￿) with U+FFFD.

SR-16 (Low): Realtime inflates structure sections with no output cap

Where: apps/realtime/src/owner/store.ts:120 (gunzipAsync(gz)).

Evidence: The data is written by the compactor, so it is not user input. Still, a corrupted or malicious blob inflates without limit on an owner thread. Doc workers do cap inflation (apps/docworker/src/store.ts:136).

Fix: gunzip(gz, { maxOutputLength: MAX_NODES_PER_PAGE * 14 + 1 MiB }), or the stored struct_bytes with some slack.

SR-17 (Low): NODE_ENV defaults to development

Where: packages/server-common/src/config.ts:97.

Evidence: If NODE_ENV is unset in production:

Fix

SR-18 (Low): Metrics listeners bind to the service host

Where: apps/api/src/main.ts:39 (cfg.host, 0.0.0.0 in production); the realtime metrics server in apps/realtime/src/supervisor.ts (around line 181) does the same.

Impact: /metrics exposes operational data (rates, connection counts, route latencies) on every interface. api.md says it is “kept off the public port”, but only the port differs.

Fix: Add LINORA_*_METRICS_HOST, default 127.0.0.1, and set the private interface in deploy.

SR-19 (Info): Account enumeration

Where: apps/api/src/routes/auth.ts:64 (signup returns 409 email_taken); apps/api/src/routes/projects.ts:109,115 (addMember 404 “no account” vs 409 “already a member”).

Impact: Anyone can test whether an email has an account (signup is rate-limited per IP; see SR-10). Project owners can probe without that limit.

Fix: This is a product call. The usual fix is to make signup always answer “check your email”, once email verification exists (tracked as out of scope for v1).

SR-20 (Info): MCP prompt-injection exposure

Where

Recommendation

SR-21 (Info): Open signup makes the editor role free

Signup creates an account with no verification. createProject makes the caller owner. Every “editor-only” DoS above (SR-01, SR-03, SR-05, SR-06, SR-08) is therefore open to anonymous internet users. Email verification is tracked as out of scope for v1. Until it ships, treat editor as unauthenticated for capacity limits. Per-account quotas would help: projects, files, nodes and bytes per account per day.

SR-22 (Info): uWebSockets.js from a GitHub tarball

Where: apps/realtime/package.json, and package-lock.json:2756-2760 (sha512 integrity present).

Evidence

Recommendation

SR-23 (Info): Web reads linora_csrf, but production sets __Host-linora_csrf

Where: apps/web/src/shell/api.ts:45 and apps/api/src/server.ts:93.

Impact: In production the cookie fallback never matches. The header from signup, login or me still works, so this is a robustness issue, not a hole.

Fix: Read both names.

SR-24 (Info): Realtime subscribe skips files:read; writer mode is open to any editor client

Where: apps/realtime/src/gateway/gateway.ts:600-640.

Evidence

Fix

What’s solid

Tokens

Sessions and CSRF

PATs

Passwords

Authorization and tenancy

SQL: postgres.js tagged templates everywhere; validate() plus format checks run before values reach the database.

Binary input

Paths and compression

Output encoding

Logging, config and the MCP

Dependencies: every version is pinned exactly, and the lockfile has integrity for every package, uWS included.

Not covered

Status (2026-11-30)

Verified in the code at main on 2026-11-30, not only in the docs. Every test named here passes; the High and Medium ones were run one by one, and all of them run in npm test and CI. “Fixed differently” means the fix closes the finding by another route than the one suggested above.

Id Status Fix (commits, ADR) Verified by (test file › test)
SR-01 Fixed f040af9, 7ba818c; ADR 0704 (amends 0702), 0105. find has a 100 ms work budget with a resumable cursor and truncated; a regex sees the first 256 characters of a name and runs only on the linear engine; one search in flight per user (4 per IP, 5/s); every query runs under a 2 s guard (a vm timeout, not a worker thread) packages/doc/test/query-safety.test.ts (4 tests); apps/docworker/test/guard.test.ts › “nameRegex ReDoS…”, “guarded() preempts…”, “a query over the wall-clock guard answers 503…”; apps/api/test/queries.test.ts › “nodes/search (SR-01)…”
SR-02 Fixed cc84e68; ADR 0603. The id budget is checked before each run; 1 MiB body cap (64 KiB before a session). 1b0925d also charges repeated runs (second pass S2-S1) apps/mcp/test/unit.test.ts › “SR-02: the 40-run probe…”, “id lists…”, “id lists (S2-S1)…”; apps/mcp/test/e2e.test.ts › “SR-02 over HTTP…”
SR-03 Fixed differently b6eb91f, b0fe7ce, 81dce2d; ADR 0204, realtime.md. A batch carries at most 1,048,576 ids (else protocol_error); above 65,536 ids the summary is a 16-byte header and the owner re-scans, so the 18x copy is gone; a per-user id bucket (2M/s); the backlog check includes the payload; scan arrays shrink after big batches. A binary DELETE may still hold about 1M ids (JSON: 50k) apps/realtime/test/security-r1.test.ts › “SR-03: a DELETE of 100k ids…”, “SR-03 + SR-10…” (made deterministic in a718c16); r1-units.test.ts › “scan summary…”; packages/doc/test/transform.test.ts › “ScanBatch: more than MAX_BATCH_EXTRAS…”; overload.test.ts › “bug 1…”
SR-04 Fixed differently 81dce2d, 0501742; ADR 0205. Each LISTEN reconnect, and every LINORA_REALTIME_RECHECK_S (300 s) instead of a maximum socket age, re-checks open sockets’ sessions, PATs, users, memberships, projects and files in batched queries. Closing every socket on reconnect was rejected (reconnect storm) security-r1.test.ts › “a LISTEN reconnect (events may have been lost) triggers a re-check”, “a logged-out session, a removed member and a lowered role…”, and since a718c16 “a revoked, expired or re-scoped PAT, a disabled user and a deleted file or project…”, “the periodic re-check (LINORA_REALTIME_RECHECK_S)…”
SR-05 Fixed differently 0ca58f0, 81dce2d; deploy.md. PROXY v2 and X-Forwarded-For count only from LINORA_TRUSTED_PROXIES peers (empty: ignored). No required mode (second pass S2-S4) security-r1.test.ts › both “SR-05: …”; r1-units.test.ts › “client address: forwarded headers count only from trusted proxies…”
SR-06 Fixed cc84e68, 0ca58f0; ADR 0603. PAT shape checked before the body; 1 MiB cap plus a byte budget; me cached 30 s; sessions capped per token (10) and per user (20); initialize 2/s per IP; the MCP forwards the agent’s address, trusted only from the edge subnet apps/mcp/test/e2e.test.ts › the three “SR-06: …” tests; unit.test.ts › “limits: gate…”, “hosted transport helpers…”; apps/api/test/global-limits.test.ts › “X-Forwarded-For is honoured only from trusted proxies…”
SR-07 Fixed d48694c, 81dce2d (migration 0003), 8553307, 1e6e7f8, 877462e; ADR 0310. 7be3f9e removed realtime’s TEMPORARY master keyring from the prod compose (ADR 0906) packages/server-common/test/token.test.ts (3 tests); apps/docworker/test/roles.test.ts (2); apps/api/test/auth.test.ts › “config refuses to start without secrets…”; deploy/prod-compose.test.mjs › “SR-07: …” (keyrings and DB login per tier)
SR-08 Fixed b0fe7ce, 7ea6c77; ADR 0105, 0704. toSvg counts its output and has a time budget; text is cut at 4,096 characters; SVG shares the PNG render slot; the rasterizer runs in a child process with a deadline and an RSS cap query-safety.test.ts › “SR-08: toSvg stops at maxChars…”; guard.test.ts › “render (SR-08)…”, and since 1b0925d “render (SR-08): SVG goes through the same slot and queue as PNG…”; raster.test.ts (2)
SR-09 Fixed (skew margin) 81dce2d: a 2 s margin. Receipt time, not commit time, is compared, which fails safe r1-units.test.ts › “denylist: tokens minted up to DENY_SKEW_S s after an event (API clock ahead) are still denied”
SR-10 Fixed 0ca58f0, 81dce2d; 1b0925d (local-store eviction, second pass S2-S2) packages/server-common/test/net.test.ts › “bucket keys: IPv6 by /64…”; global-limits.test.ts › “…/64”, “buckets: depleted ones survive eviction…”, “local store (S2-S2)…”
SR-11 Fixed 8553307, b8a4453 (deploy/nginx/web.conf.template). HSTS stays off on the plain-HTTP local stack by design deploy/smoke.mjs step “web headers” (CI job “Images + prod-like smoke”)
SR-12 Fixed d8d965a (check-sql in npm run check) packages/server-common/test/check-sql.test.ts (2)
SR-13 Fixed 0ca58f0; 1b0925d fails closed when the lockout map cannot track a pair. No known-device bypass (optional) global-limits.test.ts › “login lockout: per (account, client)…”, “login lockout fails closed (S2-S2)…”
SR-14 Fixed 81dce2d apps/api/test/units.test.ts › “SR-14: large rejected binary batches are not decoded…”
SR-15 Fixed b0fe7ce query-safety.test.ts › “SR-15: XML-illegal characters…”
SR-16 Fixed 81dce2d security-r1.test.ts › “SR-16: a structure section that inflates past the cap…”
SR-17 Fixed d48694c, 0ca58f0, 8553307 (images set NODE_ENV=production). Since 7be3f9e production also refuses the published dev secrets (ADR 0906) packages/server-common/test/common.test.ts › “loadServerConfig reads required settings…”, “production refuses the published development secrets…”
SR-18 Fixed 0ca58f0, 81dce2d; 7be3f9e keeps api and realtime metrics on loopback in the prod compose (second pass S2-I5) deploy/prod-compose.test.mjs › “SR-18: …”
SR-19 Partly fixed (product call) 81dce2d: member lookups by email are rate-limited per user. Signup still answers 409 in open mode until email verification exists auth.test.ts › “SR-19: adding members by email is rate-limited per user”
SR-20 Mostly fixed cc84e68; ADR 0603: content is quoted and marked untrusted. Open: the note in every tool description; not acting on ids found only in text unit.test.ts › “SR-20: document content is marked as untrusted data”
SR-21 Partly fixed (product call) 81dce2d: invite-only sign-up is the production default. No per-account quotas yet. The prod-like stack defaults to open, configurable since 7be3f9e auth.test.ts › “SR-21: LINORA_SIGNUP=invite…”
SR-22 Fixed / accepted a849d32 (CI npm ci and npm audit), check-deps rule 7; bee4275 licence gate (ADR 0907). No internal mirror (local-only project) tools/check-deps.test.mjs › “lockfile entries must come from the registry with sha512 integrity (SR-22)”
SR-23 Fixed cd5e24f apps/web/test/shell.test.ts › “CSRF cookie: production __Host- name first…”
SR-24 Fixed; hidden write mode accepted 81dce2d: subscribe needs files:read. Hidden write mode stays open to any editor, by decision security-r1.test.ts › “SR-24: subscribe needs files:read”

Second pass (2026-11-30)

Scope: what the first pass did not cover. That is the S3 blob client (packages/server-common/src/blob/), docker-compose.prod.yml, deploy/ and docs/ops/deploy.md, and the server code changed between 7e799f3 and 129274a: api, realtime, mcp, docworker, server-common, shared, migrations 0003-0005, the binary-input parts of packages/doc, and a look at the editor tools. Two independent reviewers read the code and ran probes (SigV4 vectors, socket-pool starvation, uWS header handling, MCP id lists, rate-limit maps, SVG cost); the test-to-fix map above was a third, separate pass.

Result: no cross-tenant read or write path and no authentication bypass. Four Mediums: three are fixed with tests, and one (S2-I2) can only happen once the blob store is switched to S3, which has not happened. Every Low that is a few lines and touches nothing live is fixed; the rest are follow-ups, listed below.

Id Sev Finding Status
S2-I1 Medium The doc worker and realtime mounted the snapshot volume read-write, and the S3 root key went to all four blob tiers. Code execution in the doc worker could rewrite every tenant’s snapshots, since content_hash is not checked on read Fixed 7be3f9e (ADR 0906): readers mount read-only and no tier holds an S3 secret while the store is local; deploy/prod-compose.test.mjs. Follow-up: check content_hash on read
S2-I2 Medium (not live) With LINORA_BLOB_STORE=s3, slow snapshot downloads can hold the API’s 32 S3 sockets: the timeout covers socket inactivity only, a stalled read reopens up to 4 times, and the client side has no write deadline Follow-up, before any switch to S3: an in-flight cap per user and IP on GET snapshot, an idle deadline on response writes, and an abort signal that also covers time in the agent queue
S2-I3 Low A ranged resume accepts any status and Content-Range (and resumes without If-Match when the first response had no ETag) Follow-up with the S3 switch: require 206 and a matching start; refuse to resume without an ETag
S2-I4 Low Plain-HTTP S3 endpoints are accepted in production, and GET bodies are not integrity-checked Follow-up with the S3 switch: refuse http: in production unless explicitly allowed; content_hash check
S2-I5 Low SR-18 was only partly fixed: api and realtime bound metrics to 0.0.0.0 on containers that are also on the edge network Fixed 7be3f9e; deploy/prod-compose.test.mjs; checked on the running stack (refused from the edge container)
S2-I6 Low prod:env --force overwrote .env.prod while the stack’s volumes held data, then pointed at down -v Fixed 7be3f9e: refuses while the project has volumes, backs up, always 0600; test in deploy/prod-compose.test.mjs
S2-I7 Low Hardening gaps: web and edge lack read_only and log caps; db, s3 and the one-shot jobs lack cap_drop and no-new-privileges; nginx keeps its default worker connections and header timeout Follow-up (needs a custom nginx.conf and tmpfs paths; changes the running edge)
S2-I8 Info Realtime already read only its per-purpose keyrings, so the TEMPORARY master key line was stale Fixed 7be3f9e
S2-I9 Info Base images are pinned by tag, not digest Accepted for the local stack (ADR 0903); pin digests when images are published
S2-I10 Info LINORA_TRUSTED_PROXIES trusts the whole edge /24, not just the edge and mcp Follow-up: static addresses for edge and mcp, trust only those
S2-I11 Info S3 client nits: LINORA_S3_PREFIX is not validated; log redaction is exact-match; the query is sent with encodeURIComponent but signed with RFC 3986 encoding (differs only for !'()*, unused today); RequestTimeTooSkewed is retried; the db-roles and s3-init jobs pass passwords on their command lines Follow-up
S2-S1 Medium MCP id lists: a run repeated 10,000 times was walked every time (about 3 s of CPU per call on the event loop) Fixed 1b0925d: runs are charged their full width; unit.test.ts › “id lists (S2-S1)…”
S2-S2 Medium (local rate store only) With LINORA_API_RATE_STORE=local (the default is pg), used keys were never evicted, so new clients were refused for good after 100K keys, and a full lockout map silently turned the login lockout off Fixed 1b0925d: consumption is tracked only with a sync attached; the lockout fails closed; two tests in global-limits.test.ts
S2-S3 Low POST /v1/sessions/revoke-others sends one NOTIFY per session inside one transaction, and each gateway scanned every socket slot per event Partly fixed a718c16: applyAuth returns early when no socket holds the credential (r1-units.test.ts › “applyAuth: a cred_revoked for a credential no socket here holds…”). Follow-up: cap sessions per user, batch the NOTIFYs
S2-S4 Low Realtime reads only the first X-Forwarded-For header line, and believes a PROXY v2 header from any trusted peer Follow-up: join every XFF line; LINORA_REALTIME_PROXY_PROTOCOL=off\|required. Safe in the prod-like stack, whose edge replaces XFF
S2-S5 Low Render has no per-user admission: one global slot per worker (1 running, 4 queued), so one editor can make render answer 503 for everyone on that worker Follow-up: an in-flight gate per user and IP, as for search
S2-S6 Low The per-user op and id buckets are per gateway thread, so 5 gateways allow 5x the documented per-user rate Follow-up: shared buckets, or rates divided by the gateway count
S2-S7 Info Small client-address inconsistencies: an over-long XFF is ignored (shared bucket, not a bypass); LINORA_MCP_TRUST_PROXY is a hop count; the MCP’s initialize bucket keys full IPv6 addresses Follow-up

Checked and solid in the second pass (one line each):

CodeQL triage (2026-12-01)

The first public scan of v0.1.0 by CodeQL (.github/workflows/codeql.yml, the security-extended suite) raised 37 alerts. Each one was triaged for reachability: can untrusted input (a client of the API, realtime, the MCP server or a doc worker) reach it in production, or is it operator configuration, tooling or a test? Nothing was reachable by a client in a way that does harm. 27 alerts are fixed in code, each with a test where the code ships; 10 are dismissed with a written reason in code scanning.

Rule Alerts Where Reachable by a client? Resolution
js/polynomial-redos 11 /\/+$/ and /^\/+\|\/+$/g in the api, docworker and mcp config, the MCP API client and the S3 client; /[?#].*$/ in the MCP session No: env configuration, server-issued URLs. Quadratic all the same (40K / took 470 ms) Fixed: a linear character scan, trimTrailingSlashes/trimSlashes (packages/server-common/src/url.ts, one copy in apps/mcp/src/config.ts) and indexOf for shownUrl. Tests: 200K-character inputs finish in under 100 ms (common.test.ts, mcp unit.test.ts)
js/remote-property-injection 5 coerceQuery in apps/api/src/http.ts and apps/docworker/src/worker/server.ts Yes, but harmless: ?__proto__=x hit the setter (a string is ignored), so the key was silently dropped Fixed: the query object is built with Object.fromEntries, so every client key is an own data property and validation rejects unknown ones. Test: apps/api/test/units.test.ts › “query keys from the client are own data properties…”
js/remote-property-injection 1 the fake S3 server in packages/server-common/test/blob.test.ts Test only Fixed the same way
js/path-injection 4 the static server in tools/demo/check.ts Tooling (127.0.0.1 only); it already checked containment, but on a normalize(join()) path Fixed: resolve(root, rel) (absolute and normalized) must start with root + sep before any file-system call, and again after a directory’s index.html is added; a malformed % escape answers 400 instead of throwing
js/server-side-unvalidated-url-redirection 1 tools/bench/serve.ts Tooling; the location was built from the request path, and mounts[name] also matched constructor Fixed: mounts are a Map built at start with their redirect targets; a request only selects one. Same containment check as above
js/shell-command-injection-from-environment 1 git archive … \| tar -x through sh -c in tools/bench/trees.ts Tooling (the path was passed as $0, not interpolated) Fixed: git archive -o and tar -x -f with argument arrays, no shell
js/insecure-temporary-file 2 tools/bench/trees.ts (a fixed linora-bench name in the shared temp dir), apps/api/test/resources.test.ts Tooling and a test Fixed: the bench cache lives in ${XDG_CACHE_HOME:-~/.cache}/linora-bench (--cache-dir still overrides it); the test uses mkdtempSync
js/file-system-race 1 existsSync then writeFileSync of .env.prod in deploy/prod-env.mjs Local operator script Fixed: one read (ENOENT means absent); a new file is created with flag wx (never over a file that appeared meanwhile), --force writes a fresh 0600 temp file and renames it over the old one, and the backup is created the same way. Test: deploy/prod-compose.test.mjs › “prod:env writes secrets without a check-then-write race…”
js/incomplete-sanitization 1 a hand-escaped RegExp in apps/mcp/test/unit.test.ts Test only Fixed: a plain substring check, no regex
js/redos 7 apps/docworker/test/guard.test.ts, packages/doc/test/query-safety.test.ts Test only Dismissed (used in tests): deliberately catastrophic patterns such as ^(a+)+$ and (a\|a)*b, the probes that prove SR-01’s defence. They run only through compileNameRegex or new RegExp(p, 'l'), the linear-time engine, under time budgets the tests assert
js/regex-injection 3 checkNameRegex and compileNameRegex in packages/doc/src/query/index.ts Yes, by design: nameRegex is a user-supplied regex search Dismissed (won’t fix): the feature is the user’s pattern. SR-01 (ADR 0704) bounds it: 200-character patterns, the linear-time engine only (flag l; backreferences and lookaround are refused, never run on the backtracking engine), the first 256 characters of each name, a 100 ms find budget with a resumable cursor, a 2 s wall-clock guard, and per-user and per-IP search limits

Found while triaging, not flagged by CodeQL: the schema validators looked up properties[key] without an own-key check. A request body (from JSON.parse, which makes __proto__ an own key) or a query string with a key named after an Object.prototype member (__proto__, constructor, toString, hasOwnProperty, …) found the prototype’s member, treated it as an empty schema and passed additionalProperties: false. No handler copies unknown keys, so nothing reached the database or another object, but such keys were accepted silently. validate (shared/src/schema.ts) and the MCP’s validateArgs now use own keys only, so these keys are unknown fields (API: 400 bad_request; MCP: “unknown property”), and record schemas check them against their value schema. Tests: shared/test/schema.test.ts › “keys named after Object.prototype members are unknown fields…”, mcp unit.test.ts › “validation names the path and how to fix it”.