2020-03-03 22:50:34 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace MediaWiki\Hook;
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-26 13:18:43 +00:00
|
|
|
* This is a hook handler interface, see docs/Hooks.md.
|
|
|
|
|
* Use the hook name "ContentSecurityPolicyScriptSource" to register handlers implementing this interface.
|
|
|
|
|
*
|
2020-07-13 09:05:49 +00:00
|
|
|
* @stable to implement
|
2020-03-03 22:50:34 +00:00
|
|
|
* @ingroup Hooks
|
|
|
|
|
*/
|
|
|
|
|
interface ContentSecurityPolicyScriptSourceHook {
|
|
|
|
|
/**
|
2020-03-16 23:31:05 +00:00
|
|
|
* Use this hook to modify the allowed CSP script sources.
|
2020-03-03 22:50:34 +00:00
|
|
|
* Note that you also have to use ContentSecurityPolicyDefaultSource if you
|
2020-03-16 23:31:05 +00:00
|
|
|
* want non-script sources to be loaded from whatever you add.
|
2020-03-03 22:50:34 +00:00
|
|
|
*
|
|
|
|
|
* @since 1.35
|
|
|
|
|
*
|
2020-04-20 06:03:16 +00:00
|
|
|
* @param string[] &$scriptSrc Array of CSP directives
|
2020-03-16 23:31:05 +00:00
|
|
|
* @param array $policyConfig Current configuration for the CSP header
|
2022-02-18 20:32:21 +00:00
|
|
|
* @param int $mode ContentSecurityPolicy::REPORT_ONLY_MODE or
|
2020-03-03 22:50:34 +00:00
|
|
|
* ContentSecurityPolicy::FULL_MODE depending on type of header
|
|
|
|
|
* @return bool|void True or no return value to continue or false to abort
|
|
|
|
|
*/
|
|
|
|
|
public function onContentSecurityPolicyScriptSource( &$scriptSrc,
|
|
|
|
|
$policyConfig, $mode
|
|
|
|
|
);
|
|
|
|
|
}
|