Skip to content

🛡️ Sentinel: fix XSS vulnerability in HTTP server dashboard#90

Closed
filmil wants to merge 1 commit into
mainfrom
fix-xss-vulnerability-http-server-17122778919723307083
Closed

🛡️ Sentinel: fix XSS vulnerability in HTTP server dashboard#90
filmil wants to merge 1 commit into
mainfrom
fix-xss-vulnerability-http-server-17122778919723307083

Conversation

@filmil

@filmil filmil commented May 16, 2026

Copy link
Copy Markdown
Owner

🛡️ Sentinel: fix XSS vulnerability in HTTP server dashboard

Severity: HIGH

Vulnerability:
Cross-Site Scripting (XSS) via template.HTML bypass. The dashboard was manually constructing HTML fragments and wrapping them in template.HTML, which tells the html/template engine that the content is safe and should not be escaped. This included user-provided data like agent short names and peer URLs.

Impact:
An attacker who can control peer information (e.g., by joining the cluster with a malicious name or URL) could execute arbitrary JavaScript in the context of another user's browser when they view the dashboard. This could lead to session hijacking or unauthorized actions.

Fix:
Converted all dashboard-related data structures to use raw strings. Moved all HTML generation into the template files, where html/template's auto-escaping is naturally applied. Registered sanitizeURL and wrapString helpers to handle specific rendering needs securely.

Verification:

  • Added a comprehensive security test case TestHTTPServer_XSSProtection that verifies script tags and malicious URLs are properly neutralized.
  • Verified template logic with a standalone Go script since the environment had restricted network access for running the full test suite.
  • Code review performed and approved.

PR created automatically by Jules for task 17122778919723307083 started by @filmil

Fixed multiple XSS vulnerabilities in the agent's HTTP dashboard by
refactoring data structures to use raw strings instead of template.HTML.
This allows the Go html/template engine to perform contextual auto-escaping
on all user-provided or external data.

Key changes:
- Refactored Participant, Peer, KnownPeer, IndexData, and KV structs to use
  raw strings.
- Moved HTML rendering logic (badges, links, styling) from Go code into
  HTML templates.
- Registered sanitizeURL and wrapString as template functions for secure
  and consistent rendering.
- Added a security test case to verify that malicious input is properly
  escaped in the dashboard.

This commit has been created by an automated coding assistant, with human supervision.
Full prompt used: [The prompt was too long to include here, but it focused on fixing the XSS vulnerability at internal/server/http_server.go:416]

Co-authored-by: filmil <246576+filmil@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@filmil filmil closed this May 16, 2026
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