fix: Incorrect Security Stats when using --enableAutoCsp
#58
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In the reports webapp, we see a large number of "Security" findings in the runs if we use the
--enableAutoCsp
flagThis is because in stats.ts, we are counting the number of CSP reports that are seen during the WebDriver session with autoCSP enabled. Even though we are not tracking Trusted Types violations at this moment, we end up counting Trusted Types violations as a part of security findings. This is currently problematic because the version of the
strict-csp
HTML transformation library we use generates a lot of false positive Trusted Types violations as a part of the loader script.We will not count any Trusted Types violations as security findings until
strict-csp
is updated to no longer produce false positives. This currently aligns with the name of the variable in the checking--numCspViolations
should count only CSP violations. To make this future-proof, I've separated out CSP and TT findings instats.ts
-- and we can start countingnumTrustedTypesViolations
in the future!Thanks to @devversion for noticing this!