From 8dddcee766afe24a2c108bdd2cba762671e5636d Mon Sep 17 00:00:00 2001 From: Adeel Ahmad Date: Sat, 17 Oct 2026 07:31:02 +0000 Subject: [PATCH] docs(threat-model): news feed sources as an entry point News feeds (#453) are fetched like iCal feeds: through netguard, with their address and password sealed. The threat model now says so: a News feed sources entry point, and news feeds beside iCal in P-SECRETS, P-ADMIN-GUARD, N-EGRESS, the outbound domains and the web networks hazard. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_01SWH8a26M9wkAPq2eRrfWZK --- threat-model.json | 32 +++++++++++++++++++++----------- threat-model.md | 21 +++++++++++---------- threat-model.yaml | 36 +++++++++++++++++++++++------------- 3 files changed, 55 insertions(+), 34 deletions(-) diff --git a/threat-model.json b/threat-model.json index 8375d6f6f..2c075ce21 100644 --- a/threat-model.json +++ b/threat-model.json @@ -6,7 +6,7 @@ "scope_subpath": null, "description": "Lens is a self-hosted archive for documents, recordings, photos and messages: it reads, transcribes, indexes and publishes them, and people search and chat over them. One operator (the instance admin) runs an instance for their own people: a FastAPI API, a Next.js web app that proxies the API and holds the sign-in session, and background workers, around one SurrealDB database, with content split into namespaces and per-namespace roles. Exposing an instance to the internet behind HTTPS (reverse proxy or Cloudflare tunnel) is supported. Only the instance admin (equivalent to host code execution) and the host operator are trusted; everyone else is trusted only as far as their role.", "confidence": { - "documented": 250, + "documented": 251, "inferred": 99 }, "components": [ @@ -66,11 +66,12 @@ { "name": "outbound", "entry_points": [ - "watched folders, storage sources, IMAP, Gmail, iCal", + "watched folders, storage sources, IMAP, Gmail, iCal, news feeds", "Google Calendar sources", + "News feed sources", "Connect with Google", "POST /imports/web, extension http tools, notification targets", - "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, MQTT bridge, OIDC issuer, web search)", + "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, news feeds, MQTT bridge, OIDC issuer, web search)", "replies from remote servers", ".env, archive.yaml, LENS_*, ARCHIVE_SECRET_KEY, RCLONE_BINARY" ], @@ -188,7 +189,7 @@ }, { "component": "outbound", - "boundary": "B4, Lens to the outside: fetches whose URL a non-admin sets, and iCal feeds, go through netguard; other admin-set URLs do not; the telemetry endpoint is only shape-checked (P-ADMIN-GUARD).", + "boundary": "B4, Lens to the outside: fetches whose URL a non-admin sets, and iCal and news feeds, go through netguard; other admin-set URLs do not; the telemetry endpoint is only shape-checked (P-ADMIN-GUARD).", "provenance": "inferred", "reachability_precondition": "a URL a non-admin sets, or a guarded admin operand, reaches a non-public address; or a stored secret reaches anyone but the host the admin set", "source": "threat-model.md §1.4 (untagged boundary list)" @@ -413,8 +414,8 @@ "source": "docs/api.md \"the address form takes hook tokens only\"" }, { - "entry_point": "watched folders, storage sources, IMAP, Gmail, iCal", - "parameter": "remote file names, bytes, mail, events", + "entry_point": "watched folders, storage sources, IMAP, Gmail, iCal, news feeds", + "parameter": "remote file names, bytes, mail, events, feed posts", "attacker_controllable": "yes", "component": "outbound", "caller_must_enforce": "admin creates sources", @@ -430,6 +431,15 @@ "provenance": "documented", "source": "docs/processing.md \"The token endpoint is always Google's own\"" }, + { + "entry_point": "News feed sources", + "parameter": "the feed's address (or a site's page that names its feed), user and password; the feed's XML and its posts' HTML", + "attacker_controllable": "yes", + "component": "outbound", + "caller_must_enforce": "admin creates sources; fetched as iCal feeds are; feedparser reads the XML with external entities off and drops scripts, styles and event handlers from a post's HTML; each post kept as an Atom entry Lens writes, without the feed's address; post text is marked untrusted in prompts", + "provenance": "documented", + "source": "docs/processing.md \"News feeds (RSS and Atom)\"" + }, { "entry_point": "Connect with Google", "parameter": "OAuth client id and secret; on the way back state, code and the email in Google's id token", @@ -458,7 +468,7 @@ "source": "docs/assistant.md \"a search or a page read sends words out of Lens\"" }, { - "entry_point": "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, MQTT bridge, OIDC issuer, web search)", + "entry_point": "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, news feeds, MQTT bridge, OIDC issuer, web search)", "parameter": "URL, credentials, api_key_env", "attacker_controllable": "no", "component": "outbound", @@ -1068,7 +1078,7 @@ "property": "P-SECRETS", "violation_symptom": "info-leak", "severity_tier": "security", - "conditions": "stored secrets (source credentials, notification secrets, model API keys, iCal addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only; the API reports whether one is set, never its value; a key from the environment is never shown; they do not leak through the API, logs, exports, or a redirect to another server", + "conditions": "stored secrets (source credentials, notification secrets, model API keys, iCal and news feed addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only; the API reports whether one is set, never its value; a key from the environment is never shown; they do not leak through the API, logs, exports, or a redirect to another server", "provenance": "documented", "source": "SECURITY.md \"stored credentials for sources and model servers leaking\"" }, @@ -1084,7 +1094,7 @@ "property": "P-ADMIN-GUARD", "violation_symptom": "info-leak", "severity_tier": "security", - "conditions": "guards Lens documents on admin-set operands hold: iCal feeds are fetched like web captures (public addresses only and documents.web_networks, ports 80 and 443, the password never goes on to a server the calendar redirects to); the telemetry endpoint cannot carry a user name or password or be a link-local address", + "conditions": "guards Lens documents on admin-set operands hold: iCal and news feeds are fetched like web captures (public addresses only and documents.web_networks, ports 80 and 443, the password never goes on to a server the calendar or feed redirects to, or to a feed a site's page names on another server); the telemetry endpoint cannot carry a user name or password or be a link-local address", "provenance": "documented", "source": "docs/processing.md \"fetched the way web pages are captured\"" }, @@ -1363,7 +1373,7 @@ }, { "property": "N-EGRESS", - "reason": "an egress firewall; netguard guards web import, iCal feeds, extension http tools, notifications, the assistant's web search and page reads, and Chromium, nothing else; admin-set URLs other than iCal feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded", + "reason": "an egress firewall; netguard guards web import, iCal and news feeds, extension http tools, notifications, the assistant's web search and page reads, and Chromium, nothing else; admin-set URLs other than iCal and news feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded", "false_friend": true, "provenance": "documented", "source": "maintainer ruling, 2026-10" @@ -1733,7 +1743,7 @@ }, { "pattern": "Wide LENS_WEB_NETWORKS", - "why_unsafe": "Editors, and iCal feed redirects, can then reach those networks", + "why_unsafe": "Editors, and iCal and news feed redirects, can then reach those networks", "instead": "List single hosts" }, { diff --git a/threat-model.md b/threat-model.md index c933291a5..93d596089 100644 --- a/threat-model.md +++ b/threat-model.md @@ -171,7 +171,7 @@ flowchart LR - **B3, content to parser.** Uploaded and fetched bytes cross into ffmpeg, LibreOffice, Chromium, poppler, Tesseract, anytopdf (here, or on an admin-set conversion node, P-CONVERSION-NODE), an admin-set Apache Tika server (P-TIKA-SERVER) and the LLM prompt. -- **B4, Lens to the outside.** Fetches whose URL a non-admin sets, and iCal feeds, go through `netguard`. Other +- **B4, Lens to the outside.** Fetches whose URL a non-admin sets, and iCal and news feeds, go through `netguard`. Other admin-set URLs do not; the telemetry endpoint is only shape-checked (P-ADMIN-GUARD). - **B5, peers.** Workers, the API and the web app trust the database and each other. Workers hold the DB credential. - **B6, devices.** Sensor listeners take traffic from the LAN (or wider, per `sensors.bind`) once an admin enables them. @@ -286,13 +286,14 @@ classified by gate only *(inferred, Q8)*; unread modules are listed in Q34. | `/namespaces/{name}/rdf/import` | Turtle, N-Triples, JSON-LD | yes, editors | serialized state, size | none | *(documented, rdf_import.py docstring "RDF/XML isn't read")* | | `/uploads`, `/import`, `/recordings/{rid}/files` | file bytes, name, extension, size | yes, editors | data, type/class, size | none | *(documented, docs/configuration.md "Uploads accept only the types")* | | `POST /hooks/import` | bearer (a hook's `lih_` token, or a person's `la_`, `lo_` or web token with `?namespace=`), file bytes, URL, text | yes: anyone holding a hook's token, for its namespace; a person's token, for namespaces where its person has the import permission and only with write scope | data, resource-name, size | none; the address form `/hooks/import/{token}` takes hook tokens only, so a person's token never sits in a logged path | *(documented, docs/api.md "the address form takes hook tokens only")* | -| watched folders, storage sources, IMAP, Gmail, iCal | remote file names, bytes, mail, events | yes, whoever writes to the remote, mails the box or serves the feed | data, resource-name, size | admin creates sources | *(inferred, Q17)* | +| watched folders, storage sources, IMAP, Gmail, iCal, news feeds | remote file names, bytes, mail, events, feed posts | yes, whoever writes to the remote, mails the box or serves the feed | data, resource-name, size | admin creates sources | *(inferred, Q17)* | | Google Calendar sources (`gcal.py`, `google_auth.py`) | a service account key file or a connected account's refresh token, calendar ids, `impersonate`; the events Google returns | key and token: admins only, sealed and write-only (P-SECRETS); events: yes, anyone who can invite the account to an event or edit a calendar it reads | data, x-credential, x-prompt-injection, size | admin creates sources; read-only scope (`calendar.readonly`); the token endpoint and API address are Google's own (a key file's `token_uri` is ignored) and calendar ids are quoted into the path; event text is written into its .ics escaped and without control characters, so an event can't add properties; events are data, as iCal feeds' are | *(documented, docs/processing.md "The token endpoint is always Google's own")* | +| News feed sources (`rss.py`) | the feed's address (or a site's page that names its feed), a user and password; the feed's XML and its posts' HTML | address and password: admins only, sealed and write-only (P-SECRETS); XML and HTML: yes, whoever serves the feed or writes its posts | data, x-prompt-injection, size | admin creates sources; fetched as iCal feeds are (P-ADMIN-GUARD); feedparser reads the XML with external entities off and drops scripts, styles and event handlers from a post's HTML; each post is kept as an Atom entry Lens writes (escaped), without the feed's address; post text reaches prompts as marked, untrusted data | *(documented, docs/processing.md "News feeds (RSS and Atom)")* | | Connect with Google (`POST /sources/{id}/google`, then `/auth/external/google/callback`) | an OAuth client id and secret; on the way back `state`, `code` and the email in Google's id token | client: admins only; `state` and `code`: yes, anyone who can send the admin a link | data, x-credential, x-collaborator-data | admin only, from the web app (API tokens refused), and still an admin when Google sends them back; the flow reuses external sign-in's: `state` is single-use, kept only hashed, expires in 10 minutes and must come back to the browser that started it (cookie), with PKCE (S256); the client secret is sealed on the flow and the refresh token on the source; the token is kept only when Google granted the source's scope (read only, but all of Gmail for a Gmail source read over IMAP, which Google offers no read-only scope for; Lens still only reads; all of Drive for a Drive connection set to full access), and a Drive connection keeps its client's secret sealed with it, for rclone to renew the token; the email is only shown, and comes straight from Google's token endpoint; the browser returns only to the web origin that started it | *(documented, docs/processing.md "the consent itself is a person's")* | | the assistant's mailbox (`mailbox.py`) | mail headers, text, attachments, forwarded mail, `Authentication-Results` | yes, anyone who knows the address; From is forgeable | data, x-prompt-injection, size | answered only for `mailbox.users` whose provider vouched for From; forwarded text marked untrusted, and changes after it ask first | *(documented, docs/assistant-email.md "it answers only mail that is both")* | | `POST /imports/web`, extension `http` tools, notification targets | URL | yes: editors (web, tools), owners (targets) | resource-name, x-network-destination | none | *(maintainer, 2026-10)* | | the assistant's `web_search` and `web_read` (off until an admin picks a provider, `web.search`) | a search query and a page address, both chosen by the model; the results and pages that come back | yes: anyone who may use the assistant, and indirectly whatever it read, through the model; results and pages: whoever runs the site | resource-name, x-network-destination, x-prompt-injection, size | none; queries go only to the admin's provider; pages are fetched through netguard like web import, 10 MB at most (P-SSRF-GUARD); once the answer has read outside text, a query or address neither the person nor a tool gave it asks first (P-INJECTION-EGRESS); results and pages reach the model marked as data; the ledger keeps the provider or host, never the query or page | *(documented, docs/assistant.md "a search or a page read sends words out of Lens")* | -| admin settings: model, embeddings, speech, decisions, Fedora, bridge, Telegram bot, Slack app tokens, assistant mailbox, telemetry, IIIF import, rclone remotes, IMAP, Gmail (a Google refresh token or a Workspace service account key), iCal, MQTT bridge, OIDC issuer, web search (a SearXNG address, a Brave Search or Tavily key) | URL, credentials, `api_key_env` | admin only; documented guards still apply (P-ADMIN-GUARD) | resource-name, x-credential | admin is trusted | *(maintainer, 2026-10)* | +| admin settings: model, embeddings, speech, decisions, Fedora, bridge, Telegram bot, Slack app tokens, assistant mailbox, telemetry, IIIF import, rclone remotes, IMAP, Gmail (a Google refresh token or a Workspace service account key), iCal, news feeds, MQTT bridge, OIDC issuer, web search (a SearXNG address, a Brave Search or Tavily key) | URL, credentials, `api_key_env` | admin only; documented guards still apply (P-ADMIN-GUARD) | resource-name, x-credential | admin is trusted | *(maintainer, 2026-10)* | | replies from remote servers | web page HTML and scripts, IIIF manifests, model replies, OIDC discovery, calendars and their redirects | yes, the remote | data, topology | treat as untrusted | *(inferred, Q17)* | | chat, `/graph/ask`, MCP tools | prompt text; model-chosen tool calls | yes; also indirectly through content | data, x-prompt-injection | none; what people say to Lens, in the web app or a chat app, reaches automations as outside text (`chat.message`, `lens.untrusted`) | *(documented, docs/assistant.md "limited to what the person can read")* | | Lens extension side panel | answers shown there (model text that can repeat third-party text), the sign-in coming back | yes, indirectly through content | data, x-prompt-injection | none; answers render as Markdown cleaned by DOMPurify (no scripts, images or forms; only http and https links), and the sign-in checks its `state` and PKCE | *(documented, extensions/browser/src/core/assistant.js answerHtml docstring "cleaned of anything that could run or fetch on its own")* | @@ -369,16 +370,16 @@ Every row is claimed, disclaimed, N/A with a reason, or unresolved. Family short | AuthZ | x-client-address: compose | claimed | both compose files trust the web app container, so each visitor gets their own address | P-IPGROUP, P-THROTTLE | *(documented, docs/deployment.md "so each visitor gets their own")* | | AuthZ | x-client-address: other variants | unresolved | web app alone, installers, NAS, Proxmox without a reverse proxy setting `X-Forwarded-For` | Q2 | *(inferred, Q2)* | | AuthZ | x-share-scope | unresolved | `?s=` share tokens open the audio, video, frames and page API routes | Q7 | *(inferred, Q7)* | -| Outbound | Numeric domain | claimed | web paths and iCal: ports 80 and 443 | P-SSRF-GUARD, P-ADMIN-GUARD | *(documented, docs/api.md "Only public addresses are reached, on ports 80 and 443")* | +| Outbound | Numeric domain | claimed | web paths, iCal and news feeds: ports 80 and 443 | P-SSRF-GUARD, P-ADMIN-GUARD | *(documented, docs/api.md "Only public addresses are reached, on ports 80 and 443")* | | Outbound | Numeric domain: notification ports | unresolved | notification targets may use any port; the guard checks addresses only | Q15 | *(inferred, Q15)* | | Outbound | Failure atomicity | claimed | each notification event claimed once across processes, then retried | P-NOTIFY | *(documented, docs/notifications.md "claimed once")* | | Outbound | Recursive / cyclic topology (redirects) | claimed | http and https only, each hop re-checked; credentials never follow a redirect to another server; notifications and an automation's `http_request` follow none | P-SSRF-GUARD, P-SECRETS | *(documented, docs/processing.md "never sent on to another server")* | | Outbound | Callback / collaborator execution | disclaimed | Chromium may lack its sandbox; the proxy is the barrier | N-CHROMIUM | *(documented, docs/deployment.md "what stops a page is Lens's proxy")* | | Outbound | Serialization / reconstruction | claimed | sealed secrets are write-only through the API | P-SECRETS | *(documented, docs/configuration.md "the API reports whether one is set, never its value")* | -| Outbound | x-admin-operand-guards | claimed | iCal public-address guard; telemetry endpoint without user:password or link-local address | P-ADMIN-GUARD | *(documented, docs/processing.md "fetched the way web pages are captured")* | +| Outbound | x-admin-operand-guards | claimed | iCal and news feed public-address guard; telemetry endpoint without user:password or link-local address | P-ADMIN-GUARD | *(documented, docs/processing.md "fetched the way web pages are captured")* | | Outbound | x-admin-operand-guards: telemetry headers | unresolved | saved headers dropped when the endpoint moves to another host | Q35 | *(inferred, Q35)* | | Outbound | x-remote-identity: IMAP | claimed | a rebuilt mailbox gets new names, so an old name never reads another message | P-REMOTE-NAMES | *(documented, docs/processing.md "an old one never reads another message")* | -| Outbound | x-remote-identity: other sources | unresolved | rclone, iCal and IIIF cache keys and names | Q43 | *(inferred, Q43)* | +| Outbound | x-remote-identity: other sources | unresolved | rclone, iCal, news feed and IIIF cache keys and names | Q43 | *(inferred, Q43)* | | Outbound | Reference lifecycle: key placement | unresolved | `secret.key` in `data_dir` with data and backups | Q14 | *(inferred, Q14)* | | Outbound | Reference lifecycle: key rotation | claimed | a new key makes stored credentials and encrypted files unreadable | §1.13 | *(documented, docs/deployment.md "Stable secrets")* | | Outbound | Concurrency / reentrancy | unresolved | loopback guard proxy open to local processes during a capture | Q19 | *(inferred, Q19)* | @@ -524,9 +525,9 @@ Paths in the Voided by column are relative to `fastapi_backend/app/`. Searches c | P-HOST | The `Host` header must be a served host. This stops DNS rebinding. | bad-data-accepted | correctness-only | *(documented, docs/configuration.md "stops DNS rebinding")* | Voided by: `*` in `server.allowed_hosts` — `core/middleware.py:70`; `ARCHIVE_ALLOWED_HOSTS` — `domain/settings.py:129`. | | P-FRAME | The API sends a strict CSP. Only the player (`/embed/`, `/s/`) can be framed, and only by `server.embed_frame_ancestors`. | integrity-bypass | security-critical | *(documented, docs/configuration.md "can be framed")* | Voided by: `server.embed_frame_ancestors` — `core/middleware.py:72` (default `'self'`, `domain/store.py:185`). | | P-HARDENED | In the compose files the database, API and Fedora ports bind to 127.0.0.1, containers run non-root with `no-new-privileges`, and the web app sends `nosniff`, a referrer policy, a permissions policy and a frame policy (HSTS through Cloudflare). In `docker-compose.prod.yml` the DB password is random and the web app listens on this machine unless `LENS_BIND` is set. | x-missing-hardening | correctness-only | *(documented, docs/deployment.md "What's hardened already")* | Voided by: `LENS_BIND=0.0.0.0` — `docker-compose.prod.yml:153`, which an admin can also ask for from Settings (`PUT /api/v1/admin/install`); dev web port — `docker-compose.yml:95` (§1.3); the opt-in `sandbox` profile's `openshell-init`, `openshell-key` and `openshell-gateway` run as root, the gateway with the Docker socket (§1.6). | -| P-SECRETS | Stored secrets (source credentials, notification secrets, model API keys, the Hugging Face token, iCal addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only. The API reports whether one is set, never its value. A key from the environment is never shown. They do not leak through the API, logs, exports, or a redirect to another server. | info-leak | security-critical | *(documented, SECURITY.md "stored credentials for sources and model servers leaking")* | Voided by: `secret.key` or `ARCHIVE_SECRET_KEY` holders — `domain/settings.py:196-199` (Q14). An admin moving a model URL sends the key there — `domain/llm.py:30-32` (trusted). LLM errors name the URL as typed — `domain/llm.py:41` (Q18). An MCP server's values whose names don't say they carry a credential, and a secret written into its address or arguments, are kept as given — `domain/mcp_servers.py`. | +| P-SECRETS | Stored secrets (source credentials, notification secrets, model API keys, the Hugging Face token, iCal and news feed addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only. The API reports whether one is set, never its value. A key from the environment is never shown. They do not leak through the API, logs, exports, or a redirect to another server. | info-leak | security-critical | *(documented, SECURITY.md "stored credentials for sources and model servers leaking")* | Voided by: `secret.key` or `ARCHIVE_SECRET_KEY` holders — `domain/settings.py:196-199` (Q14). An admin moving a model URL sends the key there — `domain/llm.py:30-32` (trusted). LLM errors name the URL as typed — `domain/llm.py:41` (Q18). An MCP server's values whose names don't say they carry a credential, and a secret written into its address or arguments, are kept as given — `domain/mcp_servers.py`. | | P-SSRF-GUARD | URLs a non-admin sets (web import and extension `http` tools by editors; notification targets by owners; an automation's `http_request` by its person, within the notification networks; the page addresses the assistant's `web_read` reads, which the model picks for whoever uses the assistant) reach public addresses only, or networks the operator or an admin listed (an admin, in Settings, never loopback or link-local ones). Web paths use ports 80 and 443, follow redirects only to http and https, re-check every redirect and sub-request, and connect to the checked address. An automation's `http_request` follows no redirect, takes 10 seconds and reads 64 KB at most, asks first unless the person set its node to run on its own, and passes the answer on as outside text. | info-leak | security-critical | *(maintainer, 2026-10)* | Voided by: Operator networks — `domain/store.py:475-476`, `domain/netguard.py:40-41`; admin web networks — `domain/settings.py` `_web_networks`; admin notification networks — `domain/notify.py:286-288`; Chromium without sandbox — `domain/convert.py:273`. Search: `grep -rlE 'public_ip\|netguard\.(resolve\|Guard)\|web_networks' fastapi_backend/app` — `netguard.py`, `webcapture.py`, `feeds.py`, `extensions.py`, `notify.py`, `convert.py`, `store.py`, `web.py`, `routes/imports.py`; none disables the check. | -| P-ADMIN-GUARD | Guards Lens documents on admin-set operands hold. iCal feeds are fetched like web captures: public addresses only (and `documents.web_networks`), ports 80 and 443, and the password never goes on to a server the calendar redirects to *(documented, docs/processing.md "fetched the way web pages are captured")*. The telemetry endpoint cannot carry a user name or password or be a link-local address *(documented, domain/settings.py validation message "can't be a link-local address")*. | info-leak | security-critical | *(documented, docs/processing.md "fetched the way web pages are captured")* | Voided by: `documents.web_networks` widens the iCal guard — `domain/feeds.py:377`; telemetry checks — `domain/settings.py:751`, `domain/settings.py:757`. | +| P-ADMIN-GUARD | Guards Lens documents on admin-set operands hold. iCal and news feeds are fetched like web captures: public addresses only (and `documents.web_networks`), ports 80 and 443, and the password never goes on to a server the calendar or feed redirects to, or to a feed a site's page names on another server *(documented, docs/processing.md "fetched the way web pages are captured")*. The telemetry endpoint cannot carry a user name or password or be a link-local address *(documented, domain/settings.py validation message "can't be a link-local address")*. | info-leak | security-critical | *(documented, docs/processing.md "fetched the way web pages are captured")* | Voided by: `documents.web_networks` widens the iCal and news feed guard — `domain/feeds.py:377`; telemetry checks — `domain/settings.py:751`, `domain/settings.py:757`. | | P-NO-FETCH | SPARQL refuses SERVICE and FROM and never loads a named graph. RDF import fetches nothing, refuses remote JSON-LD contexts and does not read RDF/XML. | info-leak | security-critical | *(documented, rdf_import.py docstring "Nothing is fetched while reading")* | Voided by: Process-global rdflib flag, set per call — `domain/rdf.py:576`; SERVICE refused — `domain/rdf.py:551`; remote contexts — `domain/rdf_import.py:54-56`. | | P-QUERY | Cypher is read-only and runs on the caller's readable namespaces. A query stops within 3 million steps or 8 seconds; paths run up to 8 hops. Threshold: running past the budget is a bug; slow within it is not. | integrity-bypass (writes, scope); hang (budget) | security-critical (scope, writes); correctness-only (budget) | *(documented, docs/graph.md "3 million steps")* | Voided by: Admins see every namespace; write refusals — `domain/cypher.py:39`; budgets — `domain/cypher.py:35-38`. | | P-RETRIEVAL | Chat, assistant tools and MCP return only what the person can read, within the conversation's scope, and the tool loop stops at `ai.max_steps` and `ai.max_transcript_reads`. A namespace's chat completions answer from that namespace alone, with only the read tools its owners offered. | info-leak (scope); hang (caps) | security-critical (scope); correctness-only (caps) | *(documented, docs/assistant.md "limited to what the person can read")* | Voided by: Admins read everything; an admin setup conversation adds server tools and the `act` flag — `domain/ai_tools.py:287-289`; `ai.extensions: false` turns extensions off. | @@ -576,7 +577,7 @@ Exported by phase 3.6 (backtest) and de-identified. Closing rows carry their sta | ID | The project does not provide | Conditions / boundary | Tier | False friend? | Provenance | | --- | --- | --- | --- | --- | --- | | N-ADMIN | Protection from the instance admin or host operator, including admin-set URLs reaching internal hosts, admin code, templates, regexes, component installs and `api_key_env` | Covers only operands an admin or operator alone can set. Excludes the guards Lens documents on them (P-ADMIN-GUARD): an escape of one is `VALID`. Also excludes what happens to saved telemetry headers when the endpoint moves to another host; that row is unresolved (Q35), so such a report routes `MODEL-GAP`, not a close. A non-admin reaching any admin operand is in model. | security-critical | no | *(maintainer, 2026-10)* | -| N-EGRESS | An egress firewall. `netguard` guards web import, iCal feeds, extension `http` tools, notifications, the assistant's web search and page reads, and Chromium; nothing else | Admin-set URLs other than iCal feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded | security-critical | yes: "public addresses only" reads as server-wide | *(maintainer, 2026-10)* | +| N-EGRESS | An egress firewall. `netguard` guards web import, iCal and news feeds, extension `http` tools, notifications, the assistant's web search and page reads, and Chromium; nothing else | Admin-set URLs other than iCal and news feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded | security-critical | yes: "public addresses only" reads as server-wide | *(maintainer, 2026-10)* | | N-CODE-GUARD | A sandbox for Python code tools. Audit hooks, rlimits and an optional network namespace "raise the bar" only | Admin-written code; runs as the Lens user | security-critical | yes: guard is not isolation | *(documented, domain/code_tools.py docstring "they aren't a wall")* | | N-DOWNLOADS | Integrity beyond HTTPS and the publisher for llama.cpp, cloudflared, pip installs and `hf:` models | Catalog GGUF files are still checked (P-MODEL-CHECKSUM) | security-critical | no | *(maintainer, 2026-10)* | | N-DB-PLAIN | Encryption of the SurrealDB content (assets' text, indexes), derived files, renditions, reports, exports and the storage-source cache | Stated limit | security-critical | yes: vaults cover files only | *(documented, docs/encryption.md "the SurrealDB database itself")* | @@ -678,7 +679,7 @@ The operator (and, for the last rows, integrators that consume Lens output) must | Enabling a teammate's shared extension without reading it | Its `http` tool can send your readable data to its author's host | Enable only extensions you trust (Q27) | | Turning on the chat-room bridge without its own account | The room reads as the admin | Give the bridge a low-role account | | Making someone admin so they can write a Python tool | Admin equals host code execution | Use prompt, graph or `http` tools | -| Wide `LENS_WEB_NETWORKS` | Editors, and iCal feed redirects, can then reach those networks | List single hosts | +| Wide `LENS_WEB_NETWORKS` | Editors, and iCal and news feed redirects, can then reach those networks | List single hosts | | Webhook push token in a URL that proxies log | The token is a credential in the path | Use the header form | | Pointing the assistant at a hosted model for sensitive archives | Assets' text leaves the machine | Use a local model server | diff --git a/threat-model.yaml b/threat-model.yaml index 3fd9e4843..eedc783a9 100644 --- a/threat-model.yaml +++ b/threat-model.yaml @@ -2,10 +2,10 @@ # Authority order: prose > yaml > json. Regenerate whenever the prose changes. schema: threat-model-sidecar/v2 project: lens -prose_version: "threat-model.md@sha256:35bef40c8c965ae68f3e5d5f839c22c8528f5526f251c4e5384deb840575ca60" +prose_version: "threat-model.md@sha256:0a7c41f1c28cc0a51cdcf042298be46d0269df2b4ddc7f53dce621c9fe1f690b" model_status: under-review triage_policy: strict -confidence: {documented: 204, maintainer: 46, inferred: 91, assumption: 8} +confidence: {documented: 205, maintainer: 46, inferred: 91, assumption: 8} generation: model: "Claude Opus 5.5 (claude-opus-5-5)" @@ -330,10 +330,10 @@ entry_points: control_kinds: [data, resource-name, size] caller_must_enforce: "none — P-UPLOAD; the address form /hooks/import/{token} takes hook tokens only, so a person's token never sits in a logged path" provenance: {kind: documented, source: 'docs/api.md "the address form takes hook tokens only"'} - - id: "watched folders, storage sources, IMAP, Gmail, iCal" + - id: "watched folders, storage sources, IMAP, Gmail, iCal, news feeds" component: outbound parameters: - - name: "remote file names, bytes, mail, events" + - name: "remote file names, bytes, mail, events, feed posts" attacker_controllable: true x-condition: "whoever writes to the remote, mails the box or serves the feed" control_kinds: [data, resource-name, size] @@ -350,6 +350,16 @@ entry_points: obligation_id: admin-creates-sources caller_must_enforce: "admin creates sources; read-only calendar.readonly scope; Google's own token endpoint and API address (a key file's token_uri is ignored); event text escaped into its .ics without control characters" provenance: {kind: documented, source: 'docs/processing.md "The token endpoint is always Google''s own"'} + - id: "News feed sources" + component: outbound + parameters: + - name: "the feed's address (or a site's page that names its feed), user and password; the feed's XML and its posts' HTML" + attacker_controllable: true + x-condition: "address and password: admins only, sealed and write-only; XML and HTML: whoever serves the feed or writes its posts" + control_kinds: [data, x-prompt-injection, size] + obligation_id: admin-creates-sources + caller_must_enforce: "admin creates sources; fetched as iCal feeds are; feedparser reads the XML with external entities off and drops scripts, styles and event handlers from a post's HTML; each post kept as an Atom entry Lens writes, without the feed's address; post text is marked untrusted in prompts" + provenance: {kind: documented, source: 'docs/processing.md "News feeds (RSS and Atom)"'} - id: "Connect with Google" component: outbound parameters: @@ -378,7 +388,7 @@ entry_points: control_kinds: [resource-name, x-network-destination, x-prompt-injection, size] caller_must_enforce: "none — queries go only to the admin's provider; pages are fetched through netguard like web import, 10 MB at most (P-SSRF-GUARD); once the answer has read outside text, a query or address neither the person nor a tool gave it asks first (P-INJECTION-EGRESS); results and pages reach the model marked as data; the ledger keeps the provider or host, never the query or page" provenance: {kind: documented, source: 'docs/assistant.md "a search or a page read sends words out of Lens"'} - - id: "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, MQTT bridge, OIDC issuer, web search)" + - id: "admin settings (model, embeddings, speech, decisions, Fedora, bridge, telemetry, IIIF import, rclone remotes, IMAP, Gmail sign-in, iCal, news feeds, MQTT bridge, OIDC issuer, web search)" component: outbound parameters: - name: "URL, credentials, api_key_env" @@ -654,16 +664,16 @@ contract_dimensions: - {component: authz, dimension: x-client-address-other-variants, status: unresolved, conditions: "web app alone, installers, NAS, Proxmox without a reverse proxy setting X-Forwarded-For", question_id: Q2, provenance: {kind: inferred, question_id: Q2}} - {component: authz, dimension: x-share-scope, status: unresolved, conditions: "?s= share tokens open the audio, video, frames and page API routes", question_id: Q7, provenance: {kind: inferred, question_id: Q7}} # --- Outbound - - {component: outbound, dimension: numeric-domain, status: claimed, property_id: P-SSRF-GUARD, conditions: "web paths and iCal: ports 80 and 443", x-routes-to: "P-SSRF-GUARD, P-ADMIN-GUARD", provenance: {kind: documented, source: 'docs/api.md "Only public addresses are reached, on ports 80 and 443"'}} + - {component: outbound, dimension: numeric-domain, status: claimed, property_id: P-SSRF-GUARD, conditions: "web paths, iCal and news feeds: ports 80 and 443", x-routes-to: "P-SSRF-GUARD, P-ADMIN-GUARD", provenance: {kind: documented, source: 'docs/api.md "Only public addresses are reached, on ports 80 and 443"'}} - {component: outbound, dimension: x-numeric-domain-notification-ports, status: unresolved, conditions: "notification targets may use any port; the guard checks addresses only", question_id: Q15, provenance: {kind: inferred, question_id: Q15}} - {component: outbound, dimension: failure-atomicity, status: claimed, property_id: P-NOTIFY, conditions: "each notification event claimed once across processes, then retried", provenance: {kind: documented, source: 'docs/notifications.md "claimed once"'}} - {component: outbound, dimension: recursive-cyclic-topology, status: claimed, property_id: P-SSRF-GUARD, conditions: "redirects: http and https only, each hop re-checked; credentials never follow a redirect to another server; notifications and an automation's http_request follow none", x-routes-to: "P-SSRF-GUARD, P-SECRETS", provenance: {kind: documented, source: 'docs/processing.md "never sent on to another server"'}} - {component: outbound, dimension: callback-execution, status: disclaimed, property_id: N-CHROMIUM, conditions: "Chromium may lack its sandbox; the proxy is the barrier", provenance: {kind: documented, source: 'docs/deployment.md "what stops a page is Lens''s proxy"'}} - {component: outbound, dimension: serialization-reconstruction, status: claimed, property_id: P-SECRETS, conditions: "sealed secrets are write-only through the API", provenance: {kind: documented, source: 'docs/configuration.md "the API reports whether one is set, never its value"'}} - - {component: outbound, dimension: x-admin-operand-guards, status: claimed, property_id: P-ADMIN-GUARD, conditions: "iCal public-address guard; telemetry endpoint without user:password or link-local address", provenance: {kind: documented, source: 'docs/processing.md "fetched the way web pages are captured"'}} + - {component: outbound, dimension: x-admin-operand-guards, status: claimed, property_id: P-ADMIN-GUARD, conditions: "iCal and news feed public-address guard; telemetry endpoint without user:password or link-local address", provenance: {kind: documented, source: 'docs/processing.md "fetched the way web pages are captured"'}} - {component: outbound, dimension: x-admin-operand-guards-telemetry-headers, status: unresolved, conditions: "saved headers dropped when the endpoint moves to another host", question_id: Q35, provenance: {kind: inferred, question_id: Q35}} - {component: outbound, dimension: x-remote-identity-imap, status: claimed, property_id: P-REMOTE-NAMES, conditions: "a rebuilt mailbox gets new names, so an old name never reads another message", provenance: {kind: documented, source: 'docs/processing.md "an old one never reads another message"'}} - - {component: outbound, dimension: x-remote-identity-other-sources, status: unresolved, conditions: "rclone, iCal and IIIF cache keys and names", question_id: Q43, provenance: {kind: inferred, question_id: Q43}} + - {component: outbound, dimension: x-remote-identity-other-sources, status: unresolved, conditions: "rclone, iCal, news feed and IIIF cache keys and names", question_id: Q43, provenance: {kind: inferred, question_id: Q43}} - {component: outbound, dimension: reference-lifecycle, status: unresolved, conditions: "key placement: secret.key in data_dir with data and backups", question_id: Q14, provenance: {kind: inferred, question_id: Q14}} - {component: outbound, dimension: x-reference-lifecycle-key-rotation, status: claimed, property_id: MX-OUTBOUND-KEY-ROTATION, conditions: "a new key makes stored credentials and encrypted files unreadable", x-routes-to: "§1.13", provenance: {kind: documented, source: 'docs/deployment.md "Stable secrets"'}} - {component: outbound, dimension: concurrency-reentrancy, status: unresolved, conditions: "loopback guard proxy open to local processes during a capture", question_id: Q19, provenance: {kind: inferred, question_id: Q19}} @@ -1503,7 +1513,7 @@ properties_claimed: kind: confidentiality components: [outbound] tier: security-critical - conditions: "stored secrets (source credentials, notification secrets, model API keys, iCal addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only; the API reports whether one is set, never its value; a key from the environment is never shown; they do not leak through the API, logs, exports, or a redirect to another server" + conditions: "stored secrets (source credentials, notification secrets, model API keys, iCal and news feed addresses, an automation's credential headers, sealed to that automation and the address they were saved for, an MCP server's credential headers and env values, sealed to its extension and the address or command they were saved for) are encrypted and write-only; the API reports whether one is set, never its value; a key from the environment is never shown; they do not leak through the API, logs, exports, or a redirect to another server" violation_symptoms: [info-leak] x-voided-by: "secret.key or ARCHIVE_SECRET_KEY holders (domain/settings.py:196-199, Q14); an admin moving a model URL sends the key there (domain/llm.py:30-32, trusted); LLM errors name the URL as typed (domain/llm.py:41, Q18); an MCP server's values whose names don't say they carry a credential, and a secret written into its address or arguments, are kept as given (domain/mcp_servers.py)" provenance: {kind: documented, source: 'SECURITY.md "stored credentials for sources and model servers leaking"'} @@ -1520,9 +1530,9 @@ properties_claimed: components: [outbound] tier: security-critical x-tier-question: Q37 - conditions: "guards Lens documents on admin-set operands hold: iCal feeds are fetched like web captures (public addresses only and documents.web_networks, ports 80 and 443, the password never goes on to a server the calendar redirects to); the telemetry endpoint cannot carry a user name or password or be a link-local address" + conditions: "guards Lens documents on admin-set operands hold: iCal and news feeds are fetched like web captures (public addresses only and documents.web_networks, ports 80 and 443, the password never goes on to a server the calendar or feed redirects to, or to a feed a site's page names on another server); the telemetry endpoint cannot carry a user name or password or be a link-local address" violation_symptoms: [info-leak] - x-voided-by: "documents.web_networks widens the iCal guard (domain/feeds.py:377); telemetry checks (domain/settings.py:751, :757)" + x-voided-by: "documents.web_networks widens the iCal and news feed guard (domain/feeds.py:377); telemetry checks (domain/settings.py:751, :757)" provenance: {kind: documented, source: 'docs/processing.md "fetched the way web pages are captured"'} - id: P-NO-FETCH kind: confidentiality @@ -1797,7 +1807,7 @@ properties_claimed: # ---------------------------------------------------------------- §1.12 properties_disclaimed: - {id: N-ADMIN, components: [outbound, ingest, assistant, optional], tier: security-critical, false_friend: false, conditions: "protection from the instance admin or host operator (admin-set URLs reaching internal hosts, admin code, templates, regexes, component installs, api_key_env). Covers only operands an admin or operator alone can set. Excludes the guards Lens documents on them (P-ADMIN-GUARD): an escape of one is VALID. Excludes saved telemetry headers when the endpoint moves host (unresolved, Q35 -> MODEL-GAP). A non-admin reaching any admin operand is in model.", provenance: {kind: maintainer, date: "2026-10"}} - - {id: N-EGRESS, components: [outbound], tier: security-critical, false_friend: true, conditions: "an egress firewall; netguard guards web import, iCal feeds, extension http tools, notifications, the assistant's web search and page reads, and Chromium, nothing else; admin-set URLs other than iCal feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded", x-false-friend-note: "'public addresses only' reads as server-wide", provenance: {kind: maintainer, date: "2026-10"}} + - {id: N-EGRESS, components: [outbound], tier: security-critical, false_friend: true, conditions: "an egress firewall; netguard guards web import, iCal and news feeds, extension http tools, notifications, the assistant's web search and page reads, and Chromium, nothing else; admin-set URLs other than iCal and news feeds (model, speech, Fedora, IIIF import, rclone sources, IMAP, MQTT bridge, OIDC, telemetry, tunnel, a SearXNG instance for web search) are unguarded", x-false-friend-note: "'public addresses only' reads as server-wide", provenance: {kind: maintainer, date: "2026-10"}} - {id: N-CODE-GUARD, components: [assistant], tier: security-critical, false_friend: true, conditions: "a sandbox for Python code tools; audit hooks, rlimits and an optional network namespace only raise the bar; admin-written code; runs as the Lens user", x-false-friend-note: "guard is not isolation", provenance: {kind: documented, source: 'domain/code_tools.py docstring "they aren''t a wall"'}} - {id: N-DOWNLOADS, components: [optional], tier: security-critical, false_friend: false, conditions: "integrity beyond HTTPS and the publisher for llama.cpp, cloudflared, pip installs and hf: models; catalog GGUF files are still checked (P-MODEL-CHECKSUM)", provenance: {kind: maintainer, date: "2026-10"}} - {id: N-DB-PLAIN, components: [outbound], tier: security-critical, false_friend: true, conditions: "encryption of the SurrealDB content (assets' text, indexes), derived files, renditions, reports, exports and the storage-source cache; stated limit", x-false-friend-note: "vaults cover files only", provenance: {kind: documented, source: 'docs/encryption.md "the SurrealDB database itself"'}} @@ -1886,7 +1896,7 @@ known_misuses: - {id: km-enable-unread-extension, components: [assistant], pattern: "Enabling a teammate's shared extension without reading it", x-why-unsafe: "Its http tool can send your readable data to its author's host", safer_alternative: "Enable only extensions you trust (Q27)", x-provenance-basis: "§1.13 row 'Enable another person's extension only when you trust its author' (Q27)", provenance: {kind: inferred, question_id: Q27}} - {id: km-bridge-without-account, components: [outbound], pattern: "Turning on the chat-room bridge without its own account", x-why-unsafe: "The room reads as the admin", safer_alternative: "Give the bridge a low-role account", x-provenance-basis: "§1.12 N-BRIDGE", provenance: {kind: documented, source: 'docs/chat-rooms.md "answers as the admin who turned it on"'}} - {id: km-admin-for-python-tool, components: [assistant], pattern: "Making someone admin so they can write a Python tool", x-why-unsafe: "Admin equals host code execution", safer_alternative: "Use prompt, graph or http tools", x-provenance-basis: "§1.2 roles and trust; §1.13 'Make only fully trusted people admins'", provenance: {kind: maintainer, date: "2026-10"}} - - {id: km-wide-web-networks, components: [outbound], pattern: "Wide LENS_WEB_NETWORKS", x-why-unsafe: "Editors, and iCal feed redirects, can then reach those networks", safer_alternative: "List single hosts", x-provenance-basis: "§1.6 web_networks row; §1.13 private networks row", provenance: {kind: documented, source: 'docs/configuration.md "loopback and cloud metadata addresses stay out"'}} + - {id: km-wide-web-networks, components: [outbound], pattern: "Wide LENS_WEB_NETWORKS", x-why-unsafe: "Editors, and iCal and news feed redirects, can then reach those networks", safer_alternative: "List single hosts", x-provenance-basis: "§1.6 web_networks row; §1.13 private networks row", provenance: {kind: documented, source: 'docs/configuration.md "loopback and cloud metadata addresses stay out"'}} - {id: km-push-token-in-url, components: [optional], pattern: "Webhook push token in a URL that proxies log", x-why-unsafe: "The token is a credential in the path", safer_alternative: "Use the header form", x-provenance-basis: "§1.13 row 'Keep logs that record request paths private'", provenance: {kind: documented, source: 'docs/sensors.md "Ways in"'}} - {id: km-hosted-model-sensitive, components: [assistant], pattern: "Pointing the assistant at a hosted model for sensitive archives", x-why-unsafe: "Assets' text leaves the machine", safer_alternative: "Use a local model server", x-provenance-basis: "§1.13 row 'Pick model and speech servers you trust'", provenance: {kind: maintainer, date: "2026-10"}}