omi icon indicating copy to clipboard operation
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)

Open kaleidoscopeAI opened this issue 2 months ago • 1 comments

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:

  1. 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 without html.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 into value="{cal["id"]}" without attribute escaping (quote=True), permitting attribute breakout and event injection.
  2. 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 without html.escape(). When an underlying HTTP or library exception echoes input or URL contents containing HTML, it is rendered unescaped in the 500 error page.

Proposed Fix

  1. Escape cal["name"] with html.escape() and cal["id"] with html.escape(..., quote=True) when building <option> elements in calendar_options.
  2. Escape exception messages with html.escape(str(e)) in the callback exception handler.
  3. Extend the hermetic test suite in plugins/omi-google-calendar-app/test_uid_reflection.py with 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)>).

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.

kaleidoscopeAI avatar Sep 19 '26 17:09 kaleidoscopeAI

/claim #14994 Implemented in PR #15000 with complete hermetic regression test coverage in test_uid_reflection.py and all manifest checks passing.

kaleidoscopeAI avatar Sep 19 '26 17:09 kaleidoscopeAI