Repository navigation
fix: close SSRF via redirect in /render and /screenshot - #61
Merged
Merged
Conversation
The submitted URL was validated once, but the browser then followed redirects without re-checking, and page.content() was returned from wherever the navigation landed. A public URL that redirected to an internal address therefore had the internal response body returned to the caller, unauthenticated SSRF with response exfiltration. - Re-check the destination of every request in the Playwright route handler, aborting any host that does not resolve to a globally routable address. This covers the redirect hop, subresource fetches, and later navigations. - Re-validate the URL a navigation actually landed on before returning content, in both /render and /screenshot. - Replace the enumerated private-range denylist with an is_global allowlist, so CGNAT (100.64.0.0/10) and other special-purpose ranges are refused rather than fetched. - Always install the route handler. It previously existed only when VEILRENDER_RESOURCE_FILTER was enabled and was otherwise None, so that setting would have silently removed the destination check along with ad/tracker filtering.
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.
Summary
Closes an SSRF via redirect. The submitted URL was validated once, but the
browser then followed redirects without re-checking, and
page.content()wasreturned from wherever the navigation landed — so a public URL redirecting to an
internal address returned that address's response body to the caller. Affected
/renderand/screenshot.Reported privately; fixed and released together with the advisory.
Change
every request's destination and aborts any host that does not resolve to a
globally routable address. Because the redirect hop is a fresh request, this is
what actually closes the redirect path — it also covers subresources.
navigation actually landed on before returning or capturing anything.
is_globalallowlist._is_blocked_ipused an enumerated denylist ofprivate ranges, which accepted CGNAT (
100.64.0.0/10) and otherspecial-purpose ranges. It now rejects anything not globally routable.
browser.pyonly built the route handler whenVEILRENDER_RESOURCE_FILTERwas enabled and set it toNoneotherwise — sothat setting skipped
page.route()entirely and would have removed the newdestination check along with ad/tracker filtering. An empty blocklist now
disables filtering only.
SECURITY.mddocumenting private vulnerability reporting;CHANGELOG.mdandversion bump to
0.6.3.Test plan
pytest tests/ -q— 81 passed, 4 failed. The 4 failures are intests/test_fonts.pyand are pre-existing: verified by stashing this changeand re-running on a clean
master, where the same 4 fail (4 failed, 5 passed).Unrelated to this change.
tests/test_url_validator.py+tests/test_filters.py(new, 43 tests) — pass.Cover non-public literals incl. CGNAT,
localhostvia the DNS path, thehandler aborting a redirect to
127.0.0.1:7860/health, allowing publicdestinations and inline
data:URLs, and the refusal cache.ruff check,ruff format --check,ty check src/— all pass.(public redirect → loopback returned the internal body), and will re-run the
same request against
0.6.3after deploy to confirm it is refused.