Repository navigation
security(csp): version-safe inline-script nonce wrapper + strengthen PO/MO instructions - #272
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:28
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Isolate the fallback test from global bootstrap state so it remains valid when CactiSecureHeaders is loaded.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Adds version-safe CSP nonce support for FlowView inline scripts and strengthens PO/MO handling guidance.
Changes:
- Adds and applies a CSP nonce wrapper.
- Uses Cacti include helpers for CSS and JavaScript assets.
- Adds nonce tests and updates translation references and documentation.
| File | Description |
|---|---|
tests/Unit/CspNonceTest.php |
Adds CSP nonce tests; fallback coverage should be isolated from bootstrap-loaded classes. |
setup.php |
Adds the nonce wrapper and include helper usage. |
locales/po/cacti.pot |
Updates generated source references. |
functions.php |
Adds nonces to inline scripts. |
flowview_schedules.php |
Adds nonces to page scripts. |
flowview_filters.php |
Adds nonces to page scripts. |
flowview_devices.php |
Adds nonces to page scripts. |
flowview_databases.php |
Adds nonces to page scripts. |
CHANGELOG.md |
Documents the security change. |
.github/copilot-instructions.md |
Clarifies PO/MO catalog ownership. |
💡 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.