Commit 78f0dbd2 authored by Simon Zünd's avatar Simon Zünd Committed by Chromium LUCI CQ

[devtools] Add 'SameParty' cookie attribute to Network.Cookie type

As part of the "First Party Sets" privacy effort, cookies get a new
boolean attribute 'SameParty'. The attribute works similarly as
'SameSite' and allows cookies to be sent in same-party, cross-site
contexts.

This CL adds the attribute to the DevTools protocol, so it can be
shown in the various Cookie tables in the DevTools frontend.

R=caseq@chromium.org

Bug: chromium:1161427
Change-Id: Ica094fcc3acc38e8fb36cada40c198c41ca82262
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2598846Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: Simon Zünd <szuend@chromium.org>
Cr-Commit-Position: refs/heads/master@{#841959}
parent 0f311dd9
......@@ -155,6 +155,7 @@ std::unique_ptr<Network::Cookie> BuildCookie(
.SetSecure(cookie.IsSecure())
.SetSession(!cookie.IsPersistent())
.SetPriority(cp)
.SetSameParty(cookie.IsSameParty())
.Build();
switch (cookie.SameSite()) {
......
......@@ -4749,6 +4749,8 @@ domain Network
optional CookieSameSite sameSite
# Cookie Priority
experimental CookiePriority priority
# True if cookie is SameParty.
experimental boolean sameParty
# Types of reasons why a cookie may not be stored from a response.
experimental type SetCookieBlockedReason extends string
......
......@@ -12,6 +12,7 @@ requestWillBeSentExtraInfo blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : false
session : true
size : 9
......
......@@ -12,6 +12,7 @@ requestWillBeSentExtraInfo blocked cookies:[
name : name
path : /inspector-protocol/network/resources/set-cookie.php
priority : Medium
sameParty : false
secure : false
session : true
size : 9
......
......@@ -11,6 +11,7 @@ Browser initiated navigation blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Lax
secure : false
session : true
......@@ -30,6 +31,7 @@ Javascript initiated navigation blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Lax
secure : false
session : true
......@@ -50,6 +52,7 @@ Javascript initiated subresource blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Lax
secure : false
session : true
......
......@@ -11,6 +11,7 @@ Browser initiated navigation blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Strict
secure : false
session : true
......@@ -31,6 +32,7 @@ Javascript initiated navigation blocked cookies:n[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Strict
secure : false
session : true
......@@ -51,6 +53,7 @@ Javascript initiated subresource blocked cookies:}[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Strict
secure : false
session : true
......
......@@ -12,6 +12,7 @@ ResponseReceivedExtraInfo blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : true
session : true
size : 9
......@@ -32,6 +33,7 @@ RequestWillBeSentExtraInfo blocked cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : true
session : true
size : 9
......
......@@ -12,6 +12,7 @@ set-cookie that would overwrite secure cookie blocked set-cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : true
session : true
size : 9
......
......@@ -11,6 +11,7 @@ set-cookie that would overwrite secure cookie blocked set-cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : false
session : true
size : 9
......
......@@ -12,6 +12,7 @@ Javascript initiated subresource blocked set-cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Lax
secure : false
session : true
......
......@@ -12,6 +12,7 @@ Javascript initiated subresource blocked set-cookies:[
name : name
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : Strict
secure : false
session : true
......
......@@ -11,6 +11,7 @@ requestWillBeSentExtraInfo request cookies on same domain:[
name : name1
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : None
secure : true
session : true
......@@ -28,6 +29,7 @@ requestWillBeSentExtraInfo request cookies on same domain:[
name : name2
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : false
session : true
size : 11
......@@ -47,6 +49,7 @@ requestWillBeSentExtraInfo request cookies on subdomain[
name : name2
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
secure : false
session : true
size : 11
......@@ -63,6 +66,7 @@ requestWillBeSentExtraInfo request cookies on subdomain[
name : name1
path : /inspector-protocol/network/resources
priority : Medium
sameParty : false
sameSite : None
secure : true
session : true
......
Verifies that Network.RequestWillBeSentExtraInfo events report structured request cookies with the correct SameParty attribute.
requestWillBeSentExtraInfo request cookies on same domain:[
[0] : {
blockedReasons : [
]
cookie : {
domain : .cookie.test
expires : -1
httpOnly : false
name : name1
path : /inspector-protocol/network/resources
priority : Medium
sameParty : true
secure : true
session : true
size : 11
value : value1
}
}
]
(async function(testRunner) {
const {page, session, dp} = await testRunner.startBlank(
`Verifies that Network.RequestWillBeSentExtraInfo events report structured request cookies with the correct SameParty attribute.\n`);
await dp.Network.enable();
const helper = (await testRunner.loadScript('resources/extra-info-helper.js'))(dp, session);
const setCookieUrl = 'https://cookie.test:8443/inspector-protocol/network/resources/set-cookie.php?cookie='
+ encodeURIComponent('name1=value1;SameParty;Secure;Domain=cookie.test');
// Set cookies in a domain.
await helper.navigateWithExtraInfo(setCookieUrl);
// Navigate to a the same domain to see that the cookie is reported.
const sendCookieUrl = 'https://cookie.test:8443/inspector-protocol/network/resources/hello-world.html';
const response = await helper.navigateWithExtraInfo(sendCookieUrl);
testRunner.log(response.requestExtraInfo.params.associatedCookies, 'requestWillBeSentExtraInfo request cookies on same domain:');
testRunner.completeTest();
})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment