You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bounty proposal] fix(subscription): sanitize uid and eliminate script injection in pricing template ($25 proposed) #14477
plugins/subscription/main.py serves the web subscription pricing page via subscription_page(request: Request, uid: str = "") and forwards the untrusted uid parameter directly into templates/subscription/index.html.
In templates/subscription/index.html, {{ uid }} was interpolated unescaped into inline JavaScript:
When an attacker constructs a URL containing quotes/script payloads (e.g. /subscription?uid=';alert(document.domain);//), the raw value breaks out of string context and executes arbitrary JavaScript in the victim's browser session.
Root Cause
The FastAPI handler did not sanitize or validate uid before logging or passing it to the template.
The HTML template interpolated raw Jinja2 variables directly inside a <script> tag instead of using HTML attributes with proper auto-escaping.
Solution
Added _sanitize_uid(uid: str) -> str enforcing alphanumeric, underscore, and hyphen characters (up to 128 chars) in plugins/subscription/main.py.
Passed the validated uid via data-uid attribute on the container element in templates/subscription/index.html, eliminating raw script injection.
Updated client-side tracking to read from data-uid and validate URL parameters against the safe pattern.
Added unit test suite plugins/subscription/test_subscription_security.py covering valid/invalid UIDs and XSS injection vectors.
Proposing standard US$25 bounty for this security fix.
Activity
fix(subscription): sanitize uid and eliminate script injection in pri…