Skip to content

fix(frontend): escape raw HTML and bold text to prevent XSS (#175) - #242

Open
Anurag-M1 wants to merge 1 commit into
kubeflow:mainfrom
Anurag-M1:fix/issue-175-xss-sanitization
Open

Anurag-M1 wants to merge 1 commit into
kubeflow:mainfrom
Anurag-M1:fix/issue-175-xss-sanitization

Conversation

@Anurag-M1

Copy link
Copy Markdown

Fixes #175

Summary

  • Sanitize raw text before markdown conversions in formatChatMarkdown to prevent HTML injection and XSS vulnerabilities from assistant output.
  • Add escapeHtml alias in chatbot.js to prevent runtime ReferenceError when rendering citations and tool status badges.
  • Protect markdown link labels and URLs using placeholders to safely preserve links without allowing unescaped HTML injection.
  • Add regression tests in tests/test_widget_markdown.py for raw HTML tags, bold XSS payloads, and unsafe link labels.

Test plan

  • pytest tests/test_widget_markdown.py -v (8 passed)
  • pytest -v --tb=short (140 passed, 6 skipped)
  • python -m compileall docs-agent-mcp/pipelines docs-agent-mcp/mcp-server legacy/server legacy/server-https scripts tests
  • Verified DCO sign-off on commit

@google-oss-prow

Copy link
Copy Markdown

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign franciscojavierarceo for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(frontend): XSS vulnerability in chatbot.js — inline code and bold text not HTML-escaped before innerHTML

1 participant