Skip to content

fix(automation): URL-encode reflected selected_items in export links - #8608

Closed
somethingwithproof wants to merge 11 commits into
developfrom
fix/automation-export-xss
Closed

somethingwithproof wants to merge 11 commits into
developfrom
fix/automation-export-xss

Conversation

@somethingwithproof

Copy link
Copy Markdown
Member

The automation list pages build a DownloadStart('…?action=export&selected_items=' . get_nfilter_request_var('selected_items') . '…') link that reflects the raw selected_items request variable into an inline <script> string. A crafted value can break out of the single-quoted JS string (reflected XSS, authenticated).

Fix: wrap the reflected value in rawurlencode() on all five pages (automation_networks, automation_graph_rules, automation_snmp, automation_tree_rules, automation_templates). This neutralizes quotes/angle-brackets in both the JS-string and URL-parameter context, and round-trips correctly — the export action reads get_nfilter_request_var('selected_items') (URL-decoded) and re-sanitizes via sanitize_unserialize_selected_items() as before, so behavior is unchanged.

Scope note: this reflect (the DownloadStart pattern) exists on develop; the released 1.2.x pages do not reflect the raw value, so this is a develop-only hardening fix.

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

sonarqubecloud Bot commented Nov 7, 2026

Copy link
Copy Markdown

@somethingwithproof

Copy link
Copy Markdown
Member Author

Closing as superseded by #8448, which encodes the same export links from the validated value and also covers data_source_profiles.php and host_templates.php.

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