Skip to content

fix(security): Add missing CSP nonce attributes to script tags in box_cssjs.php#460

Merged
skerbis merged 2 commits intomainfrom
copilot/fix-nonce-in-box-cssjs
Feb 16, 2026
Merged

fix(security): Add missing CSP nonce attributes to script tags in box_cssjs.php#460
skerbis merged 2 commits intomainfrom
copilot/fix-nonce-in-box-cssjs

Conversation

Copy link
Contributor

Copilot AI commented Feb 16, 2026

Five script tags in fragments/ConsentManager/box_cssjs.php were missing CSP nonce attributes, breaking strict Content Security Policy enforcement.

Changes

Added rex_response::getNonce() to:

  • Google Consent Mode v2 script (line 57)
  • Debug script and inline config (lines 68, 71)
  • Consent manager parameters and frontend script (lines 167-168)

Before:

$consentparams['outputjs'] .= '    <script>var consent_manager_parameters = ' . json_encode($jsConfig) . ';</script>';
$googleConsentModeOutput .= '    <script src="' . $scriptUrl . '" defer></script>';

After:

$consentparams['outputjs'] .= '    <script nonce="' . rex_response::getNonce() . '">var consent_manager_parameters = ' . json_encode($jsConfig) . ';</script>';
$googleConsentModeOutput .= '    <script nonce="' . rex_response::getNonce() . '" src="' . $scriptUrl . '" defer></script>';

Pattern matches 26+ existing nonce implementations across the codebase.

Original prompt

This section details on the original issue you should resolve

<issue_title>box_cssjs.php: nonce fehlt</issue_title>
<issue_description>Description / Beschreibung

Zeile 167

$consentparams['outputjs'] .= ' <script>var consent_manager_parameters

da fehlt der/die/das nonce oder?

Affected versions / Verwendete Versionen

5.3.5</issue_description>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…_cssjs.php

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix missing nonce in box_cssjs.php fix(security): Add missing CSP nonce attributes to script tags in box_cssjs.php Feb 16, 2026
Copilot AI requested a review from skerbis February 16, 2026 14:37
@skerbis skerbis marked this pull request as ready for review February 16, 2026 14:50
Copilot AI review requested due to automatic review settings February 16, 2026 14:50
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a critical Content Security Policy (CSP) security issue by adding missing nonce attributes to 5 script tags in fragments/ConsentManager/box_cssjs.php. Without these nonces, strict CSP enforcement was being broken, potentially compromising the security policy of sites using this consent manager.

Changes:

  • Added CSP nonce attributes to Google Consent Mode v2 script tag (line 57)
  • Added CSP nonce attributes to debug mode scripts (lines 68, 71)
  • Added CSP nonce attributes to consent manager configuration and frontend script tags (lines 167-168)

@skerbis skerbis merged commit 31e3b64 into main Feb 16, 2026
11 checks passed
@skerbis skerbis deleted the copilot/fix-nonce-in-box-cssjs branch February 16, 2026 14:55
skerbis added a commit that referenced this pull request Feb 17, 2026
…_cssjs.php (#460)

* Initial plan

* fix(security): Add missing nonce attributes to all script tags in box_cssjs.php

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
skerbis added a commit that referenced this pull request Feb 17, 2026
* reload fixes (#457)

* security fixes and theme preview

* securit fix replace

* Update CHANGELOG.md

* 5.3.3

* namespace guide entfernt

* fixed reload

* Bump version to 5.3.4 and fix various issues

Updated version to 5.3.4 and fixed multiple issues including JSON parsing errors, framework template loading, and security vulnerabilities.

* 5.3.6

* alle laden inline via session erlauben

* Fix iOS Safari touch events (thx @alexwenz) and update changelog

* Address review comments: add missing translations and secure host usage

* fix(security): Add missing CSP nonce attributes to script tags in box_cssjs.php (#460)

* Initial plan

* fix(security): Add missing nonce attributes to all script tags in box_cssjs.php

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

* rebuild form 5.3.5

* some inline fixes

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
skerbis added a commit that referenced this pull request Feb 17, 2026
* reload fixes (#457)

* security fixes and theme preview

* securit fix replace

* Update CHANGELOG.md

* 5.3.3

* namespace guide entfernt

* fixed reload

* Bump version to 5.3.4 and fix various issues

Updated version to 5.3.4 and fixed multiple issues including JSON parsing errors, framework template loading, and security vulnerabilities.

* 5.3.6

* alle laden inline via session erlauben

* Fix iOS Safari touch events (thx @alexwenz) and update changelog

* Address review comments: add missing translations and secure host usage

* fix(security): Add missing CSP nonce attributes to script tags in box_cssjs.php (#460)

* Initial plan

* fix(security): Add missing nonce attributes to all script tags in box_cssjs.php

Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>

* rebuild form 5.3.5

* some inline fixes

* stylefixes

removed some themes

* Bump version from 5.5.0-dev to 5.5.0

---------

Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
Co-authored-by: skerbis <791247+skerbis@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

box_cssjs.php: nonce fehlt

3 participants