Repository navigation
Sanitizer: block data: URI scheme while keeping data:image for images - #9417
Merged
Merged
Conversation
lordmarrik
force-pushed
the
fix/sanitizer-uri-schemes
branch
from
October 7, 2026 05:27
3f7b716 to
2b334be
Compare
Member
|
Thanks for the PR. Could you please also file a PR against our SimplePie fork? (https://github.com/FreshRSS/simplepie for the SimplePie changes) |
Alkarex
reviewed
Oct 8, 2026
lordmarrik
force-pushed
the
fix/sanitizer-uri-schemes
branch
from
October 10, 2026 14:56
2b334be to
509a08e
Compare
Contributor
Author
|
Thanks for the review.
|
FreshRSS_SimplePieCustom only disallowed the `javascript` scheme, so `data:text/html,...` URIs in feed content survived sanitization on <a href>, <iframe src>, <audio|video|source|track src>. The default CSP neutralises these on FreshRSS pages, but clients and deployments without that CSP (API WebViews, extensions using amendCsp(), proxies stripping headers) could execute them. Same class as GHSA-3fw6-j8m4-82vj / FreshRSS#9272. - Sanitize::is_allowed_uri(): element/attribute-aware check that still permits inert `data:image/...` on img[src], image[src], video[poster] while blocking `data:` elsewhere; replace_urls() now uses it. is_allowed_scheme() is unchanged for backward compatibility. - SimplePieCustom: disallow_uri_schemes(['javascript','data']). - Tests: 4 blocked-input cases, a data:image keep-alive test and an `unsafe:` prefix test. They fail without the patch and pass with it. Co-Authored-By: Claude Fable 5.1 <[email protected]>
lordmarrik
force-pushed
the
fix/sanitizer-uri-schemes
branch
from
October 10, 2026 15:08
509a08e to
d4a808c
Compare
lordmarrik
added a commit
to lordmarrik/simplepie
that referenced
this pull request
Oct 10, 2026
…ithout losing data:image replace_urls() only consulted is_allowed_scheme(), a plain scheme blocklist, so consumers could not disallow `data:` without also breaking inert `data:image/...` on <img>. Add is_allowed_uri(tag, attribute, uri): when `data` is disallowed it still permits data:image/... on img[src], image[src] and video[poster], and blocks `data:` everywhere else (<a href>, <iframe src>, media src, ...). is_allowed_scheme() is unchanged. Companion to FreshRSS/FreshRSS#9417. Co-Authored-By: Claude Fable 5.1 <[email protected]>
Alkarex
pushed a commit
to FreshRSS/simplepie
that referenced
this pull request
Oct 10, 2026
…ithout losing data:image (#92) replace_urls() only consulted is_allowed_scheme(), a plain scheme blocklist, so consumers could not disallow `data:` without also breaking inert `data:image/...` on <img>. Add is_allowed_uri(tag, attribute, uri): when `data` is disallowed it still permits data:image/... on img[src], image[src] and video[poster], and blocks `data:` everywhere else (<a href>, <iframe src>, media src, ...). is_allowed_scheme() is unchanged. Companion to FreshRSS/FreshRSS#9417. Co-authored-by: Claude Fable 5.1 <[email protected]>
Alkarex
approved these changes
Oct 11, 2026
Alkarex
pushed a commit
that referenced
this pull request
Oct 16, 2026
Adds ImperfectBlu to CREDITS.md, following #9417 and FreshRSS/simplepie#92.
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.
Defense-in-depth hardening, same class as GHSA-3fw6-j8m4-82vj / #9272. Private security advisory filed alongside this PR per SECURITY.md: GHSA-5pmx-x7q6-hv7m. SimplePie part: FreshRSS/simplepie#92.
What
FreshRSS_SimplePieCustomonly disallowed thejavascriptscheme, sodata:text/html,...URIs in feed content survived sanitization on<a href>,<iframe src>,<audio|video|source|track src>. They are harmless on FreshRSS's own pages thanks to the default CSP, but can execute in clients or deployments without that CSP (API WebViews, extensions callingamendCsp(), proxies stripping headers).How
lib/simplepie/simplepie/src/Sanitize.php: newis_allowed_uri(string $tag, string $attribute, string $uri)— element/attribute-aware. Whendatais disallowed it still permitsdata:image/...onimg[src],image[src],video[poster](inert and widely used by feeds).replace_urls()now uses it.is_allowed_scheme()is unchanged, so this is backward compatible for other SimplePie users.app/Models/SimplePieCustom.php:disallow_uri_schemes(['javascript', 'data']).tests/app/Models/SimplePieCustomTest.php: 4 blocked-input cases, adata:imagekeep-alive test, and anunsafe:prefix test.Checks
edgewithout the patch and pass with it.vendor/bin/phpunit— OK (757 tests, 1437 assertions).vendor/bin/phpcsandvendor/bin/phpstan— clean on changed files.AI assistance
Found and drafted with Claude Code (Claude Fable 5.1), reviewed by me, per SECURITY.md and AGENTS.md.