Skip to content

Commit d4445a3

Browse files
committed
Add capturing of Permissions Policy browser report fields
1 parent bd0f5c6 commit d4445a3

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

backend/src/routers/ApiDiagnosticsRouter.ts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ const extractReports = json.array(
5656
type: json.string,
5757
body: json.nullable(
5858
json.object({
59+
// CSP Violation
60+
// https://developer.mozilla.org/en-US/docs/Web/API/CSPViolationReportBody
5961
effectiveDirective: OPTIONAL_PRIMITIVE,
62+
effectivePolicy: OPTIONAL_PRIMITIVE,
6063
blockedURL: OPTIONAL_PRIMITIVE,
6164
statusCode: OPTIONAL_PRIMITIVE,
6265

63-
effectivePolicy: OPTIONAL_PRIMITIVE,
64-
66+
// Cross-Origin Opener Policy
6567
type: OPTIONAL_PRIMITIVE,
6668
previousResponseURL: OPTIONAL_PRIMITIVE,
6769
nextResponseURL: OPTIONAL_PRIMITIVE,
@@ -70,10 +72,21 @@ const extractReports = json.array(
7072
openedWindowInitialURL: OPTIONAL_PRIMITIVE,
7173
otherURL: OPTIONAL_PRIMITIVE,
7274

75+
// Permissions Policy
76+
// https://w3c.github.io/webappsec-permissions-policy/#reporting
77+
featureId: OPTIONAL_PRIMITIVE,
78+
policyId: OPTIONAL_PRIMITIVE,
79+
allowAttribute: OPTIONAL_PRIMITIVE,
80+
//srcAttribute: OPTIONAL_PRIMITIVE, // potentially sensitive
81+
82+
// common
83+
// https://developer.mozilla.org/en-US/docs/Web/API/Report/body
7384
id: OPTIONAL_PRIMITIVE,
7485

7586
reason: OPTIONAL_PRIMITIVE,
7687
stack: OPTIONAL_PRIMITIVE,
88+
//message: OPTIONAL_PRIMITIVE, // potentially sensitive
89+
//disposition: OPTIONAL_PRIMITIVE, // not interesting
7790

7891
sourceFile: OPTIONAL_PRIMITIVE,
7992
lineNumber: OPTIONAL_PRIMITIVE,

0 commit comments

Comments
 (0)