From 04832815ce99e6bcc4b5dd901cdd3ff5a5cd1850 Mon Sep 17 00:00:00 2001 From: "John Paul E. Balandan, CPA" Date: Sun, 1 Feb 2026 20:37:13 +0800 Subject: [PATCH] feat: add support for more CSP3 directives --- app/Config/ContentSecurityPolicy.php | 30 +++++- system/HTTP/ContentSecurityPolicy.php | 97 ++++++++++++++++++- .../system/HTTP/ContentSecurityPolicyTest.php | 63 ++++++++++++ user_guide_src/source/changelogs/v4.7.0.rst | 6 +- user_guide_src/source/outgoing/csp/012.php | 7 ++ 5 files changed, 197 insertions(+), 6 deletions(-) diff --git a/app/Config/ContentSecurityPolicy.php b/app/Config/ContentSecurityPolicy.php index 95022eb7ee43..9180d11c79d9 100644 --- a/app/Config/ContentSecurityPolicy.php +++ b/app/Config/ContentSecurityPolicy.php @@ -61,7 +61,15 @@ class ContentSecurityPolicy extends BaseConfig * * @var list|string */ - public $scriptSrcElem = 'self'; + public array|string $scriptSrcElem = 'self'; + + /** + * Specifies valid sources for JavaScript inline event + * handlers and JavaScript URLs. + * + * @var list|string + */ + public array|string $scriptSrcAttr = 'self'; /** * Lists allowed stylesheets' URLs. @@ -70,6 +78,21 @@ class ContentSecurityPolicy extends BaseConfig */ public $styleSrc = 'self'; + /** + * Specifies valid sources for stylesheets elements. + * + * @var list|string + */ + public array|string $styleSrcElem = 'self'; + + /** + * Specifies valid sources for stylesheets inline + * style attributes and `