Closed Bug 1731778 Opened 3 years ago Closed 2 years ago

Implement COEP: credentialless

Categories

(Core :: DOM: Core & HTML, enhancement)

enhancement

Tracking

()

RESOLVED FIXED
104 Branch
Tracking Status
firefox104 --- fixed

People

(Reporter: arthursonzogni, Assigned: sefeng)

References

(Depends on 3 open bugs, Blocks 3 open bugs, Regressed 1 open bug)

Details

Attachments

(4 files)

User Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36

Steps to reproduce:

Explainer:
https://github.com/WICG/credentiallessness

Filling implementation bug, in order to land spec PR:

Warning. Before implementing COEP:credentialless, you should evaluate the security guarantees hold. In particular, this may be dependant on:

  • Private Network Request
  • ORB

Actual results:

N/A This is a feature request. Not a bug.

Expected results:

N/A This is a feature request. Not a bug.

Blocks: 1563480
Summary: Implement COEP:credentialless → Implement COEP: credentialless
Component: Security → DOM: Core & HTML
Status: UNCONFIRMED → NEW
Ever confirmed: true
Assignee: nobody → sefeng
Blocks: 1698587

Added bug 1652926 as a dependency due to reporting-navigation.https.window.js test requires that.

Depends on: 1652926
Depends on: 1613912

Spec: https://html.spec.whatwg.org/multipage/#coep:coep-credentialless

Credentialless is a new cross-origin embedder policy which allows us
to not enforcing CORP when loading cross-origin resources while
providing SharedArrayBuffer.

There are two main things involved here:

  1. Fetching cross-origin no-CORS resources omits credentials
    • This is done by applying LOAD_ANONYMOUS flag to the request
  2. Other requests sent with credentials require the server's explicit
    permission through the CORS protocol or the CORS header
    • This is done by expanding ProcessCrossOriginResourcePolicyHeader
      function to apply the necessary checks.

Spec: https://fetch.spec.whatwg.org/#ref-for-cross-origin-resource-policy-internal-check

This purpose of this patch is just to implement the spec.

One noticeable thing I did in the patch is I made CacheResponse to
include the credentials mode of the initial request. Consider the
below scenario:

  1. Create a fetch request with a URL and a specific credential_mode, and put it into cache
  2. Call cache.match by using a URL, but without credential_mode
  3. cache.match() result should be filtered according to the initial request's credential_mode

When applying the response’s request-includes-credentials is true
check, the initial request's credential_mode is needed because
request-includes-credentials is judged by the credential_mode.

The rest of the changes are just normal spec alignments.

No longer depends on: private-network-access

We did some analysis in the fall and settled on gating this on ORB but not PNA. Updating the dependencies to reflect that.

Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/fea9b21d8efe
Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
https://hg.mozilla.org/integration/autoland/rev/2510b654e8f2
Implement COEP: credentialless for cache storage r=edenchuang

Looks like with the COEP:credentialless implementation, some anonymous
iframe tests start to fail. I didn't investigate this because we don't
support anonymous iframe at the moment, so it's not worth to look into
it.

Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7c14fa8a4804
Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
https://hg.mozilla.org/integration/autoland/rev/0eec19308453
Implement COEP: credentialless for cache storage r=edenchuang
https://hg.mozilla.org/integration/autoland/rev/c30f5751d54c
Expect some anonymous iframe tests to fail r=smaug

Backed out for causing COEP related failures on embedding.tentative.https.window.html.

Push with failures

Failure log

Backout link

[task 2022-06-22T18:08:26.427Z] 18:08:26     INFO - TEST-START | /html/anonymous-iframe/embedding.tentative.https.window.html?9-10
[task 2022-06-22T18:08:26.436Z] 18:08:26     INFO - Closing window 4973c4ff-e5a4-4e4d-adfe-8e06bde00472
[task 2022-06-22T18:08:26.448Z] 18:08:26     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:26.501Z] 18:08:26     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:26.678Z] 18:08:26     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:26.743Z] 18:08:26     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:26.816Z] 18:08:26     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:26.842Z] 18:08:26     INFO - PID 7744 | [Parent 7028, Main Thread] WARNING: 'aOwner->IsDiscarded()', file /builds/worker/workspace/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:95
[task 2022-06-22T18:08:26.853Z] 18:08:26     INFO - PID 7744 | [Parent 7028, Main Thread] WARNING: 'aOwner->IsDiscarded()', file /builds/worker/workspace/obj-build/dist/include/mozilla/dom/SyncedContextInlines.h:95
[task 2022-06-22T18:08:26.978Z] 18:08:26     INFO - PID 7744 | 1655921306992	Marionette	WARN	Ignoring event 'pageshow' because document has an invalid readyState of 'uninitialized'.
[task 2022-06-22T18:08:27.003Z] 18:08:27     INFO - PID 7744 | [Parent 7028, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/base/ThirdPartyUtil.cpp:421
[task 2022-06-22T18:08:27.031Z] 18:08:27     INFO - PID 7744 | 1655921307036	Marionette	WARN	Ignoring event 'pageshow' because document has an invalid readyState of 'uninitialized'.
[task 2022-06-22T18:08:27.038Z] 18:08:27     INFO - PID 7744 | [Parent 7028, Main Thread] WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80004005 (NS_ERROR_FAILURE): file /builds/worker/checkouts/gecko/dom/base/ThirdPartyUtil.cpp:421
[task 2022-06-22T18:08:27.833Z] 18:08:27     INFO - PID 7744 | ### XPCOM_MEM_BLOAT_LOG defined -- logging bloat/leaks to C:\Users\task_165591913118257\AppData\Local\Temp\tmp6x6ubnp9\runtests_leaks_5864_tab_pid2520.log
[task 2022-06-22T18:08:27.840Z] 18:08:27     INFO - PID 7744 | [2520, Main Thread] WARNING: XPCOM_MEM_BLOAT_LOG is set, disabling native allocations.: file /builds/worker/checkouts/gecko/tools/profiler/core/platform.cpp:339
[task 2022-06-22T18:08:41.556Z] 18:08:41     INFO - PID 7744 | [Child 2072, Main Thread] WARNING: IPC message 'PSessionStore::Msg_SessionStoreUpdate' discarded: actor cannot send: file /builds/worker/checkouts/gecko/ipc/glue/ProtocolUtils.cpp:509
[task 2022-06-22T18:08:46.516Z] 18:08:46     INFO - PID 7744 | [Child 8184, Main Thread] WARNING: '!CanHandleWith(aPresContext)', file /builds/worker/checkouts/gecko/dom/events/IMEStateManager.cpp:498
[task 2022-06-22T18:08:46.540Z] 18:08:46     INFO - 
[task 2022-06-22T18:08:46.551Z] 18:08:46     INFO - TEST-UNEXPECTED-FAIL | /html/anonymous-iframe/embedding.tentative.https.window.html?9-10 | COOP:same-origin + COEP:credentialless embeds same-origin anonymous iframe - assert_equals: expected "load" but got "block"
[task 2022-06-22T18:08:46.551Z] 18:08:46     INFO - embeddingTest/<@https://web-platform.test:8443/html/anonymous-iframe/resources/embedding-test.js:70:18
[task 2022-06-22T18:08:46.552Z] 18:08:46     INFO - .
[task 2022-06-22T18:08:46.552Z] 18:08:46     INFO - TEST-OK | /html/anonymous-iframe/embedding.tentative.https.window.html?9-10 | took 20125ms
Flags: needinfo?(sefeng)

When running the test against the Firefox ASAN builds, sometimes the
test fails because document.body is null. So we wrap the test method
into window.onload to fix that.

Pushed by sefeng@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/0a6f568535df
Implement COEP: credentialless r=smaug,necko-reviewers,kershaw
https://hg.mozilla.org/integration/autoland/rev/923a9ea4733e
Implement COEP: credentialless for cache storage r=edenchuang
https://hg.mozilla.org/integration/autoland/rev/6a467758975a
Expect some anonymous iframe tests to fail r=smaug
https://hg.mozilla.org/integration/autoland/rev/6c46f6f471fb
Wrap the test method into window.onload in script.https.window.js r=smaug
Created web-platform-tests PR https://github.com/web-platform-tests/wpt/pull/34609 for changes under testing/web-platform/tests
Regressions: 1776773
Upstream PR merged by moz-wptsync-bot
Regressions: 1776864
Regressions: 1776844
Regressions: 1837585
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: