Repository navigation
hardening: validate the device hostname and escape it on output - #214
Merged
Merged
Conversation
xmacan
previously approved these changes
Nov 19, 2026
Reject hostnames with path separators, traversal sequences or unexpected characters on save, refuse to build backup file paths from a stored hostname that is not a single plain file name, and escape the hostname in the edit header, delete confirmation list and report email. Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
somethingwithproof
force-pushed
the
fix/validate-device-hostname
branch
from
November 19, 2026 09:04
98b632f to
2325528
Compare
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
|
TheWitness
approved these changes
Nov 20, 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.



plugin_routerconfigs_valid_hostname()runs on save. It accepts letters, digits,. - _ :and inner spaces, since imported Cacti devices seed the name from the description. The name must start with a letter or digit and must not contain...plugin_routerconfigs_backup_filename(). It rejects path separators, NUL,..and anything that is not a single file name, so rows stored before this change fail their backup with an error instead of being used.The device
directoryfield also feeds file paths. It is not changed here.Tests:
tests/Security/HostnameValidationTest.php. It includes a check that a traversal hostname leaves a file outside the backup directory untouched, and the traversal and email tests fail ondevelop. 364 passed.Fixes #213