-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ [RUMF-1175] collect reports and csp violation #1332
✨ [RUMF-1175] collect reports and csp violation #1332
Conversation
Codecov Report
@@ Coverage Diff @@
## main #1332 +/- ##
==========================================
+ Coverage 89.75% 89.83% +0.07%
==========================================
Files 102 105 +3
Lines 4207 4297 +90
Branches 944 956 +12
==========================================
+ Hits 3776 3860 +84
- Misses 431 437 +6
Continue to review full report at Codecov.
|
packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.ts
Show resolved
Hide resolved
63252da
to
f960da4
Compare
4d666f7
to
ca72d57
Compare
48fd096
to
9bcb3d5
Compare
9bcb3d5
to
fcd4950
Compare
packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.ts
Show resolved
Hide resolved
f5e2587
to
875cdc3
Compare
f310e7b
to
5555282
Compare
packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.ts
Outdated
Show resolved
Hide resolved
packages/rum-core/src/domain/rumEventsCollection/error/trackReportError.spec.ts
Outdated
Show resolved
Hide resolved
df6f027
to
a6f592f
Compare
|
||
function buildRawReportFromCspViolation(event: SecurityPolicyViolationEvent): RawReport { | ||
const type = RawReportType.cspViolation | ||
const message = `'${event.blockedURI}' blocked by '${event.effectiveDirective}' directive` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some thought, I think it is valuable to add the originalPolicy
to the crafted message.
Could be done like so:
${event.blockedURI}' blocked by '${event.effectiveDirective}' directive of the policy "${event.originalPolicy}"
This way we will have message like:
- 'Blob' blocked by 'worker-src' directive of the original policy "worker-src 'none'"
- 'http://httpbin.google.com/script.js' blocked by 'script-src-elem' directive of the policy "default-src 'self' 'unsafe-inline' https://httpbin.org http://httpbin.org google.com"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some directives could list a large number of domains 🤔
I'd say that it could be added in the stack to keep a minimal message.
We should maybe also truncate the policy to avoid sending too much data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added it to the stack. Let me know what you think
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Motivation
Collect reports and csp violation.
Feature under feature flag
Worth reviewing commit by commit
Changes
Testing
I have gone over the contributing documentation.