2 ms·
It's a defense-in-depth measure. If your whole codebase is written without anyone making mistakes then the new policy won't change anything for you. But if not
by azornathogron 3y ago
It's a defense-in-depth measure.
If your whole codebase is written without anyone making mistakes then the new policy won't change anything for you. But if not - particularly if your codebase is large and written by many different people over time - then you should probably not assume it's free of all bugs and vulnerabilities. A policy that can be applied centrally to all pages by configuring headers gives you an extra runtime protection against certain kinds of high risk coding errors.
This is just like programs deliberately dropping privileges when they start - they don't use those privileges anyway so dropping them doesn't do anything, right? But of course dropping privileges is worthwhile because programs have bugs and some of those bugs are security vulnerabilities and dropping privileges can reduce the severity of exploits.
- azornathogron 3y agoComing back to this after a couple of days, I now realize I probably misunderstood the original question. 'xanathar provided a more useful answer.