Repository navigation
security: move inline event handlers to CSP-safe bindings - #131
Merged
Merged
Conversation
Cacti's Content-Security-Policy script-src-attr directive blocks inline event-handler attributes. This converts the plugin's remaining inline handlers: - The confirmation-page Cancel buttons across servcheck_ca.php, servcheck_credential.php, servcheck_proxy.php, servcheck_restapi.php and servcheck_test.php switch from onClick='cactiReturnTo()' to the CSP-safe cactiReturnTo class. - The filter "rows" selects on the CA, credential and proxy pages drop their inline onChange='applyFilter()' and are bound in each page's existing ready block via change() (not click(), which never fired for a <select>). The changed UI files are web entry points not loadable in the isolated unit process, so they are added to the patch-coverage allowlist. No i18n calls changed, so cacti.pot is untouched. Cacti 1.2.31+ binds the cactiReturnTo class automatically; the README documents a one-time applySkin() snippet for earlier releases.
TheWitness
requested review from
bmfmancini,
browniebraun and
xmacan
and
a balanced review from Copilot
October 7, 2026 21:43
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Cancel buttons no longer work out of the box on the declared minimum Cacti versions.
1 open finding
What changed in this PR
Moves UI event handling to CSP-safe JavaScript bindings.
Changes:
- Replaces inline Cancel and filter handlers.
- Documents Cacti compatibility requirements.
- Allowlists UI entry points from patch coverage.
| File | Description |
|---|---|
servcheck_ca.php |
Updates Cancel and rows handlers. |
servcheck_credential.php |
Adds CSP-safe rows binding. |
servcheck_proxy.php |
Corrects rows event binding. |
servcheck_restapi.php |
Updates Cancel buttons. |
servcheck_test.php |
Updates confirmation Cancel buttons. |
tests/bin/patch-coverage.php |
Allowlists UI entry points. |
README.md |
Documents pre-1.2.31 workaround. |
CHANGELOG.md |
Records the CSP cleanup. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
bmfmancini
previously approved these changes
Oct 8, 2026
# Conflicts: # tests/bin/patch-coverage.php
bmfmancini
approved these changes
Oct 8, 2026
bmfmancini
left a comment
Member
There was a problem hiding this comment.
Reviewed the Cancel and filter bindings; behavior is preserved and checks pass.
browniebraun
approved these changes
Oct 8, 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
Removes the plugin's inline event-handler attributes so pages comply with Cacti's Content-Security-Policy
script-src-attrdirective. Part of the fleet-wide CSP inline-handler cleanup.Changes
onClick='cactiReturnTo()'to the CSP-safecactiReturnToclass.onChange='applyFilter()'and bind in each page's existing ready block viachange(). On the CA/proxy pages the existing#rowsbinding usedclick()(which never fires for a<select>); credential had no#rowsbinding at all — both are corrected.Gate / i18n
The changed UI files are not in the measured source set; they're allowlisted. No
__()/__esc()calls were added, removed, or modified, so thecheck-i18n-pot.phpgate passes without regeneratingcacti.pot.Compatibility
Cacti 1.2.31+ binds the
cactiReturnToclass automatically. The README documents a one-timeapplySkin()snippet for earlier releases. No shim is baked into core or the plugin.