Skip to content

Commit e2d91f9

Browse files
amarjotgillDevtools-frontend LUCI CQ
authored andcommitted
Add DevTools frontend support for port and scheme mismatch issues
Implements DevTools frontend support to show an issue for when either a port or scheme are mismatched. This issue will only be shown when kEnableSchemeBoundCookies or kEnablePortBoundCookies are enabled. Bug: 376025587 Change-Id: Iece976380330ab398a7e3d8b822a52317a90b010 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5988430 Reviewed-by: Alina Varkki <[email protected]> Commit-Queue: Amarjot Gill <[email protected]> Reviewed-by: Wolfgang Beyer <[email protected]>
1 parent c5df3a1 commit e2d91f9

File tree

5 files changed

+39
-0
lines changed

5 files changed

+39
-0
lines changed

config/gni/devtools_grd_files.gni

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -413,6 +413,8 @@ grd_files_release_sources = [
413413
"front_end/models/issues_manager/descriptions/cookieCrossSiteRedirectDowngrade.md",
414414
"front_end/models/issues_manager/descriptions/cookieExcludeBlockedWithinRelatedWebsiteSet.md",
415415
"front_end/models/issues_manager/descriptions/cookieExcludeDomainNonAscii.md",
416+
"front_end/models/issues_manager/descriptions/cookieExcludePortMismatch.md",
417+
"front_end/models/issues_manager/descriptions/cookieExcludeSchemeMismatch.md",
416418
"front_end/models/issues_manager/descriptions/cookieExcludeThirdPartyPhaseoutRead.md",
417419
"front_end/models/issues_manager/descriptions/cookieExcludeThirdPartyPhaseoutSet.md",
418420
"front_end/models/issues_manager/descriptions/cookieWarnDomainNonAscii.md",

front_end/models/issues_manager/BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,8 @@ devtools_issue_description_files = [
172172
"cookieWarnThirdPartyPhaseoutRead.md",
173173
"cookieExcludeThirdPartyPhaseoutSet.md",
174174
"cookieExcludeThirdPartyPhaseoutRead.md",
175+
"cookieExcludePortMismatch.md",
176+
"cookieExcludeSchemeMismatch.md",
175177
"cookieWarnMetadataGrantRead.md",
176178
"cookieWarnMetadataGrantSet.md",
177179
"propertyRuleIssue.md",

front_end/models/issues_manager/CookieIssue.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,14 @@ export class CookieIssue extends Issue {
197197
reason === Protocol.Audits.CookieWarningReason.WarnSameSiteLaxCrossDowngradeStrict) {
198198
return [Protocol.Audits.InspectorIssueCode.CookieIssue, 'WarnCrossDowngrade', operation, secure].join('::');
199199
}
200+
201+
if (reason === Protocol.Audits.CookieExclusionReason.ExcludePortMismatch) {
202+
return [Protocol.Audits.InspectorIssueCode.CookieIssue, 'ExcludePortMismatch'].join('::');
203+
}
204+
205+
if (reason === Protocol.Audits.CookieExclusionReason.ExcludeSchemeMismatch) {
206+
return [Protocol.Audits.InspectorIssueCode.CookieIssue, 'ExcludeSchemeMismatch'].join('::');
207+
}
200208
return [Protocol.Audits.InspectorIssueCode.CookieIssue, reason, operation].join('::');
201209
}
202210

@@ -542,6 +550,16 @@ const cookieCrossSiteRedirectDowngrade: LazyMarkdownIssueDescription = {
542550
}],
543551
};
544552

553+
const ExcludePortMismatch: LazyMarkdownIssueDescription = {
554+
file: 'cookieExcludePortMismatch.md',
555+
links: [],
556+
};
557+
558+
const ExcludeSchemeMismatch: LazyMarkdownIssueDescription = {
559+
file: 'cookieExcludeSchemeMismatch.md',
560+
links: [],
561+
};
562+
545563
// This description will be used by cookie issues that need to be added to the
546564
// issueManager, but aren't intended to be surfaced in the issues pane. This
547565
// is why they are using a placeholder description
@@ -600,4 +618,6 @@ const issueDescriptions: Map<string, LazyMarkdownIssueDescription> = new Map([
600618
['CookieIssue::ExcludeThirdPartyPhaseout::ReadCookie', cookieExcludeThirdPartyPhaseoutRead],
601619
['CookieIssue::ExcludeThirdPartyPhaseout::SetCookie', cookieExcludeThirdPartyPhaseoutSet],
602620
['CookieIssue::CrossSiteRedirectDowngradeChangesInclusion', cookieCrossSiteRedirectDowngrade],
621+
['CookieIssue::ExcludePortMismatch', ExcludePortMismatch],
622+
['CookieIssue::ExcludeSchemeMismatch', ExcludeSchemeMismatch],
603623
]);
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Cookie was not sent due to port mismatch
2+
3+
Cookies can only be accessed by origins that share the same port as the origin
4+
that initially set the cookie.
5+
6+
If this cookie is required for the request, the cookie will need to be set by an
7+
origin with the same port as the request. Alternatively, you can utilize the
8+
Domain attribute, which allows access to a cookie with a mismatched port.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Cookie was not sent due to scheme mismatch
2+
3+
The cookie can only be accessed by origins that share the same scheme as
4+
the origin that initially set it.
5+
6+
If this cookie is required for the request, the cookie will need to be set
7+
by an origin with the same scheme as the request.

0 commit comments

Comments
 (0)