Skip to content

[Bounty proposal] security(whoop-app): unescaped error reflection in OAuth callback and raw uid parameter injection ($75 proposed) #14890

Closed as not planned

Description

@kaleidoscopeAI

Summary

plugins/omi-whoop-app/main.py contains raw HTML and URL parameter interpolations leading to reflected cross-site scripting (XSS) and injection:

  1. Unauthenticated Reflected XSS in OAuth Callback:

    • In /auth/whoop/callback: when error query parameter is provided, it is rendered directly into the HTML response:
      if error:
          return HTMLResponse(content=f"""
          ...
              <p>{error}</p>
          """)
      Any attacker can craft a link like https://.../auth/whoop/callback?error=<script>alert(document.cookie)</script> that executes arbitrary JavaScript in the victim's session.
  2. 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.
  3. Unquoted and Unescaped uid URL Parameter Injection:

    • In root connect page: <a href="{auth_url}"> where auth_url = f"/auth/whoop?uid={uid}" lacks quote(uid, safe='') and attribute escaping.
    • In root connected page: <a href="/disconnect?uid={uid}"> lacks quote(uid, safe='') and attribute escaping.
    • In callback success page: <a href="/?uid={uid}"> lacks quote(uid, safe='') and attribute escaping.
    • In /disconnect: RedirectResponse(url=f"/?uid={uid}") lacks URL parameter encoding.

Fix

  1. Use html.escape for safe_error in both the OAuth error branch and exception fallback.
  2. Guard callback query parameter types against Query object defaults when invoked in tests.
  3. Use quote(uid, safe='') and attribute escaping for all href targets and redirect URLs (safe_auth_url, safe_disconnect_url, safe_continue_url).
  4. Add hermetic test suite in plugins/omi-whoop-app/test_settings_page_encoding.py covering connect URL quoting, disconnect link escaping, reflected callback error escaping, callback success URL quoting, exception message escaping, and redirect quoting (6 tests).
  5. Register whoop-app-settings-encoding-tests and whoop-app-hardening-tests in .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.

Activity

  1. kaleidoscopeAI commented on Sep 19, 2026

    @kaleidoscopeAI
    ContributorAuthor

    Opened PR #14891 with complete fix and regression test suite. Ready for review!

  2. moved this from Someday to In progress in omi TODO / bountieson Sep 19, 2026
  3. added 2 commits that reference this issue on Oct 3, 2026
    15c8b23
    2e7a681
  4. kaleidoscopeAI commented on Oct 3, 2026

    @kaleidoscopeAI
    ContributorAuthor

    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?

  5. added
    intelligence
    p2
    retrieval-action
    and removed
    intelligence
    p2
    on Oct 6, 2026
  6. undivisible commented on Oct 22, 2026

    @undivisible
    Collaborator

    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! 🙏

  7. moved this from In progress to In review in omi TODO / bountieson Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2retrieval-action

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions