fix: consider about:blank a safe URL - #25317
Merged
Merged
Conversation
The safe URL check is based on the URL scheme and the about scheme is not safe by default, which also blocked legitimate use of about:blank, for example as the initial source of an IFrame. Accept about:blank regardless of the configured schemes since it shows an empty document and cannot run scripts. Other about: URLs are still checked against the configured schemes. Fixes #25316
Contributor
|
Artur-
approved these changes
Aug 26, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Aug 26, 2026
vaadin-bot
added a commit
that referenced
this pull request
Aug 26, 2026
This PR cherry-picks changes from the original PR #25317 to branch 25.2. --- #### Original PR description > The safe URL check is based on the URL scheme, and `about` is not in the default set of safe schemes. As a side effect, this also blocked legitimate uses of `about:blank`, such as setting it as the initial source of an `IFrame`. > > `about:blank` is now accepted regardless of the configured safe schemes, since it renders an empty document and cannot run scripts. The comparison is case-insensitive, so `About:Blank` is treated the same way. > > Other `about:` URLs (e.g. `about:config`, or lookalikes such as `about:blank:evil`) are unchanged: they are still rejected unless the `about` scheme is explicitly configured as safe via the `safeUrlSchemes` init parameter. > > ### Changes > > - `UrlUtil.isSafeUrl(...)` short-circuits to `true` for a trimmed, case-insensitive match on `about:blank`, before the scheme-based check. > - Javadoc updated on `UrlUtil.isSafeUrl`, `Constants.DEFAULT_URL_SAFE_SCHEMES` and `InitParameters.URL_SAFE_SCHEMES` to document the exception. > - New tests in `UrlUtilTest` covering `about:blank` (default schemes, mixed case, and a scheme set that excludes `about`) and the other `about:` URLs that must stay unsafe. > > Fixes #25316 Co-authored-by: totally-not-ai[bot] <290682512+totally-not-ai[bot]@users.noreply.github.com>
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.



The safe URL check is based on the URL scheme, and
aboutis not in the default set of safe schemes. As a side effect, this also blocked legitimate uses ofabout:blank, such as setting it as the initial source of anIFrame.about:blankis now accepted regardless of the configured safe schemes, since it renders an empty document and cannot run scripts. The comparison is case-insensitive, soAbout:Blankis treated the same way.Other
about:URLs (e.g.about:config, or lookalikes such asabout:blank:evil) are unchanged: they are still rejected unless theaboutscheme is explicitly configured as safe via thesafeUrlSchemesinit parameter.Changes
UrlUtil.isSafeUrl(...)short-circuits totruefor a trimmed, case-insensitive match onabout:blank, before the scheme-based check.UrlUtil.isSafeUrl,Constants.DEFAULT_URL_SAFE_SCHEMESandInitParameters.URL_SAFE_SCHEMESto document the exception.UrlUtilTestcoveringabout:blank(default schemes, mixed case, and a scheme set that excludesabout) and the otherabout:URLs that must stay unsafe.Fixes #25316