omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] security(dropbox-app): unescaped error reflection in OAuth callback, user data reflection, and raw uid parameter injection ($75 proposed)

Open kaleidoscopeAI opened this issue 2 months ago • 2 comments

Summary

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

  1. Unauthenticated Reflected XSS in OAuth Callback:

    • In /auth/dropbox/callback: when error or error_description query parameter is provided, it is rendered directly into the HTML response:
      if error:
          return HTMLResponse(
              f"""...<p>{error_description or error}</p>...""",
              status_code=400,
          )
      
      Any attacker can craft a link like https://.../auth/dropbox/callback?error=access_denied&error_description=<script>alert(document.cookie)</script> that executes arbitrary JavaScript in the victim's session.
  2. Unescaped User Information and Folder Name in Settings Page:

    • In get_home_page_html: display_name, email, and settings.get('folder_name', ...) are rendered directly into HTML text and input attributes (value="{settings.get('folder_name', ...)}") without html.escape, allowing attribute breakout and stored XSS.
  3. Unescaped Error Outputs:

    • In OAuth token exchange failure: HTMLResponse(f"Token exchange failed: {response.text}", status_code=400)
    • In OAuth exception handler: HTMLResponse(f"Error during authorization: {str(e)}", status_code=500)
  4. Unquoted and Unescaped uid URL Parameter Injection:

    • In get_home_page_html: action="/settings?uid={uid}", <a href="/disconnect?uid={uid}">, and <a href="/auth/dropbox?uid={uid}"> lack quote(uid, safe='') and attribute escaping.
    • Redirect responses in callback, disconnect, and settings endpoints (RedirectResponse(url=f"/?uid={uid}")) lack URL parameter encoding.

Fix

  1. Use html.escape for safe_msg, safe_text, and safe_err across all HTML responses.
  2. Guard callback query parameter types against Query object defaults when invoked in tests.
  3. Use quote(uid, safe='') and attribute escaping for all form actions, href targets, and redirect URLs (safe_settings_action, safe_disconnect_url, safe_auth_url).
  4. Add hermetic test suite in plugins/omi-dropbox-app/test_settings_page_encoding.py covering connect URL quoting, user info escaping, attribute breakout prevention, reflected callback error escaping, token exchange error escaping, exception message escaping, and redirect quoting (6 tests).
  5. Register dropbox-app-settings-encoding-tests and dropbox-app-client-tests in .github/checks-manifest.yaml.

Verification

All 6 new encoding tests, all 5 test_dropbox_client.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.

kaleidoscopeAI avatar Sep 19 '26 12:09 kaleidoscopeAI

Opened PR https://github.com/BasedHardware/omi/pull/14893 with complete fix and regression test suite. Ready for review!

kaleidoscopeAI avatar Sep 19 '26 12:09 kaleidoscopeAI

We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now. The fix already landed in #14579 — thanks for the fix! 🙏

undivisible avatar Oct 22 '26 11:10 undivisible