Skip to content

fix(frontend-ng): harden URL bindings in SigmaRule and LinkRedirectWarning - #3982

Merged
jaegeral merged 1 commit into
google:masterfrom
jaegeral:2026-11-11_eliminate-xss
Nov 12, 2026
Merged

jaegeral merged 1 commit into
google:masterfrom
jaegeral:2026-11-11_eliminate-xss

Conversation

@jaegeral

@jaegeral jaegeral commented Nov 12, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Hardens remaining URL bindings across timesketch/frontend-ng components:

  1. SigmaRule.vue (references): Render Sigma rule references as plain text items (<li>{{ ref }}</li>, matching falsepositives directly below) instead of unvalidated <a :href="ref"> links that could execute javascript: URIs when clicked.
  2. LinkRedirectWarning.vue (contextUrl / contextValue):
    • Validate contextUrl via new URL() so only http: and https: URLs are bound to :href on the continue button (safeContextUrl), disabling the button otherwise and adding rel="noopener noreferrer".
    • Replace {{ getContextValue }} and {{ getContextUrl }} (DOMPurify.sanitize() inside {{ }} text interpolations, which double-escaped & as &amp;) with direct {{ contextValue }} and {{ contextUrl }} text interpolations.

Tests

  • Added Vitest unit tests in SigmaRule.test.js and LinkRedirectWarning.test.js.

…rning

- Render SigmaRule references as plain text items rather than unvalidated :href links (matching falsepositives).
- Validate LinkRedirectWarning contextUrl for http/https protocols before binding to :href, and remove redundant DOMPurify.sanitize calls inside text interpolations that double-escaped ampersands.
- Add Vitest unit tests for SigmaRule and LinkRedirectWarning.
@jaegeral
jaegeral force-pushed the 2026-11-11_eliminate-xss branch from b873ade to df28984 Compare November 12, 2026 15:30
@jaegeral jaegeral changed the title fix(frontend-ng): harden URL bindings and remove unnecessary v-html in dialogs fix(frontend-ng): harden URL bindings in SigmaRule and LinkRedirectWarning Nov 12, 2026
@jaegeral jaegeral self-assigned this Nov 12, 2026
@jaegeral jaegeral added Frontend Code Health Code health improvements labels Nov 12, 2026
@jaegeral

Copy link
Copy Markdown
Collaborator Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request refactors the LinkRedirectWarning component to safely validate external redirect URLs using the URL API, disabling the continue button for unsafe schemes and adding corresponding unit tests. It also removes clickable links from the references list in SigmaRule.vue to prevent potential security issues. The review feedback points out that completely removing clickable links in SigmaRule.vue is a usability regression, and recommends conditionally rendering only safe http and https links while keeping unsafe schemes as plain text, along with updating the unit tests to verify this behavior.

@jaegeral

Copy link
Copy Markdown
Collaborator Author

I did github review and a different code review. This will hopefully clean xss.

@jaegeral
jaegeral merged commit c0fbd4f into google:master Nov 12, 2026
12 checks passed
jaegeral added a commit to jaegeral/timesketch that referenced this pull request Nov 24, 2026
…rning (google#3982)

- Render SigmaRule references as plain text items rather than unvalidated :href links (matching falsepositives).
- Validate LinkRedirectWarning contextUrl for http/https protocols before binding to :href, and remove redundant DOMPurify.sanitize calls inside text interpolations that double-escaped ampersands.
- Add Vitest unit tests for SigmaRule and LinkRedirectWarning.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Health Code health improvements Frontend

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant