Related Area
Frontend
Is there an existing issue for this?
Describe the bug
The CSP reporting endpoint in web/src/app/api/csp-report/route.ts creates a sanitized version of the incoming CSP report (cspReport) by processing fields such as:
document-uri
referrer
blocked-uri
However, the endpoint later logs the original report object instead of the sanitized cspReport object.
As a result, the sanitization logic is not consistently applied to logged data, and any sensitive information present elsewhere in the CSP payload may still appear in application logs.
This creates an inconsistency between the intended sanitized output and the actual data being logged.
Expected behavior
The endpoint should consistently use the sanitized CSP report object whenever report data is written to logs, ensuring that the sanitization process is effective.
Actual behavior
The original unsanitized report payload is logged, which bypasses the sanitization logic already implemented in the handler.
Steps to Reproduce:-
Submit a CSP violation report containing URLs with query parameters or additional metadata.
Trigger the /api/csp-report endpoint.
Check the server logs.
Observe that the original report object is logged instead of the sanitized report.
Add ScreenShots
No response
What browsers are you seeing the problem on?
chrome
Record
Related Area
Frontend
Is there an existing issue for this?
Describe the bug
The CSP reporting endpoint in web/src/app/api/csp-report/route.ts creates a sanitized version of the incoming CSP report (cspReport) by processing fields such as:
document-uri
referrer
blocked-uri
However, the endpoint later logs the original report object instead of the sanitized cspReport object.
As a result, the sanitization logic is not consistently applied to logged data, and any sensitive information present elsewhere in the CSP payload may still appear in application logs.
This creates an inconsistency between the intended sanitized output and the actual data being logged.
Expected behavior
The endpoint should consistently use the sanitized CSP report object whenever report data is written to logs, ensuring that the sanitization process is effective.
Actual behavior
The original unsanitized report payload is logged, which bypasses the sanitization logic already implemented in the handler.
Steps to Reproduce:-
Submit a CSP violation report containing URLs with query parameters or additional metadata.
Trigger the /api/csp-report endpoint.
Check the server logs.
Observe that the original report object is logged instead of the sanitized report.
Add ScreenShots
No response
What browsers are you seeing the problem on?
chrome
Record