Closed Bug 1461195 Opened 7 years ago Closed 4 years ago

CSP/XFO error pages should offer an option to visit the page directly

Categories

(Core :: DOM: Security, enhancement, P2)

60 Branch
x86
Windows 10
enhancement

Tracking

()

RESOLVED FIXED
mozilla78
Tracking Status
firefox78 --- fixed

People

(Reporter: bug.zilla, Assigned: ingrid, Mentored)

References

(Blocks 3 open bugs, Regressed 1 open bug)

Details

(Whiteboard: [domsecurity-backlog])

Attachments

(3 files)

User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:60.0) Gecko/20100101 Firefox/60.0 Build ID: 20180503143129 Steps to reproduce: Visited a page (in an RSS reader) Actual results: Page was blocked by Firefox due to Content Security Policy Expected results: IE displays the warning but also offers an option to visit the page directly: https://imgur.com/a/0U9dry3
Hello! :) I have attempted to reproduce this issue, but it seems like I do not have all the details needed to reproduce it. Which RSS reader were you using and which page were you visiting when the issue reproduced? Thank you.
Flags: needinfo?(bug.zilla)
Severity: normal → enhancement
Priority: -- → P5
Hi, struggling to recreate this now. If you are able to recreate it somehow, then please leave it open. Otherwise, feel free to close. Thanks
Flags: needinfo?(bug.zilla)
I've managed to reproduce it: (1) Go to inoreader's demo page: https://www.inoreader.com/u/demo (2) Search for "telegraph" in the top left search field (3) Add the top RSS (or any of the telegraph.co.uk ones) (4) Click on the eye icon on the top right and select column view (5) Select any article and then either press q or click on the globe icon below the headline in the right panel Here are the respective error messages from firefox and IE: https://imgur.com/a/jKL0pWk
I can reproduce this issue on Windows 10 x64 using the repro steps given in the comment above.
Status: UNCONFIRMED → NEW
Component: Untriaged → DOM: Security
Ever confirmed: true
OS: Unspecified → Windows 10
Product: Firefox → Core
Hardware: Unspecified → x86
One warning: if we do this we MUST NOT send same-site cookies when opened as a fresh tab. This technique could actually be used as part of a social-engineering attack to get a user to open a URL in a way that the framing page can't do on its own. Should be easy -- we already have to handle this correctly when a page does a window.open() on a page. We just need to make sure it behaves like that. And write tests for it!
Whiteboard: [domsecurity-backlog]
Assignee: nobody → prathikshaprasadsuman
Status: NEW → ASSIGNED
Assignee: prathikshaprasadsuman → nobody
Status: ASSIGNED → NEW

Updated (simpler) STR:

For these two error pages, we want to offer the possibility to open the page directly, to do that, we could do that by offering an option like the one shown in the screenshot in comment 0 on the page.

The important part is outlined in comment 5. If we add a link to the page, we need to ensure that we're not opening it with the system principal, so that SameSite=Strict cookies are not set. You can use https://samesite-cookies.glitch.me/ to quickly test whether or not you're loading SameSite cookies. If a link from the error page is sending SameSite cookies, we could fall back to calling window.open() instead, which will hopefully not.

The more challenging part may be writing a test for this. To verify SameSite=Strict cookies aren't loading, we'll need to use a server script in our test.

Summary: Content Security Policy warnings should offer an option to visit the page directly → CSP/XFO error pages should offer an option to visit the page directly

I would like to take on this bug.

Absolutely, thanks for helping out!

Assignee: nobody → twigle_ingrid
Mentor: jhofmann
Status: NEW → ASSIGNED
Attached image Error Page (deleted) —

Hi Betsy, could you help us out with a small ad-hoc copy request on this bug?

For context, some sites choose to forbid being embedded as an iframe on another site because of security reasons. If a site does not want to be embedded but some other sites tries to do it anyway, we show an error page to the user saying that unfortunately we can't show this site here.

However, the user could of course visit the site in a new tab or a new window directly. To make that easier we want to add a new link to the error page that offers the user that possibility. Now we need one string for that link.

In our WIP patch, we currently say "Open in a New Window" (see screenshot). A longer more explanatory version would be "Open this page in a new window instead".

A final difficulty is that for many users it will open in a new tab instead of a new window, because there's a preference that controls that. I suppose we should have two different strings depending on which way the pref is set? Can we avoid that somehow?

Thanks!

Flags: needinfo?(bmikel)

Hi Johann, we don't think this is a simple case of the casing on that particular string. In the message itself, I don't think we communicate well to users why opening this page in a different window will solve the problem. Because we're asking users to take an action here, the call to action should be a button, not hyperlinked text. Buttons use title case.

Firefox Can't Open This Page

<name of site> will not allow Firefox to display the page if another site has embedded it using an X-Frame. To see this page, you need to open it in a new window.

[ Open Site in New Window ]

Flags: needinfo?(bmikel)

Thank you Betsy! Ingrid, does that make sense to you? Do you need any additional information?

Flags: needinfo?(twigle_ingrid)

Is the new text meant to be added to the error page or substitute parts/the whole old text? For clarity, could it be possible to have a version of the entire text, how it should be displayed on the page? Should the same text be displayed on the error page for Content Security Policy? Thank you!

Flags: needinfo?(twigle_ingrid)

I think this is supposed to replace the “Nightly prevented this page...” description text. Right, Betsy?

Also, reading the copy again, we should probably replace the word “X-Frame” with “iframe” or something like that, or just remove the “using an X-Frame” part completely from the sentence. That’s probably best. It’s just a confusing technical term that doesn’t really add value. Any thoughts?

Thanks

Flags: needinfo?(bmikel)

Yes, it is replacement text. Thanks! Am fine to remove the technical term as well.

Flags: needinfo?(bmikel)

Ok! So the new text would look like this, right? Thanks!

Blocked by X-Frame-Options Policy

An error occurred during a connection to <name of site>.

<Browser> Can't Open This Page

<name of site> will not allow <Browser> to display the page if another site has embedded it. To see this page, you need to open it in a new window.

[ Open Site in New Window ]

That looks correct to me.

Sorry, no it would just say

<Browser> Can't Open This Page

<name of site> will not allow <Browser> to display the page if another site has embedded it. To see this page, you need to open it in a new window.

[ Open Site in New Window ]

We can then probably consolidate the two strings for XFO and CSP into a single one. Given that it has the same effect I think that's much more user-friendly. Developers will have details in the developer console, though I wonder if we should think about showing an "advanced" information panel. Not in this bug, though.

Attached image Open Site In New Window With a Button (deleted) —

Is this the way you imagined it? :)

Looks like a huge improvement in terms of usability to me! Let's needinfo Betsy for feedback but I think we don't have to block on that :)

Thank you!

Flags: needinfo?(bmikel)

A suggestion, if I may.
Could we add something to let the user know that this is done to protect their security?
Otherwise, it might give the impression that Firefox is somehow broken.

Thanks

I feel like this is a good idea but Betsy is the master of content here so I'll let her speak to that.

I could imagine just changing it to "To protect your security, <site> will not allow Firefox to display the page if another site has embedded it.

(We could also have a "Learn More" link pointing to SUMO since that will likely lead to some folks wondering what it's about, but that's a separate bug)

Yes, I am good with that change. Screenshot looks good!

Flags: needinfo?(bmikel)

Ingrid, are you stuck on anything? I feel like this bug may be more important than we initially assumed, so I wonder if there's anything I can do to help you drive it forward?

Flags: needinfo?(twigle_ingrid)
Priority: P5 → P2

Thank you, Johann! The tests are still troubling me a bit. But I just submitted a patch to let you know where I currently am.

While trying to follow your suggestions for the tests :

a) Do we have the correct error page
b) Is the link visible (BrowserTestUtils.is_visible)
c) When we click the link, does a new window open with the correct URL?
d) If your server code tries to set some SameSite=Strict cookies and displays them on load, are they displayed in the new window?

I encounter the problem that the tests
a. start timing out when I add additional checks and the element I am trying to check is
not being found, because it is not loaded yet. I tried setting a timeout or using the
BrowserTestUtils.browserLoaded and it worked when I ran the test alone, but not
when I ran the whole test folder.
b. the tests behave differently when ran on their own, as opposed to when I run the whole folder,
creating race conditions, for instance that the tabs are not getting removed anymore.

Flags: needinfo?(twigle_ingrid)
Pushed by cbrindusan@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/01b0133a4f6e CSP/XFO error pages should offer an option to visit the page directly r=johannh,fluent-reviewers,flod
Regressions: 1640877
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla78
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: