Right now, CSP headers are calculated and sent before the BeforePageDisplay hook. This means that if you add some module in the onBeforePageDisplay hook (which is very common) you cannot adjust the CSP header in the same hook. This makes things rather cumbersome. Maybe we should adjust the CSP header to happen after that hook.
Customize query in gerrit
|mediawiki/core||master||+4 -3||Allow adjusting CSP headers from BeforePageDisplay hook|