Repository navigation
security: convert cactiReturnTo cancel buttons to the CSP-safe class - #93
Merged
Merged
Conversation
TheWitness
requested review from
bmfmancini,
browniebraun and
xmacan
and
a balanced review from Copilot
October 7, 2026 20:55
There was a problem hiding this comment.
🟡 Changes recommended
Regression coverage is needed because the changed entry points are exempt from patch-coverage enforcement.
1 open finding
What changed in this PR
Updates confirmation-page Cancel buttons to use Cacti’s CSP-safe delegated event handler while documenting compatibility for older Cacti releases.
Changes:
- Replaces eight inline handlers with
cactiReturnToclasses. - Documents the Cacti 1.2.29–1.2.30 compatibility bridge.
- Records the security change.
| File | Description |
|---|---|
webseer.php |
Converts URL action Cancel buttons. |
webseer_servers.php |
Converts server action Cancel buttons. |
webseer_proxies.php |
Converts the proxy action Cancel button. |
README.md |
Documents compatibility setup. |
CHANGELOG.md |
Records the CSP improvement. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
The confirmation-page Cancel buttons on webseer.php, webseer_servers.php and webseer_proxies.php used an inline onClick='cactiReturnTo()' handler, which trips Cacti's Content-Security-Policy script-src-attr directive. Switch them to the CSP-safe cactiReturnTo CSS class (class='cactiReturnTo', plus an optional data-url when a target is passed). Cacti 1.2.31 and later bind this class automatically. To keep the plugin's 1.2.29 compatibility floor, the README documents a one-time include/layout.js snippet for operators still on 1.2.29-1.2.30 - no shim is baked into the core or the plugin.
TheWitness
force-pushed
the
fix/csp-cactireturnto-class
branch
from
October 7, 2026 21:00
1267fd7 to
c955b75
Compare
Assert the three confirmation-page entry points carry no inline cactiReturnTo onClick handler and expose all eight Cancel buttons via the CSP-safe cactiReturnTo class. These files are exempt from the patch-coverage gate, so this source-level test is what catches a reintroduced inline handler.
bmfmancini
approved these changes
Oct 8, 2026
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
Pilots the
cactiReturnToCSS-class approach for the plugin fleet's confirmation-page Cancel buttons, replacing the inlineonClick='cactiReturnTo()'handlers that trip Cacti's Content-Security-Policyscript-src-attrdirective.Approach (no shim in core or plugin)
onClick='cactiReturnTo(url)'toclass='cactiReturnTo'(plusdata-url='<url>'only when a target URL is passed; the no-arg case falls back todocument.referrer, whichcactiReturnTo()already does).include/layout.jssnippet that operators on 1.2.29–1.2.30 add before upgrading. Nothing is baked into core or the plugin.Changes
class='cactiReturnTo'.All three PHP files are already in the patch-coverage gate's allowlist; the edits are same-line (no source-line shift), so
cacti.potis unaffected.This is the pilot — once the pattern/README wording is approved, I'll roll it across the rest of the fleet.