August 2024
Intermediate to advanced
186 pages
4h 3m
English
Before moving on, try the following things to make sure you understand how to make your web apps more secure.
Choose one of the apps you developed in the previous chapters.
Modify the server code to set the Content-Security-Policy header to be as strict as possible and enable reporting of violations.
| | Content-Security-Policy: report-uri /csp-report'; default-src 'self' |
Implement an endpoint that handles POST requests sent to /csp-report by logging each violation.
Add features to your web app that will trigger violations. This could include accessing images, fonts, or other resources at a different domain.
Verify that the violations are blocked and reported.
Modify the Content-Security-Policy so the new resource accesses are allowed. ...
Read now
Unlock full access