omi
omi copied to clipboard
[Bounty proposal] security(google-calendar-app): unescaped calendar list in settings page (stored XSS & attribute breakout) and raw exception reflection (5 proposed)
Summary
plugins/omi-google-calendar-app/main.py contains unescaped HTML and attribute interpolations on the connected settings page and in OAuth callback exception handling:
-
Stored XSS and Attribute Breakout in Connected Settings Page (
GET /?uid=...):- In
root(uid)(lines 996–1003): when the user is connected,get_user_calendars(uid)retrieves calendar objects from Google Calendar and builds the<select>options:for cal in calendars: selected = "selected" if cal["id"] == current_calendar or (current_calendar == "primary" and cal["primary"]) else "" primary_badge = " (Primary)" if cal["primary"] else "" calendar_options += f'<option value="{cal["id"]}" {selected}>{cal["name"]}{primary_badge}</option>'cal["name"]is rendered raw into the HTML option body withouthtml.escape(). A calendar named<script>alert(document.cookie)</script>executes arbitrary JavaScript when the user views the settings page (Stored XSS).cal["id"]is rendered intovalue="{cal["id"]}"without attribute escaping (quote=True), permitting attribute breakout and event injection.
- In
-
Raw Exception Reflection in OAuth Callback (
GET /auth/google/callback):- In
google_callback()(line 1186):except Exception as e: log(f"OAuth error: {e}") return HTMLResponse(content=f"Authentication error: {str(e)}", status_code=500)str(e)is interpolated directly into the HTML response body withouthtml.escape(). When an underlying HTTP or library exception echoes input or URL contents containing HTML, it is rendered unescaped in the 500 error page.
- In
Proposed Fix
- Escape
cal["name"]withhtml.escape()andcal["id"]withhtml.escape(..., quote=True)when building<option>elements incalendar_options. - Escape exception messages with
html.escape(str(e))in the callback exception handler. - Extend the hermetic test suite in
plugins/omi-google-calendar-app/test_uid_reflection.pywith tests for:- Stored XSS in calendar names (
<script>alert(1)</script>). - Attribute breakout in calendar IDs (
" onfocus=alert(1) autofocus="). - Exception reflection escaping in OAuth callback (
<img src=x onerror=alert(1)>).
- Stored XSS in calendar names (
Proposed Bounty
@kodjima33 @josancamon19 — under the contribution guide's bounty-suggestion process, would you approve a US$75 bounty, payable upon review and merge? PR with tests is ready.
/claim #14994
Implemented in PR #15000 with complete hermetic regression test coverage in test_uid_reflection.py and all manifest checks passing.