Skip to content

security: require POST for state changes and escape map data in the web pages - #352

Open
somethingwithproof wants to merge 1 commit into
developfrom
security/web-engine-hardening
Open

somethingwithproof wants to merge 1 commit into
developfrom
security/web-engine-hardening

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

Further security hardening for Weathermap, following #348.

The management and editor actions that change maps, groups, settings or permissions now answer 405 unless they arrive by POST, so Cacti's CSRF check covers them. The management links for those actions post through a small capture-phase handler, which also works on Cacti 1.2.29 where core has no POST link helper, and the editor start page forms now carry the token.

Hover graph URLs, the editor's inline script data, the add-map picker links, map setting values and the page title are escaped, and hover graphs with a script scheme are dropped. New maps and their source maps stay inside configs/, output-file directives can no longer take the names the poller and the graph tree use, and the tree view prints the generated HTML instead of including it. Lines of an INCLUDE file are no longer copied into the log, and a format string with a huge or value-supplied width is printed literally.

Tested on Cacti 1.2.32 with PHP 8.5 in Docker. The Pest suite passes apart from the two DocumentationExampleHoverTest failures that also fail on develop, patch coverage is 100%, and the manifest and POT checks pass. On the live instance, GET requests for these actions return 405, a tokenless POST changes nothing, and clicking activate and deactivate, group rename, Rebuild All, creating a map from the editor start page, and adding a node in the editor all still work.

The CHANGELOG entry for #351 is included here so the two open PRs do not conflict.

Corresponding details are tracked privately through the project's security advisory process.

…eb pages

Management and editor actions that change state are refused unless they are
POSTed with the CSRF token, and map data is escaped where it reaches page markup.

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

1 participant