-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Gate javascript:
navigation on sandboxing flags.
#5083
base: main
Are you sure you want to change the base?
Conversation
As `javascript:` URLs execute in the target browsing context, it's somewhat surprising that they can be executed from a sandboxed document if that document is allowed to create unsandboxed popups. This patch gates `javascript:` URL execution on the source document's sandboxing flags, which is more in line with developer expectations.
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: this doesn't gate navigation, but it gates execution.
I wonder though how accurate the navigation algorithm really is. Do we unload when navigating to a javascript:
URL? Seems unlikely.
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#716035}
Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#716035}
… to `javascript:`., a=testonly Automatic update from web-platform-tests Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#716035} -- wpt-commits: 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6 wpt-pr: 20250
… to `javascript:`., a=testonly Automatic update from web-platform-tests Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <[email protected]> Reviewed-by: Avi Drissman <[email protected]> Commit-Queue: Avi Drissman <[email protected]> Cr-Commit-Position: refs/heads/master@{#716035} -- wpt-commits: 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6 wpt-pr: 20250
… to `javascript:`., a=testonly Automatic update from web-platform-tests Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Avi Drissman <avichromium.org> Commit-Queue: Avi Drissman <avichromium.org> Cr-Commit-Position: refs/heads/master{#716035} -- wpt-commits: 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6 wpt-pr: 20250 UltraBlame original commit: 5379811f4fed12767e6ebfad53f9612f5424a191
… to `javascript:`., a=testonly Automatic update from web-platform-tests Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Avi Drissman <avichromium.org> Commit-Queue: Avi Drissman <avichromium.org> Cr-Commit-Position: refs/heads/master{#716035} -- wpt-commits: 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6 wpt-pr: 20250 UltraBlame original commit: 5379811f4fed12767e6ebfad53f9612f5424a191
… to `javascript:`., a=testonly Automatic update from web-platform-tests Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: I3b5fa676e73cbf78485b85ce2593284bce2e68cc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1916467 Reviewed-by: Daniel Vogelheim <vogelheimchromium.org> Reviewed-by: Avi Drissman <avichromium.org> Commit-Queue: Avi Drissman <avichromium.org> Cr-Commit-Position: refs/heads/master{#716035} -- wpt-commits: 89aa3f42131cce5a77268ddaeb2fab8a2e29c2a6 wpt-pr: 20250 UltraBlame original commit: 5379811f4fed12767e6ebfad53f9612f5424a191
I think so, yes. That said, I think the test is broken in Firefox and Safari (https://wpt.fyi/results/html/browsers/sandboxing/sandbox-disallow-scripts-via-unsandboxed-popup.tentative.html?label=master&label=experimental&aligned) due to some changes in the way |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this makes sense. @bzbarsky if the source browsing context (which ought to be source document) has scripting disabled, navigating to javascript URLs fails?
does not have the <span>sandboxed scripts browsing context flag</span> set.</p> | ||
|
||
<p class="XXX"><a href="https://github.com/whatwg/html/issues/2591">Issue #2591</a> applies | ||
here as well.</p> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shall we move this note outside the list as it now applies to two items?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not the state we should be using, imo. The state we should be using is state at the entrypoint to "navigate", not at this later point in time, just like we do for the sandboxFlags
in https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate step 14.
This even matters if we use the document's sandbox flags, since those can change over time thanks to meta CSP...
Anyway, in terms of behavior treating the "source is sandboxed without allow-scripts" case the same as the "target is sandboxed without allow-scripts" case makes sense to me. |
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/1916467: Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: Id3e9ebf7f4082c96a92bdaccaea1dd73f5c9b54b Reviewed-by: Jüri Valdmann <[email protected]>
Manual backport of patch originally reviewed on https://chromium-review.googlesource.com/c/chromium/src/+/1916467: Prevent sandboxed frames from navigating to `javascript:`. Frames with the `allow-popup` and `allow-popup-to-escape-sandbox` flags can cause JavaScript execution in their origin by navigating to a `javascript:` URL via `target=_blank` or similar. This is technically correct, but surprising. whatwg/html#5083 aims to tighten that check to match developers' expectations that `javascript:` URLs controlled by a page that's been sandboxed away from script will not execute. Bug: 1014371 Change-Id: Id3e9ebf7f4082c96a92bdaccaea1dd73f5c9b54b Reviewed-by: Michal Klocek <[email protected]>
As
javascript:
URLs execute in the target browsing context, it'ssomewhat surprising that they can be executed from a sandboxed document
if that document is allowed to create unsandboxed popups.
This patch gates
javascript:
URL execution on the source document'ssandboxing flags, which is more in line with developer expectations.
💥 Error: Wattsi server error 💥
PR Preview failed to build. (Last tried on Jan 15, 2021, 7:59 AM UTC).
More
PR Preview relies on a number of web services to run. There seems to be an issue with the following one:
🚨 Wattsi Server - Wattsi Server is the web service used to build the WHATWG HTML spec.
🔗 Related URL
If you don't have enough information above to solve the error by yourself (or to understand to which web service the error is related to, if any), please file an issue.