Skip to content

fix: consider about:blank a safe URL - #25317

Merged
Artur- merged 1 commit into
mainfrom
25316-allow-about-blank
Aug 26, 2026
Merged

fix: consider about:blank a safe URL#25317
Artur- merged 1 commit into
mainfrom
25316-allow-about-blank

Conversation

@totally-not-ai

Copy link
Copy Markdown
Contributor

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

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
@github-actions

Copy link
Copy Markdown
Contributor

Test Results

 1 385 files  ±0   1 386 suites  ±0   1h 27m 55s ⏱️ + 1m 11s
10 570 tests +2  10 503 ✅ +2  67 💤 ±0  0 ❌ ±0 
10 889 runs  +2  10 821 ✅ +2  68 💤 ±0  0 ❌ ±0 

Results for commit 273d2c1. ± Comparison against base commit 8f05c1d.

@sonarqubecloud

Copy link
Copy Markdown

@Artur-
Artur- added this pull request to the merge queue Aug 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Aug 26, 2026
@Artur-
Artur- added this pull request to the merge queue Aug 26, 2026
Merged via the queue into main with commit a5217ae Aug 26, 2026
35 checks passed
@Artur-
Artur- deleted the 25316-allow-about-blank branch August 26, 2026 11:37
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make the safe URL checks accept about:blank

2 participants