hardening: enforce POST+CSRF for purge syslog devices utility#318
Open
somethingwithproof wants to merge 9 commits into
Open
hardening: enforce POST+CSRF for purge syslog devices utility#318somethingwithproof wants to merge 9 commits into
somethingwithproof wants to merge 9 commits into
Conversation
Refs Cacti#259 Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Syslog plugin’s destructive purge_syslog_hosts utilities action to mitigate CSRF risk by requiring a CSRF-protected POST, and updates the UI flow to submit a POST (instead of a GET link). It also adds a regression script to guard against reintroducing the insecure behavior.
Changes:
- Enforce
POSTand validate CSRF viacsrf_check(false)before executing the purge deletes. - Replace the utilities GET link with a jQuery UI confirmation dialog that submits a POST including
__csrf_magic. - Add a regression script asserting the hardening behavior and related UI/encoding expectations.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| setup.php | Adds POST+CSRF enforcement for purge action; replaces purge link with a dialog-driven POST flow including CSRF token. |
| tests/regression/issue259_csrf_purge_test.php | Adds a regression script that scans setup.php for required hardening snippets and safe UI/JS encoding patterns. |
f595568 to
75e4ad6
Compare
Contributor
Author
|
@TheWitness could you take a look? This is the re-opened CSRF+POST hardening for the purge devices utility (original #265), now rebased onto develop. All merge conflicts resolved. |
…eader - Distinct raise_message IDs per failure mode (syslog_method_error, syslog_csrf_error, syslog_csrf_unavailable) so log triage can differentiate non-POST, invalid token, and missing-helper paths - Add cacti_log entry on the non-POST rejection path so the audit trail is symmetric with the other two fail-closed branches - Document csrf_check($fatal=false) arg semantics inline so future readers see the helper contract - Rename the regression test comment block to call out explicitly that it is a source-scan lint, not a behavioral test; flag follow-up for real behavioral coverage once a DB-backed test harness exists Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
TheWitness
requested changes
Jun 4, 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
Enforces POST and CSRF validation before the purge utility can delete unused Syslog host records.
Security behavior
Validation
Compatibility
Uses existing Cacti plugin conventions and PHP 7.4-compatible syntax.