diff --git a/CHANGELOG.md b/CHANGELOG.md index beaac2a8..de82434d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ - Elasticsearch: Make it work with Elasticsearch 8 - CSS: Hide menu on mobile - CSS: Invert icons in dark mode +- Plugins: Allow changing CSP by more plugins ## Adminer 5.1.0 (released 2025-03-24) - Display collation at table structure if different from table diff --git a/adminer/include/adminer.inc.php b/adminer/include/adminer.inc.php index 45c12430..d81a3a71 100644 --- a/adminer/include/adminer.inc.php +++ b/adminer/include/adminer.inc.php @@ -86,10 +86,11 @@ class Adminer { } /** Get Content Security Policy headers - * @return list of arrays with directive name in key, allowed sources in value + * @param list $csp of arrays with directive name in key, allowed sources in value + * @return list same as $csp */ - function csp(): array { - return csp(); + function csp(array $csp): array { + return $csp; } /** Print HTML code inside diff --git a/adminer/include/design.inc.php b/adminer/include/design.inc.php index 0919a573..a9fca3ea 100644 --- a/adminer/include/design.inc.php +++ b/adminer/include/design.inc.php @@ -133,7 +133,7 @@ function page_headers(): void { header("X-XSS-Protection: 0"); // prevents introducing XSS in IE8 by removing safe parts of the page header("X-Content-Type-Options: nosniff"); header("Referrer-Policy: origin-when-cross-origin"); - foreach (adminer()->csp() as $csp) { + foreach (adminer()->csp(csp()) as $csp) { $header = array(); foreach ($csp as $key => $val) { $header[] = "$key $val"; diff --git a/editor/include/adminer.inc.php b/editor/include/adminer.inc.php index 11df014e..de9b4c99 100644 --- a/editor/include/adminer.inc.php +++ b/editor/include/adminer.inc.php @@ -59,8 +59,8 @@ class Adminer { function headers() { } - function csp() { - return csp(); + function csp($csp) { + return $csp; } function head($dark = null) { diff --git a/plugins/version-github.php b/plugins/version-github.php index 2b64b77e..a40112ea 100644 --- a/plugins/version-github.php +++ b/plugins/version-github.php @@ -26,9 +26,7 @@ verifyVersion = (current, url, token) => {