[issues] Update protocol for surfacing CSP issues in issue tab

DISABLE_THIRD_PARTY_CHECK=<Introduce CSP issues>

Bug: chromium:1082628
Change-Id: I370643a319fabcc6c399b284f2ffeaeeefba2a11
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2241680
Commit-Queue: Kateryna Prokopenko <kprokopenko@google.com>
Reviewed-by: Sigurd Schneider <sigurds@chromium.org>
This commit is contained in:
Kateryna Prokopenko
2020-07-06 11:03:32 +00:00
committed by Commit Bot
parent 74b0782822
commit ce7beaeec0
4 changed files with 95 additions and 2 deletions
@@ -225,11 +225,19 @@ export function registerCommands(inspectorBackend) {
inspectorBackend.registerEnum(
'Audits.HeavyAdReason',
{NetworkTotalLimit: 'NetworkTotalLimit', CpuTotalLimit: 'CpuTotalLimit', CpuPeakLimit: 'CpuPeakLimit'});
inspectorBackend.registerEnum('Audits.ContentSecurityPolicyViolationType', {
KInlineViolation: 'kInlineViolation',
KEvalViolation: 'kEvalViolation',
KURLViolation: 'kURLViolation',
KTrustedTypesSinkViolation: 'kTrustedTypesSinkViolation',
KTrustedTypesPolicyViolation: 'kTrustedTypesPolicyViolation'
});
inspectorBackend.registerEnum('Audits.InspectorIssueCode', {
SameSiteCookieIssue: 'SameSiteCookieIssue',
MixedContentIssue: 'MixedContentIssue',
BlockedByResponseIssue: 'BlockedByResponseIssue',
HeavyAdIssue: 'HeavyAdIssue'
HeavyAdIssue: 'HeavyAdIssue',
ContentSecurityPolicyIssue: 'ContentSecurityPolicyIssue'
});
inspectorBackend.registerEvent('Audits.issueAdded', ['issue']);
inspectorBackend.registerEnum('Audits.GetEncodedResponseRequestEncoding', {Webp: 'webp', Jpeg: 'jpeg', Png: 'png'});
+23
View File
@@ -850,6 +850,27 @@ declare namespace Protocol {
frame: AffectedFrame;
}
export enum ContentSecurityPolicyViolationType {
KInlineViolation = 'kInlineViolation',
KEvalViolation = 'kEvalViolation',
KURLViolation = 'kURLViolation',
KTrustedTypesSinkViolation = 'kTrustedTypesSinkViolation',
KTrustedTypesPolicyViolation = 'kTrustedTypesPolicyViolation',
}
export interface ContentSecurityPolicyIssueDetails {
/**
* The url not included in allowed sources.
*/
blockedURL?: string;
/**
* Specific directive that is violated, causing the CSP issue.
*/
violatedDirective: string;
contentSecurityPolicyViolationType: ContentSecurityPolicyViolationType;
frameAncestor?: AffectedFrame;
}
/**
* A unique identifier for the type of issue. Each type may use one of the
* optional fields in InspectorIssueDetails to convey more specific
@@ -860,6 +881,7 @@ declare namespace Protocol {
MixedContentIssue = 'MixedContentIssue',
BlockedByResponseIssue = 'BlockedByResponseIssue',
HeavyAdIssue = 'HeavyAdIssue',
ContentSecurityPolicyIssue = 'ContentSecurityPolicyIssue',
}
/**
@@ -872,6 +894,7 @@ declare namespace Protocol {
mixedContentIssueDetails?: MixedContentIssueDetails;
blockedByResponseIssueDetails?: BlockedByResponseIssueDetails;
heavyAdIssueDetails?: HeavyAdIssueDetails;
contentSecurityPolicyIssueDetails?: ContentSecurityPolicyIssueDetails;
}
/**
@@ -1189,6 +1189,43 @@
}
]
},
{
"id": "ContentSecurityPolicyViolationType",
"type": "string",
"enum": [
"kInlineViolation",
"kEvalViolation",
"kURLViolation",
"kTrustedTypesSinkViolation",
"kTrustedTypesPolicyViolation"
]
},
{
"id": "ContentSecurityPolicyIssueDetails",
"type": "object",
"properties": [
{
"name": "blockedURL",
"description": "The url not included in allowed sources.",
"optional": true,
"type": "string"
},
{
"name": "violatedDirective",
"description": "Specific directive that is violated, causing the CSP issue.",
"type": "string"
},
{
"name": "contentSecurityPolicyViolationType",
"$ref": "ContentSecurityPolicyViolationType"
},
{
"name": "frameAncestor",
"optional": true,
"$ref": "AffectedFrame"
}
]
},
{
"id": "InspectorIssueCode",
"description": "A unique identifier for the type of issue. Each type may use one of the\noptional fields in InspectorIssueDetails to convey more specific\ninformation about the kind of issue.",
@@ -1197,7 +1234,8 @@
"SameSiteCookieIssue",
"MixedContentIssue",
"BlockedByResponseIssue",
"HeavyAdIssue"
"HeavyAdIssue",
"ContentSecurityPolicyIssue"
]
},
{
@@ -1224,6 +1262,11 @@
"name": "heavyAdIssueDetails",
"optional": true,
"$ref": "HeavyAdIssueDetails"
},
{
"name": "contentSecurityPolicyIssueDetails",
"optional": true,
"$ref": "ContentSecurityPolicyIssueDetails"
}
]
},
@@ -597,6 +597,23 @@ experimental domain Audits
# The frame that was blocked.
AffectedFrame frame
type ContentSecurityPolicyViolationType extends string
enum
kInlineViolation
kEvalViolation
kURLViolation
kTrustedTypesSinkViolation
kTrustedTypesPolicyViolation
type ContentSecurityPolicyIssueDetails extends object
properties
# The url not included in allowed sources.
optional string blockedURL
# Specific directive that is violated, causing the CSP issue.
string violatedDirective
ContentSecurityPolicyViolationType contentSecurityPolicyViolationType
optional AffectedFrame frameAncestor
# A unique identifier for the type of issue. Each type may use one of the
# optional fields in InspectorIssueDetails to convey more specific
# information about the kind of issue.
@@ -606,6 +623,7 @@ experimental domain Audits
MixedContentIssue
BlockedByResponseIssue
HeavyAdIssue
ContentSecurityPolicyIssue
# This struct holds a list of optional fields with additional information
# specific to the kind of issue. When adding a new issue code, please also
@@ -616,6 +634,7 @@ experimental domain Audits
optional MixedContentIssueDetails mixedContentIssueDetails
optional BlockedByResponseIssueDetails blockedByResponseIssueDetails
optional HeavyAdIssueDetails heavyAdIssueDetails
optional ContentSecurityPolicyIssueDetails contentSecurityPolicyIssueDetails
# An inspector issue reported from the back-end.
type InspectorIssue extends object