Repository navigation
security(csp): version-safe inline-script nonce wrapper + strengthen PO/MO instructions - #143
Merged
Merged
Conversation
…en PO/MO instructions
TheWitness
requested review from
bmfmancini,
browniebraun and
xmacan
and
a lite review from Copilot
September 27, 2026 15:16
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
The nonce tests must reliably isolate and execute both supported branches.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds version-safe CSP nonces to ReportIt inline scripts and strengthens translation artifact guidance.
Changes:
- Adds and applies
plugin_reportit_csp_nonce(). - Adds CSP nonce unit coverage.
- Updates POT references, changelog, and Copilot instructions.
| File | Summary |
|---|---|
view.php |
Adds nonces to inline scripts. |
tests/Unit/CspNonceTest.php |
Tests nonce behavior; tests require isolated coverage for both class-available and fallback branches. |
templates.php |
Adds nonces to inline scripts. |
setup.php |
Defines the nonce helper. |
reportit.php |
Adds nonces to inline scripts. |
locales/po/cacti.pot |
Updates generated source references. |
CHANGELOG.md |
Documents the security change. |
.github/copilot-instructions.md |
Strengthens PO/MO handling guidance. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
xmacan
approved these changes
Sep 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
Part of the fleet-wide CSP-nonce rollout (mirrors the pilot Cacti/plugin_mactrack#374).
plugin_<name>_csp_nonce()and applies it to every inline<script>block, sopages stay compatible with Cacti's Content-Security-Policy nonce enforcement.
.github/copilot-instructions.md— the.po/.mofiles are never committed (Weblate owns them); onlycacti.pot.Wrapper (cross-version safe)
Emits the per-request
nonce="..."on Cacti releases that shipCactiSecureHeaders(present on both
developand1.2.x), and''on older releases — so the tagstays valid either way. The wrapper lives in the plugin's functions library where one
exists, otherwise in
setup.php(loaded on every Cacti page by the plugin loader).Also
tests/Unit/CspNonceTest.phpcovers the empty-string fallback, thestringreturn type, and delegation to
CactiSecureHeaders.<script src>/ CSS<link>, those gothrough Cacti's
get_md5_include_js()/get_md5_include_css()helpers (automaticnonce + md5 cache-buster).
locales/po/cacti.potregenerated for shifted source line references; theper-language
.po/.mocatalogs are intentionally not committed.