Skip to content

feat(bridge): break up links a chat-room answer built from what it read - #338

Merged
adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mj7ggd
Oct 10, 2026
Merged

adeelahmad merged 1 commit into
mainfrom
claude/project-thread-mj7ggd

Conversation

@adeelahmad

Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: Slack, Telegram, WhatsApp and most chat apps fetch the links in a message to show a preview. A poisoned document could ask the model to answer with https://evil.example/c?d= followed by the person's notes, and the room's link preview carried that out before anyone clicked, with no tool call for #309's approval to catch.

After: a web address in a chat-room answer stays as it is only when the person, the archive or a tool wrote it, or it is Lens's own address. Any other is broken up (hxxps://evil[.]example/c?d=...) and a Markdown image becomes its address, still readable to copy by hand. The conversation in the web app keeps the answer as it was (it shows no links or images that load by themselves). Settings → Chat rooms → Break up links the answer made itself (bridge.safe_links, on) turns it off.

Fourth of the prompt-injection series (#302 marking, #309 asks first, #329 flags). Next: MCP result labelling, audit log rows, an optional local classifier, and the threat-model update.

Motivation and Context

Rendered answers are the exfiltration path Q26 in threat-model.md names; in a chat room the preview fetch makes it zero-click. This closes it for links the model composed, independent of whether marking or flagging caught the injection.

How: untrusted.links(text) collects the addresses in a text; untrusted.defang(text, keep, own) breaks up every other one and turns images into their address. bridge._answer collects the addresses in the question, the person's past turns, the passages and every tool result (Toolbox.links), and bridge.safe_links applies defang with Lens's own address kept.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md. (n/a: the title and docs/chat-rooms.md say it)

Done questions (AGENTS.md)

  • Goal: closes the zero-click link-preview path in chat rooms; merged on green CI.
  • Agents: applies to every answer posted to a room; the setting is in the settings API.
  • Zero setup: on by default, nothing to install.
  • Fewest clicks and keystrokes: nothing to click; addresses people or the archive wrote stay clickable.
  • Configurable: bridge.safe_links in Settings → Chat rooms, default on.
  • Light: a regex pass over the answer.
  • Private and secure: stops answers from carrying archive text out through link previews; the threat-model update is the last PR of this series.
  • Cost: no model calls.
  • User decides: only addresses nobody in the conversation wrote are broken up; existing defaults unchanged.
  • Upgrades: no stored data changes.
  • Honest: docs say an address the read text wrote itself stays linkable.
  • Tests (tests/domain/test_untrusted.py, tests/api/test_prompt_injection.py), docs (chat-rooms.md); no generated files touched.
  • Open standards; no new dependencies.
  • Result reported with evidence; refine later: Telegram and other direct channel adapters should call untrusted.defang the same way when they post answers.

🤖 Generated with Claude Code

https://claude.ai/code/session_01BVez82cREgCJtFk6yHReed


Generated by Claude Code

Slack, Telegram, WhatsApp and most chat apps fetch the links in a message
to preview them, so a web address the model filled with what it read
(as a poisoned document might ask) would carry it out before anyone
clicks. A web address in a room's answer now stays as it is only when
the person, the archive or a tool wrote it, or it is Lens's own; any
other is broken up (hxxps://evil[.]example/...) and an image becomes its
address. The conversation keeps the answer as it was. bridge.safe_links
(on by default) turns it off.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVez82cREgCJtFk6yHReed
@adeelahmad adeelahmad self-assigned this Oct 10, 2026
@adeelahmad
adeelahmad merged commit 1f7fef8 into main Oct 10, 2026
10 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-mj7ggd branch October 10, 2026 23:05
adeelahmad added a commit that referenced this pull request Oct 11, 2026
…349)

"Stay private and safe" now covers flagging instruction-like text (patterns or the optional local classifier, #329,
#347), asking before the browser acts on what the assistant wrote (#333), breaking up links in chat-room answers
(#338), the archive as data over MCP (#343) and the audit log of what was caught (#344). "See what it costs" adds the
overall budget asked for in setup (#281). "In progress" drops what merged and adds #337, #341 and #346.


Claude-Session: https://claude.ai/code/session_01HDx7PPUauyjMn1LZs8JAsS

Co-authored-by: Adeel Ahmad <noreply@anthropic.com>
adeelahmad pushed a commit that referenced this pull request Oct 14, 2026
P-INJECTION-EGRESS: once an answer has read text from outside Lens,
outbound tools and setup changes ask first, and chat-room answers keep
only the links people, the archive, tools or Lens wrote. Correctness-only,
a bypass is VALID-HARDENING (Q26). The Assistant x-prompt-injection row
is now claimed; N-PROMPT says marking and flagging make injection less
likely and are not claimed; MCP results and the optional classifier are
described; Q26 lists #302, #309, #329, #338, #343, #344 and #347.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BVez82cREgCJtFk6yHReed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants