Skip to content
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

Spec descendant frames' ongoing navigations block disableUntrustedNetwork promise from being resolved #210

Conversation

xiaochen-z
Copy link
Collaborator

@xiaochen-z xiaochen-z commented Feb 10, 2025

fix: #205

This PR only implements the change in algorithm "recalculate the untrusted network status of all fenced frame descendants".

The part that this algorithm should be called whenever a navigation commits will be done in a follow-up PR. I'm still investigating how to spec this. See previous comment on this.


Preview | Diff

@xiaochen-z xiaochen-z added the specification Additions to specifications label Feb 10, 2025
@xiaochen-z xiaochen-z changed the title Spec descendant frame' ongoing navigations block disableUntrustedNetwork promise from being resolved Spec descendant frames' ongoing navigations block disableUntrustedNetwork promise from being resolved Feb 10, 2025
@xiaochen-z xiaochen-z requested a review from blu25 February 10, 2025 20:04
Copy link
Collaborator

@blu25 blu25 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@xiaochen-z
Copy link
Collaborator Author

+@domfarolino for review, thank you.

Copy link
Collaborator

@domfarolino domfarolino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty much lgtm. This covers traversals as well btw, which I think is the goal too? Does that match the implementation? And are there WPTs?

@xiaochen-z
Copy link
Collaborator Author

Thanks!

This covers traversals as well btw, which I think is the goal too? Does that match the implementation?

From what I read from the spec, when ongoing navigation is "traversal", it means the navigable is traversing its history. For example, FF going back to a previously navigated URL. The FF may end up with a different page and having its untrusted network status reset to enabled.

This is the race condition that the PR targets: When a parent frame tries to disable untrusted networks, it checks the child frame and finds it has untrusted network disabled. Without checking descendant frames' ongoing navigations, the parent frame goes ahead marking its untrusted network also disabled. But if the child frame has an ongoing navigation, including the history traversal, it resets the child frame's untrusted network to enabled as the frame navigates to a different page.

The implementation checks this via FrameTreeNode::HasNavigation(), which is set during normal navigation as well as history traversal. So the spec matches the implementation.

And are there WPTs?

No. I'm adding WPTs for this. Tracking in bug: crbug/397377177.

@xiaochen-z
Copy link
Collaborator Author

WPTs added in https://chromium-review.googlesource.com/c/chromium/src/+/6280958. However they were added to wpt_internal/ where other network revocation WPTs live. I suppose it is not possible to link internal WPTs in the spec?

@blu25
Copy link
Collaborator

blu25 commented Feb 22, 2025

WPTs added in https://chromium-review.googlesource.com/c/chromium/src/+/6280958. However they were added to wpt_internal/ where other network revocation WPTs live. I suppose it is not possible to link internal WPTs in the spec?

On a separate PR, @domfarolino had suggested offline to add a non-normative section that links to the internal WPT directory with an explanation of why they're internal. Not sure if it's worth doing here or just adding the WPTs later once we move them to the external directory.

@domfarolino
Copy link
Collaborator

I think that'd be good.

@xiaochen-z
Copy link
Collaborator Author

xiaochen-z commented Feb 24, 2025

Thanks! There is an issue block below already stated that the internal WPTs will be upstreamed and listed there once the required test-only function is added to the WPT web driver.

fenced-frame/spec.bs

Lines 2154 to 2158 in 6fa197f

Issue: This will require a RFC to add a test-only function to the WPT web driver.
(<a href="https://github.com/WICG/fenced-frame/issues/192">WICG/fenced-frame#192</a>)
Once that web driver changes is made, existing Chromium-internal web platform tests for
{{Fence/disableUntrustedNetwork()}} need to be upstreamed and linked here.
(<a href="https://github.com/WICG/fenced-frame/issues/207">WICG/fenced-frame#207</a>)

@domfarolino
Copy link
Collaborator

Sure but maybe this PR can link to the specific test that's relevant to the changes made in this patch.

@domfarolino domfarolino merged commit f73c8b4 into WICG:master Mar 4, 2025
2 checks passed
github-actions bot added a commit that referenced this pull request Mar 4, 2025
…work promise from being resolved (#210)

SHA: f73c8b4
Reason: push, by domfarolino

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
specification Additions to specifications
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Spec] Promise returned by disableUntrustedNetwork call is not resolved with ongoing navigation
3 participants