Repository navigation
fix: images from other sites in messages and notes load on a click - #94
Merged
Merged
Conversation
An image in rendered markdown is a URL the browser fetches the moment the message or note appears, and a URL can carry data: an agent tricked by a page into writing  would send the notes there with no click at all. Remote images now show as a "click to load" button naming the site; images TeamWork serves itself show directly; loaded images are fetched with no referrer. Plain links are unaffected. Found reviewing CaMeL ("Defeating Prompt Injections by Design", arXiv 2503.18813) against the agent this UI is usually paired with: no gate on the agent's side stops a reply that embeds data in an image URL, so the display must not fetch it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Images from other sites in messages and notes load only when clicked. Security fix.
The problem
Messages and notes are rendered markdown, often written by an agent that has just read a web page. react-markdown turns
into a live<img>, so the browser fetches the URL the moment the message appears. A URL can carry data: an agent tricked by a page into writingwould send the notes there without anyone clicking anything. TeamWork has no CSP, and nothing on the agent's side checks an image URL in a reply.What changes
MarkdownContent, images from another origin render as "Image from attacker.example — click to load". It loads, with no referrer, only when clicked.MarkdownContentis the one markdown renderer, so this covers both. Message attachments already use TeamWork's own upload URLs.docs/security/exposure.md.No CSP: an
img-src 'self'policy would also block an image the user chose to load.Found by assessing CaMeL ("Defeating Prompt Injections by Design", arXiv 2503.18813) against Prax (praxagent/prax#276).
Verification
MarkdownContent.images.test.tsx:<img>until clicked, then loads withreferrerpolicy=no-referrer;isLocalImagehandles the edge cases (protocol-relative, other host, http vs https).make cigreen; lint has no new warnings.🤖 Generated with Claude Code
https://claude.ai/code/session_01NzJXnMXFAX7Km7aDmRc6zX