Skip to content

hardening: escape site and device names, neutralise CSV exports, use the SNMP API for Cabletron - #463

Merged
TheWitness merged 3 commits into
developfrom
fix/escape-site-device-names
Nov 20, 2026
Merged

TheWitness merged 3 commits into
developfrom
fix/escape-site-device-names

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member
  • Escaping:
    • Site and device names are escaped wherever they are printed: form_selectable_ecell in the views; the option lists, edit headers and the MAC delete list; and the MACAUTH report and MAC watch email substitutions.
    • Import results escape values that come from the uploaded CSV.
  • CSV exports: a new mactrack_csv_cell() prefixes ' to text that starts with = + - @, tab or CR, and doubles embedded quotes. It is applied to all 13 export row builders. It is a local helper because the plugin supports Cacti 1.2.29.
  • Cabletron: the port table is read with cacti_snmp_walk() instead of an snmpgetnext loop through exec(). The walk stays inside the port subtree and also works with SNMP v3. This could not be tested against Cabletron hardware.
  • SNMP option items: item_moveup, item_movedown and item_remove now require POST through the existing mactrack_require_post(). Removal also checks that the item belongs to the option set. The links now POST with the CSRF token from js/mactrack_snmp.js.

Tests: tests/Security/SiteDeviceNameEscapingTest.php is new, and the two tests that asserted the old command-line escaping now assert there is no command line. Full suite: 1149 passed, 14 skipped, 2 failed. Both failures are in AdminActionsRequirePostTest, which needs /bin/true and fails the same way on develop. The browser path for the item actions was not run.

Fixes #462

…MP 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 <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@sonarqubecloud

Copy link
Copy Markdown

@TheWitness
TheWitness merged commit 6588db0 into develop Nov 20, 2026
9 checks passed
@TheWitness
TheWitness deleted the fix/escape-site-device-names branch November 20, 2026 19:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Escape site and device names, neutralise CSV exports and remove the Cabletron command line

2 participants