Skip to content

fix(google-calendar-app): escape reflected error and encode uid in setup pages (#14580) - #14581

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
t3ratech:fix/gcal-uid-reflection
Sep 18, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
t3ratech:fix/gcal-uid-reflection

Conversation

@t3ratech

@t3ratech t3ratech commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

Two unauthenticated routes on omi-google-calendar-app render client-controlled input into HTML with no encoding.

1. GET /auth/google/callback — reflected XSS, no preconditions. error is Query(None), taken straight off the URL and interpolated into the page body:

if error:
    return HTMLResponse(content=f"""
        ...
                    <p>{error}</p>

So /auth/google/callback?error=<script>alert(1)</script> executes script on the plugin's origin. No code, no state, no session — the if error: branch is the first thing the handler does, so anyone with the URL can trigger it.

2. GET / — uid reflected into attributes. uid reaches two href attributes and a hidden <input ... value="{uid}">. A uid of "><script>alert(1)</script> breaks out of the attribute; a bare & or # silently corrupts the query instead. The disconnected branch renders for any uid with no stored tokens, which is every attacker-chosen value.

The fix follows the pattern established by #13658 (six sibling apps) and #14579 (omi-dropbox-app): quote(uid, safe="") for URL contexts, html.escape() for text and attribute contexts. Ordinary input is unchanged — /?uid=abc123 still renders /auth/google?uid=abc123, and ?error=access_denied still shows access_denied.

Product invariants affected

None. Output encoding only, confined to plugins/omi-google-calendar-app/; no auth, storage, or tool-contract behaviour changes.

How it was verified

plugins/omi-google-calendar-app/test_uid_reflection.py — hermetic, stdlib-only, framework and sibling modules stubbed, driving the real google_callback and root handlers:

  • 5/5 pass on this head.
  • red→green: 3 of the 5 fail against main's plugin code. The other two (test_ordinary_error_still_shown, test_ordinary_uid_still_renders) are controls that pass both ways, so the suite proves the fix rather than restating current behaviour.
  • Coverage: the callback error sink, the uid attribute sinks, &/# query corruption, and both ordinary-input controls.
  • Registered as gcal-uid-reflection-encoding-tests (triggers on plugins/omi-google-calendar-app/**). Manifest parses, 228 checks, no duplicate ids.

scripts/pr-preflight --base upstream/main --pr-body-file <this body> run locally against the branch.

Tests

New regression suite plugins/omi-google-calendar-app/test_uid_reflection.py, registered in the checks manifest so a future edit to this plugin re-runs it. The red→green result is the evidence it would have caught the bug.

Failure-Class: none

Fixes #14580

Review in cubic

…tup pages

Two unauthenticated routes render client-controlled input into HTML with no
encoding.

GET /auth/google/callback takes `error` straight off the query string and
interpolates it into the page body:

    <p>{error}</p>

so /auth/google/callback?error=<script>alert(1)</script> executes on the
plugin's origin. No code, state or prior session is needed — the `if error:`
branch is the first thing the handler does.

GET / reflects `uid` into two href attributes and a hidden input value; a uid
of "><script>alert(1)</script> breaks out of the attribute, and a bare & or #
corrupts the query instead.

Follows the encoding pattern of BasedHardware#13658 (six sibling apps) and BasedHardware#14579
(omi-dropbox-app): quote(uid, safe="") for URL contexts, html.escape() for
text and attribute contexts.

Verified:
- plugins/omi-google-calendar-app/test_uid_reflection.py — 5/5 pass on this head
- red→green: 3 of the 5 fail against main's plugin code; the other two are
  ordinary-input controls that pass both ways
- registered as gcal-uid-reflection-encoding-tests; manifest parses, 228
  checks, no duplicate ids

Failure-Class: none

Co-Authored-By: Claude Opus 5 <[email protected]>
@t3ratech

t3ratech commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

/claim #14580 PayPal: [email removed]

Alternative rail — USDC on Base: 0x4c08AD88Ae29908Cb2d591A53703afba5702a833 (USDC 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913, chain id 8453). Either is fine; not asking to be paid twice.

@kodjima33 kodjima33 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed still-broken on main (raw uid/error interpolated into HTML in root() and google_callback() — no html.escape/quote present). Root cause + linked issue (#14580) + scoped diff + green CI + red→green test proof: 5/5. Merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants