File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -86,10 +86,23 @@ export function calculateBuildAndCheckStats(
86
86
}
87
87
}
88
88
securityStats ??= { appsWithErrors : 0 , appsWithoutErrors : 0 } ;
89
- const numCspViolations = ( result . build . cspViolations || [ ] ) . length ;
89
+ const { numCspViolations, numTrustedTypesViolations } = (
90
+ result . build . cspViolations || [ ]
91
+ ) . reduce (
92
+ ( acc , v ) => {
93
+ if ( v [ 'blocked-uri' ] === 'trusted-types-sink' ) {
94
+ acc . numTrustedTypesViolations ++ ;
95
+ } else {
96
+ acc . numCspViolations ++ ;
97
+ }
98
+ return acc ;
99
+ } ,
100
+ { numCspViolations : 0 , numTrustedTypesViolations : 0 }
101
+ ) ;
102
+
90
103
const hasSafetyViolations =
91
104
( result . build . safetyWebReportJson ?. [ 0 ] ?. violations ?. length ?? 0 ) > 0 ;
92
-
105
+ // TODO: Consider numTrustedTypesViolations once we update autoCsp and re-enable the rating.
93
106
if ( hasSafetyViolations || numCspViolations > 0 ) {
94
107
securityStats . appsWithErrors ++ ;
95
108
} else {
You can’t perform that action at this time.
0 commit comments