From 44842580854842bff8d89c1adc7a2c9f418c37f4 Mon Sep 17 00:00:00 2001 From: Thomas Vincent Date: Wed, 18 Nov 2026 15:52:20 -0800 Subject: [PATCH 1/3] fix(security): escape site and device names, harden CSV export and SNMP item actions Escape site and device names on output in views, option lists, edit headers and the MAC authorization emails, escape values from uploaded CSV files in the import results, neutralise spreadsheet formula prefixes in CSV exports, read the Cabletron port table through the Cacti SNMP API instead of a command line, and require POST for SNMP option item reorder and removal. Signed-off-by: Thomas Vincent --- CHANGELOG.md | 5 + js/mactrack_snmp.js | 18 ++ lib/mactrack_cabletron.php | 71 ++++---- lib/mactrack_functions.php | 29 +++- mactrack_device_types.php | 38 ++--- mactrack_devices.php | 54 +++--- mactrack_sites.php | 34 ++-- mactrack_snmp.php | 24 ++- mactrack_vendormacs.php | 6 +- mactrack_view_arp.php | 16 +- mactrack_view_devices.php | 28 ++-- mactrack_view_dot1x.php | 14 +- mactrack_view_interfaces.php | 26 +-- mactrack_view_ips.php | 10 +- mactrack_view_macs.php | 20 +-- mactrack_view_sites.php | 18 +- poller_mactrack.php | 8 +- tests/Security/SiteDeviceNameEscapingTest.php | 158 ++++++++++++++++++ .../SqlSafetyAndOutputEscapingTest.php | 7 +- tests/Unit/DeviceTypeSqlSafetyTest.php | 7 +- tests/bootstrap-unit.php | 16 ++ 21 files changed, 415 insertions(+), 192 deletions(-) create mode 100644 tests/Security/SiteDeviceNameEscapingTest.php diff --git a/CHANGELOG.md b/CHANGELOG.md index 59451c33..98ebc6be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,16 @@ * security: Add a version-safe CSP nonce (`plugin_mactrack_csp_nonce()`) to every inline `