[Bounty proposal] security(dropbox-app): unescaped error reflection in OAuth callback, user data reflection, and raw uid parameter injection ($75 proposed)
Summary
plugins/omi-dropbox-app/main.py contains raw HTML and URL parameter interpolations leading to reflected cross-site scripting (XSS) and parameter injection:
-
Unauthenticated Reflected XSS in OAuth Callback:
- In
/auth/dropbox/callback: whenerrororerror_descriptionquery parameter is provided, it is rendered directly into the HTML response:
Any attacker can craft a link likeif error: return HTMLResponse( f"""...<p>{error_description or error}</p>...""", status_code=400, )https://.../auth/dropbox/callback?error=access_denied&error_description=<script>alert(document.cookie)</script>that executes arbitrary JavaScript in the victim's session.
- In
-
Unescaped User Information and Folder Name in Settings Page:
- In
get_home_page_html:display_name,email, andsettings.get('folder_name', ...)are rendered directly into HTML text and input attributes (value="{settings.get('folder_name', ...)}") withouthtml.escape, allowing attribute breakout and stored XSS.
- In
-
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)
- In OAuth token exchange failure:
-
Unquoted and Unescaped
uidURL Parameter Injection:- In
get_home_page_html:action="/settings?uid={uid}",<a href="/disconnect?uid={uid}">, and<a href="/auth/dropbox?uid={uid}">lackquote(uid, safe='')and attribute escaping. - Redirect responses in callback, disconnect, and settings endpoints (
RedirectResponse(url=f"/?uid={uid}")) lack URL parameter encoding.
- In
Fix
- Use
html.escapeforsafe_msg,safe_text, andsafe_erracross all HTML responses. - Guard callback query parameter types against
Queryobject defaults when invoked in tests. - 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). - Add hermetic test suite in
plugins/omi-dropbox-app/test_settings_page_encoding.pycovering 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). - Register
dropbox-app-settings-encoding-testsanddropbox-app-client-testsin.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.
Opened PR https://github.com/BasedHardware/omi/pull/14893 with complete fix and regression test suite. Ready for review!
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! 🙏