Skip to content

fix: escape device fields in the Monitor list view - #279

Open
somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:fix/escape-list-view-fields
Open

somethingwithproof wants to merge 3 commits into
Cacti:developfrom
somethingwithproof:fix/escape-list-view-fields

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Description

The List view printed the device description, location, site name and Monitor Text without the escaping the other Monitor views apply. form_selectable_cell() outputs its argument as-is, so a name containing characters like < or & was displayed wrongly. This wraps those four fields in html_escape() in renderHostList(), so the List view matches the Tiles, Tree and Names views.

Related Issue

None.

Motivation and Context

The List view was the only view that did not escape these fields.

How Has This Been Tested?

Added a Pest test that renders a List row for a device whose description, location, site name and Monitor Text contain <, & and quotes, and checks for the escaped form. It fails without the change and passes with it. The full suite passes (123 tests).

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation repository accordingly.

@TheWitness TheWitness left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use ecell() instead of html_escape()

Comment thread includes/render.php Outdated
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
Signed-off-by: Thomas Vincent <thomasvincent@gmail.com>
@somethingwithproof
somethingwithproof force-pushed the fix/escape-list-view-fields branch from d9be7ca to 90e9d2c Compare October 24, 2026 14:45
@somethingwithproof

Copy link
Copy Markdown
Member Author

Switched the four fields to form_selectable_ecell() and rebased onto develop.

@sonarqubecloud

Copy link
Copy Markdown

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.

2 participants