[Bounty proposal] security(whoop-app): unescaped error reflection in OAuth callback and raw uid parameter injection ($75 proposed)
Summary
plugins/omi-whoop-app/main.py contains raw HTML and URL parameter interpolations leading to reflected cross-site scripting (XSS) and injection:
-
Unauthenticated Reflected XSS in OAuth Callback:
- In
/auth/whoop/callback: whenerrorquery parameter is provided, it is rendered directly into the HTML response:
Any attacker can craft a link likeif error: return HTMLResponse(content=f""" ... <p>{error}</p> """)https://.../auth/whoop/callback?error=<script>alert(document.cookie)</script>that executes arbitrary JavaScript in the victim's session.
- In
-
Unescaped Exception Message in Callback Failure:
except Exception as e: return HTMLResponse(content=f"Authentication error: {str(e)}", status_code=500)exposes unescaped exception strings directly in the HTML response.
-
Unquoted and Unescaped
uidURL Parameter Injection:- In
rootconnect page:<a href="{auth_url}">whereauth_url = f"/auth/whoop?uid={uid}"lacksquote(uid, safe='')and attribute escaping. - In
rootconnected page:<a href="/disconnect?uid={uid}">lacksquote(uid, safe='')and attribute escaping. - In callback success page:
<a href="/?uid={uid}">lacksquote(uid, safe='')and attribute escaping. - In
/disconnect:RedirectResponse(url=f"/?uid={uid}")lacks URL parameter encoding.
- In
Fix
- Use
html.escapeforsafe_errorin both the OAuth error branch and exception fallback. - Guard callback query parameter types against
Queryobject defaults when invoked in tests. - Use
quote(uid, safe='')and attribute escaping for all href targets and redirect URLs (safe_auth_url,safe_disconnect_url,safe_continue_url). - Add hermetic test suite in
plugins/omi-whoop-app/test_settings_page_encoding.pycovering connect URL quoting, disconnect link escaping, reflected callback error escaping, callback success URL quoting, exception message escaping, and redirect quoting (6 tests). - Register
whoop-app-settings-encoding-testsandwhoop-app-hardening-testsin.github/checks-manifest.yaml.
Verification
All 6 new encoding tests, all 24 test_whoop_hardening.py tests, 4 test_get_workouts.py tests, 3 test_weekly_summary.py tests, and all 53 checks-manifest validation tests pass locally (100% green).
@kodjima33 @josancamon19, following the published bounty proposal process, would you approve $75 after review/merge?
PR is ready to link.
Opened PR https://github.com/BasedHardware/omi/pull/14891 with complete fix and regression test suite. Ready for review!
Fresh PR rebased onto current main — the original branch could no longer compute mergeability, so its checks never ran: #20399 (CI green, Hygiene success, mergeable).
Fix: escape the OAuth callback error parameter and exception string (reflected XSS), and quote(uid, safe='') across the connect/disconnect/continue links and the /disconnect redirect, with href attribute targets escaped.
Tests: 6 hermetic tests, registered as whoop-app-settings-encoding-tests in .github/checks-manifest.yaml.
Failure-Class: FC-oauth-error-params-reflected-into-html
@kodjima33 @josancamon19, following the published bounty proposal process, would you approve $75 after review/merge?
Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏