fix(security): XSS in OAuth callback — escape error parameters#1573
Open
Joshua-Medvinsky wants to merge 1 commit into
Open
fix(security): XSS in OAuth callback — escape error parameters#1573Joshua-Medvinsky wants to merge 1 commit into
Joshua-Medvinsky wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR hardens the OAuth authorization error callback HTML response by escaping user-controlled error strings to prevent HTML injection.
Changes:
- Import
htmlfor HTML escaping utilities. - Escape
erroranderror_descriptionbefore interpolating into the error page HTML.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The OAuth2 tool callback handler interpolated query parameters 'error' and 'error_description' directly into HTML without escaping, enabling reflected XSS. Use html.escape() to sanitize. CWE-79: Cross-site Scripting (Reflected) Signed-off-by: Joshua Medvinsky <joshuam@ethlas.com> Signed-off-by: FailSafe Researcher <joshua@getfailsafe.com>
Joshua-Medvinsky
force-pushed
the
fix/find-003-xss-oauth-callback
branch
from
June 10, 2026 03:23
a305021 to
948d563
Compare
|
Hi maintainers 👋 — friendly follow-up on this security hardening PR. It has been open for a while with no reviewer feedback yet. Happy to address any concerns or adjust the approach. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The OAuth2 tool callback handler at /api/v1/auth/callback interpolates query parameters error and error_description directly into HTML without escaping, enabling reflected XSS. Use html.escape() to sanitize.
Vulnerability
Severity: High
CWE: CWE-79 (Cross-site Scripting — Reflected)
Location: src/solace_agent_mesh/gateway/http_sse/routers/auth.py:204
An attacker crafts: /api/v1/auth/callback?error=<script>alert(document.cookie)</script>. The f-string interpolation produces
Error: <script>alert(document.cookie)</script>
with no escaping. HTMLResponse returns text/html, so the browser executes the script in the gateway origin.Impact: session hijacking, CSRF token theft, arbitrary API calls as the victim.
Fix
Add import html and replace {error} with {html.escape(error)} and {error_description} with {html.escape(error_description or "No description provided")}.
Test Plan