I'm trying to implement report-uri and report-to in front-end app.
report-uri:
I accomplished the goal expanding current Content-Security-Policy header value with report-uri and this is working:
<add name="Content-Security-Policy" value="default-src 'self' 'unsafe-inline' data: google.com; report-uri http://localhost:51260/api/csp/report;"/>
report-to:
Following the instructions I undertstood that I need to add two things: new Report-To header and new instruction in Content-Security-Policy so I've escaped the stringified json for report-to and added them web.config:
<add name="Report-to" value="{"endpoints":[{"url":"https://localhost:51260/api/csp/report-to"}],"include_subdomains":true,"group":"csp-endpoint","max_age":31536000}" />
<add name="Content-Security-Policy" value="default-src 'self' 'unsafe-inline' data: google.com; report-uri http://localhost:51260/api/csp/report; report-to csp-endpoint;"/>
but it does not work.
Unescaped value:
{"endpoints":[{"url":"https://localhost:51260/api/csp/report-to"}],"include_subdomains":true,"group":"csp-endpoint","max_age":31536000}
For reference:
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-uri
- https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/report-to
Aucun commentaire:
Enregistrer un commentaire