Skip to content

Commit

Permalink
COOP: add reporting to redirects
Browse files Browse the repository at this point in the history
This CL allows reporting browsing context group switches triggered by
redirects and updates the reports sent in this case to the latest
version of the spec PR (whatwg/html#5518). Since
the status of COOP was becoming hard to track, I moved it to its own
class for better encapsulation.

Bug: 1059303
Change-Id: Ifafb23073301bd05cd9ce83fdb0b748c28e8a51f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2352880
Commit-Queue: Camille Lamy <[email protected]>
Reviewed-by: Arthur Sonzogni <[email protected]>
Reviewed-by: Mike West <[email protected]>
Reviewed-by: Kinuko Yasuda <[email protected]>
Cr-Commit-Position: refs/heads/master@{#799863}
GitOrigin-RevId: 9f52c7e47ed28cba6ba6a1fba302a9665f27fa36
  • Loading branch information
Camille Lamy authored and copybara-github committed Aug 20, 2020
1 parent 6d0adfe commit 409c339
Show file tree
Hide file tree
Showing 12 changed files with 120 additions and 136 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -42,10 +41,9 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -56,10 +54,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": `${location.origin}/`, // referrer
"type": "navigation-to-document"
"previousResponseURL": "",
"referrer": `${location.origin}/`, // referrer
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -70,10 +68,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": `${location.origin}/`, // referrer
"type": "navigation-to-document"
"previousResponseURL": "",
"referrer": `${location.origin}/`, // referrer
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin",
"navigationURI": `${location.href}`, // previous documnent url
"type": "navigation-to-document"
"previousResponseURL": `${location.href}`, // previous documnent url
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -53,10 +53,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin",
"navigationURI": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-document"
"previousResponseURL": "",
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,9 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -55,10 +54,9 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -69,10 +67,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin",
"navigationURI": `${location.origin}/`, // referrer
"type": "navigation-to-document"
"previousResponseURL": "",
"referrer": `${location.origin}/`, // referrer
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": `${location.href}`,
"type": "navigation-to-document"
"previousResponseURL": `${location.href}`,
"referrer": `${location.origin}/`,
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -55,10 +55,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": `${location.href}`,
"type": "navigation-to-document"
"previousResponseURL": `${location.href}`,
"referrer": `${location.origin}/`,
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": RegExp(`uuid=${noCoopToken}$`),
"effectivePolicy": "unsafe-none",
"navigationURI": RegExp(`uuid=${coopToken}$`),
"type": "navigation-from-document"
"nextResponseURL": RegExp(`uuid=${coopToken}$`),
"type": "navigation-from-response"
},
"url": RegExp(`uuid=${noCoopToken}$`),
"type": "coop"
Expand All @@ -68,10 +67,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": RegExp(`uuid=${coopToken}$`),
"effectivePolicy": "same-origin",
"navigationURI": RegExp(`uuid=${noCoopToken}$`),
"type": "navigation-to-document"
"previousResponseURL": RegExp(`uuid=${noCoopToken}$`),
"referrer": RegExp(`uuid=${noCoopToken}$`),
"type": "navigation-to-response"
},
"url": RegExp(`uuid=${coopToken}$`),
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -42,10 +41,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin",
"navigationURI": `${location.href}`, // previous documnent url
"type": "navigation-to-document"
"previousResponseURL": `${location.href}`, // previous documnent url
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -69,10 +68,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": /uuid=EXECUTOR_UUID$/, // initial navigation URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next document URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -83,10 +81,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-document"
"previousResponseURL": ``,
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -110,10 +108,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-allow-popups",
"navigationURI": /uuid=EXECUTOR_UUID$/, // initial navigation URL
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // initial navigation URL
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next destination url
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // next destination url
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -52,10 +51,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin",
"navigationURI": `${location.href}`, // previous document url
"type": "navigation-to-document"
"previousResponseURL": `${location.href}`, // previous document url
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -80,10 +79,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": /uuid=EXECUTOR_UUID$/, // initial navigation url
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // initial navigation url
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -94,10 +92,10 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-document"
"previousResponseURL": ``,
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand All @@ -119,10 +117,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next destination url
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // initial navigation url
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -144,10 +141,9 @@
"report": {
"body": {
"disposition": "enforce",
"documentURI": `${location.href}`,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": /uuid=EXECUTOR_UUID$/, // next destination url
"type": "navigation-from-document"
"nextResponseURL": /uuid=EXECUTOR_UUID$/, // initial navigation url
"type": "navigation-from-response"
},
"url": `${location.href}`,
"type": "coop"
Expand All @@ -158,10 +154,10 @@
"report": {
"body": {
"disposition": "reporting",
"documentURI": /uuid=EXECUTOR_UUID$/,
"effectivePolicy": "same-origin-plus-coep",
"navigationURI": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-document"
"previousResponseURL": ``,
"referrer": `${location.origin}/`, // referrer (origin, as dictated by the referrer policy)
"type": "navigation-to-response"
},
"url": /uuid=EXECUTOR_UUID$/,
"type": "coop"
Expand Down
Loading

0 comments on commit 409c339

Please sign in to comment.