security: harden Syslog CSV exports and imports - #326
Open
somethingwithproof wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Syslog plugin against common output- and import-related security issues by escaping guest-visible stored content, preventing spreadsheet formula injection in CSV exports, and limiting import payload sizes to reduce memory risk.
Changes:
- Escape stored alert HTML before rendering in the alarm viewer.
- Add an import payload size cap and centralize CSV cell hardening for exports.
- Add regression coverage for the hardening and update CI to pin the Cacti checkout ref and adjust job steps.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
syslog.php |
Escapes stored alarm HTML output (and preserves newlines via nl2br). |
functions.php |
Adds import-size guard and CSV cell hardening helper; updates CSV export to use it. |
tests/regression/issue318_output_import_hardening_test.php |
New regression test covering CSV formula hardening + alarm viewer escaping. |
tests/regression/issue277_import_payload_loader_test.php |
Updates regression assertions for the shared import payload loader. |
.github/workflows/plugin-ci-workflow.yml |
Pins Cacti checkout ref and adjusts lint/dependency steps in CI. |
Suppressed comments (2)
tests/regression/issue277_import_payload_loader_test.php:39
str_contains()is PHP 8+ only. If this repo/PR intends to remain PHP 7.4-compatible, switch this check back tostrpos(...) === false.
if (!str_contains($functions, "trim(get_nfilter_request_var('import_text')) !== ''")) {
tests/regression/issue318_output_import_hardening_test.php:44
str_contains()is PHP 8+ only. If this repo/PR intends to remain PHP 7.4-compatible, usestrpos(...) === falsefor this source scan (preserving the existing needle string).
if (!str_contains($syslog, 'nl2br(html_escape(trim($html, "\' ")))')) {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
somethingwithproof
force-pushed
the
security/syslog-output-import-hardening
branch
from
August 28, 2026 04:01
b71fab2 to
44e016b
Compare
This was referenced Aug 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
fputcsv()backslash escaping to prevent attacker-controlled field splitting and PHP 8.4+ deprecation output.develop.Validation
tests/regression/issue277_import_payload_loader_test.php.tests/regression/issue256_262_csv_import_hardening_test.php, including an RFC-style CSV round trip and oversized text-import subprocess.CI dependency
PHP 8.1 and 8.2 currently fail before plugin tests because the base workflow requests unavailable versioned Apache PHP packages. PR #329 is the prerequisite CI repair.
Compatibility
Uses PHP 8.0-compatible language features and Cacti helper conventions.
Refs #256 and #262.