Closed Bug 1970330 Opened 11 months ago Closed 10 months ago

Add CSP directive for reftest.xhtml to allow removing the exception for CSP checks for Marionette

Categories

(Testing :: Marionette Client and Harness, defect, P2)

defect
Points:
2

Tracking

(firefox142 fixed)

RESOLVED FIXED
142 Branch
Tracking Status
firefox142 --- fixed

People

(Reporter: whimboo, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Whiteboard: [webdriver:m17])

Attachments

(1 file)

After moving out all the Marionette chrome test files over on bug 1344267, we also need a solution for the files related to reftests. This is a bit more complicated given that it spans across Marionette unit tests and web-platform-tests. Especially that the latter will have to work upstream as well it's not that clear to me yet where to put the relevant xhtml and js files.

Simon, the reftest.xhtml file was as well affected by the wanted CSP changes, or not?

Flags: needinfo?(sfriedberger)

It seems I disabled it outside of automation: https://searchfox.org/mozilla-central/source/dom/security/nsContentSecurityUtils.cpp#1983 and I haven't received any bug reports. Does this contradict your statement about using it in WPTs?

Flags: needinfo?(sfriedberger)

(In reply to Simon Friedberger (:simonf) from comment #1)

It seems I disabled it outside of automation: https://searchfox.org/mozilla-central/source/dom/security/nsContentSecurityUtils.cpp#1983 and I haven't received any bug reports. Does this contradict your statement about using it in WPTs?

This is the folder as used by the old-style reftest harness: https://searchfox.org/mozilla-central/source/layout/tools/reftest/

With Marionette - as what web-platform-tests require - the location of the chrome files is chrome://remote/content/marionette/ at the moment. But at least for wpt tests we set the disable all security pref so it means that Cu.isInAutomation should be true in our CI.

Priority: -- → P3

For wpt reftests we do need to run them in the version of the browser we release to end users.

The way it currently works is that the implementation is part of the public marionette API. As far as I know there aren't any other consumers, but it's hard to be sure. So even though the feature is only for running tests, it's not test-only in the same way as stuff that only runs gecko CI; it's part of the product as much as other marionette/WebDriver features.

I don't fully know the context for this bug, but if the current setup is untenable for security reasons, we could consider moving the HTML wrapper file into wpt. But it would be extremely strange to have a product feature that depends on the consumer providing a very specific HTML file that is not itself bundled with the product. So I hope we can find some other solution here.

The severity field is not set for this bug.
:whimboo, could you have a look please?

For more information, please visit BugBot documentation.

Flags: needinfo?(hskupin)
Severity: -- → S3
Flags: needinfo?(hskupin)

Ok, so it looks like that we have to keep the file where it currently is. As such lets see if it will be enough to add the required CSP directive to the XHTML file to make the crashes go away with the following lines removed:

https://searchfox.org/mozilla-central/rev/1eb4f27ece7cb96ac94b635ad0dc95c00d1443db/dom/security/nsContentSecurityUtils.cpp#1980-1984

I pushed a try build with the updated content as mentioned above and it looks all good:
https://treeherder.mozilla.org/jobs?repo=try&revision=b1c9aaac4756a43a4057c427f672f05a152df844

Simon, are those changes what you expect to see? If yes, I can upload the patches for review. Thanks.

Flags: needinfo?(sfriedberger)

Yes, that looks great!

Flags: needinfo?(sfriedberger)
Points: --- → 2
Priority: P3 → P2
Summary: Reftest chrome files should not be shipped with Firefox → Add CSP directive for reftest.xhtml to allow removing the exception for CSP checks for Marionette
Whiteboard: [webdriver:m17]
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/4737f6e80ba5 https://hg.mozilla.org/integration/autoland/rev/f3b5d6cf26b1 [marionette] Add CSP directives to reftest.xhtml. r=webdriver-reviewers,jdescottes
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 142 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: