Repository navigation
Conversation
The client-controlled uid query param was interpolated raw into HTML on
the connect/setup pages of omi-whoop-app, omi-twitter-chat-tools-app,
omi-github-app, omi-notion-app, omi-clickup-app, and omi-slack-app:
auth_url = f"/auth?uid={uid}" inside <a href="{auth_url}">, plus
disconnect/back links, RedirectResponse targets, fetch() URLs, a
value="{uid}" attribute, and a JS string literal in github's page.
uid='x" onmouseover="alert(1)' breaks the attribute (verified: the raw
payload reaches the page); &, #, and ? corrupt the uid query param.
Each affected handler now percent-encodes uid once (uid_q) for URL
contexts; github's JS literal uses json.dumps; the value= attributes in
clickup/slack test pages use html.escape.
Verified: plugins/test_uid_reflection.py loads each plugin with stubbed
framework/db imports and drives the real root() handler — on old code
the hostile uid survives into a broken href (assertion fails on all
six); with the fix every page carries the percent-encoded uid. 2/2 pass
covering all six plugins.
Failure-Class: none
There was a problem hiding this comment.
All reported issues were addressed across 8 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
Review follow-up: the previous commit computed uid_q at the top of the OAuth callbacks, before uid was assigned, so every callback raised UnboundLocalError. The encoding now happens after the state lookup has produced and validated uid. Also escape <>& after json.dumps for the uid injected into a script block (github dashboard), and route the slack dev page client-side fetch URLs through encodeURIComponent. Verification: python3 plugins/test_uid_reflection.py -> 6/6; the new callback tests raise UnboundLocalError on the previous revision. Failure-Class: none
Follow-up review fixes: the clickup /test?dev=true page also built client-side fetch URLs from the raw DOM uid; route them through encodeURIComponent like slack's. The regression suite now also covers the OAuth callbacks, disconnect redirects, the github script-block uid, the dev-page value attribute, and asserts %26 so an ampersand in uid cannot inject a second query parameter. Verification: python3 plugins/test_uid_reflection.py -> 7/7. Failure-Class: none
|
Verified end-to-end — this is a clean, well-scoped security fix. I loaded all six plugin modules with stubbed imports and ran the new regression suite: 7/7 pass on this head, and the injection assertions fail on the pre-fix code ( Per file:
Two notes:
Since this changes security-sensitive auth/setup page rendering across six plugins, I'd like a maintainer sign-off on the security fix before merge. by AI on behalf of David — plugin OAuth setup-page injection fix needs maintainer security sign-off before merge. |
kodjima33
left a comment
There was a problem hiding this comment.
Reflected uid encoded across six plugin setup/auth pages, hermetic tests prove pre/post behavior. CI: Dart Analyze & Tests fails on stale-base (unrelated compile error, fixed on current main) — approved, not merged.
|
Follow-up on the earlier automated verification, which asked for maintainer sign-off on the security fix before merge: that request is now satisfied by @kodjima33's approval on this head, so nothing further is being asked of the contributor. Two closing notes:
No further action requested from automation; the merge decision rests with maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
kodjima33
left a comment
There was a problem hiding this comment.
Reflected-uid HTML/JS injection fix across 6 plugin setup pages; correct context-specific encoding (percent-encode for URLs, html.escape for attrs, JSON-safe escape for script), hermetic tests added.
|
Independent verification of the uid-encoding fix across the six plugin apps:
The red "Dart Analyze & Tests" check is unrelated to this PR: the errors are Two optional non-blocking follow-ups (both pre-existing): the OAuth callback error pages still reflect Nice fix — clear per-context encoding with a regression suite that demonstrably fails on the old code. This review was conducted by an AI reviewing agent on behalf of the maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…tup pages (#14581) 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 #13658 (six sibling apps) and #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]>
…ack pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in BasedHardware#14350 and PR BasedHardware#13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new
…ack pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in BasedHardware#14350 and PR BasedHardware#13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new
`GET /auth/whoop/callback?error=...` is unauthenticated. The current
`main` branch interpolates the `error` OAuth parameter directly into
`<p>{error}</p>` without `html.escape`, so an attacker can craft a URL
that injects arbitrary HTML/JS into the callback page (reflected XSS,
no preconditions).
Fix: add `import html` (stdlib, no new dependency) and replace
`<p>{error}</p>` with `<p>{html.escape(error or "", quote=True)}</p>`.
Deconfliction:
- PR BasedHardware#13658 encodes uid in redirect URLs (different sink, different lines)
- PR BasedHardware#14504 escapes str(e) in except block (different sink, different lines)
- This sink ({error} in <p>) is not covered by either open PR
…ge (#14603) (#14604) * fix(whoop-app): escape OAuth `error` parameter in callback failure page `GET /auth/whoop/callback?error=...` is unauthenticated. The current `main` branch interpolates the `error` OAuth parameter directly into `<p>{error}</p>` without `html.escape`, so an attacker can craft a URL that injects arbitrary HTML/JS into the callback page (reflected XSS, no preconditions). Fix: add `import html` (stdlib, no new dependency) and replace `<p>{error}</p>` with `<p>{html.escape(error or "", quote=True)}</p>`. Deconfliction: - PR #13658 encodes uid in redirect URLs (different sink, different lines) - PR #14504 escapes str(e) in except block (different sink, different lines) - This sink ({error} in <p>) is not covered by either open PR * test(whoop-app): hermetic regression for OAuth callback error escaping Six stdlib-only tests confirm that the `error` OAuth parameter is now HTML-escaped before insertion into <p>, and that benign error codes still render correctly. * style(whoop): normalize line endings to LF for clean 2-line diff * style(whoop): normalize test file line endings to LF
…hrefs
GET /auth/callback's error branch interpolated the client-controlled
`state` query param raw into <a href="/auth?uid={error_uid}">, and
GET / interpolated `uid` raw into <a href="{auth_url}">. A crafted
state like "><script>alert(1)</script> was reflected unescaped into
the 500 error page (reflected XSS on an unauthenticated route); a
bare & or # corrupted the retry link.
Percent-encode both values once at their reflection sites
(urllib.parse.quote), matching the hardening already applied to six
other plugin apps in PR BasedHardware#13658.
Verification:
- python3 plugins/test_uid_reflection_twitter.py -> 5 passed; on
unpatched main the suite fails at the script-tag reflection
assertion (regression test reproduces the issue first)
- real FastAPI TestClient round-trip on the patched app:
GET /auth/callback?code=x&state="><script>alert(1)</script>&x=1#frag
-> 500 page with uid=%22%3E%3Cscript%3E...%26x%3D1%23frag, no raw
script; GET /?uid='x" onmouseover="alert(1)&admin=1' -> attribute
intact, %22/%26 encoded; benign uid=user_123 still links
- registered plugin-twitter-app-uid-state-reflection-tests in
.github/checks-manifest.yaml (local + ci lanes)
Failure-Class: new
…n apps Seven plugin apps still reflected the client-controlled uid query parameter into URLs without encoding: HTML form actions and hrefs (dropbox, google-calendar), a hidden input value (google-calendar), and redirect targets (dropbox, hive, linear, ms365, shipbob, shopify). A uid containing a double quote breaks out of the attribute (reflected XSS on an unauthenticated page); a bare & or # corrupts the query handed to the next hop. The same hardening already landed for six apps in PR BasedHardware#13658 and for omi-twitter-app via BasedHardware#14350; this completes the sweep for the remaining apps. Each encoded value is computed once per handler (urllib.parse.quote, safe=''), and google-calendar's callback error page additionally HTML-escapes the client-controlled error parameter it renders. Verification: - python3 plugins/test_uid_reflection_remaining_apps.py -> 9 passed (hermetic: AST-driven per-app import stubbing; drives the real handlers - dropbox home connected/unconnected + disconnect, gcal root unconnected + disconnect + update-calendar + callback error page, hive/ms365/shipbob/shopify/linear disconnect or setup handlers, and linear's home template context) - registered plugin-remaining-apps-uid-reflection-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…ack pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in BasedHardware#14350 and PR BasedHardware#13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new
…lure pages Five plugin apps' OAuth callback failure branches interpolated dynamic strings into HTMLResponses without escaping: - omi-dropbox-app: token-exchange failure rendered the provider response body raw; the exception path rendered str(e) raw - omi-google-calendar-app: exception path rendered str(e) raw - omi-twitter-chat-tools-app: token-exchange failure rendered the provider response body raw; exception path rendered str(e) raw - omi-whoop-app: exception path rendered str(e) raw HTMLResponse defaults to text/html, so raw provider bodies or exception messages that embed a crafted URL execute as markup in the browser - the same reflected-content class as the uid fixes (BasedHardware#14350, BasedHardware#13658). Verification: - python3 plugins/test_callback_error_pages_escaped.py -> 6 passed (hermetic; drives the real callbacks through a failing token exchange and a raising transport, asserting the escaped form and no raw script) - registered plugin-callback-error-pages-escaped-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…setup page
GET / on omi-dropbox-app is unauthenticated and takes uid straight off the
query string, then renders it into href/action attributes:
<a href="/auth/dropbox?uid={uid}" class="btn">Connect Dropbox</a>
A uid of "><script>alert(1)</script> breaks out of the attribute and executes
on the plugin's origin. A bare & or # silently corrupts the query instead.
folder_name is a second, stored sink: the user sets it via POST /settings and
it is rendered back into value="{...}" with no escaping. display_name/email
from Dropbox and the auth-callback error page (which interpolated str(e)) are
escaped for the same reason.
Follows the encoding pattern of BasedHardware#13658, which fixed this class in six sibling
apps but did not cover omi-dropbox-app: quote(uid, safe="") for URL contexts,
html.escape() for text and attribute contexts.
Verified:
- plugins/omi-dropbox-app/test_uid_reflection.py — 6/6 pass on this head
- red→green: 5 of the 6 fail against main's plugin code (the sixth is the
"ordinary uid still renders" control, which passes both ways)
- registered as dropbox-uid-reflection-encoding-tests; manifest parses,
228 checks, no duplicate ids
Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>
|
Keeping this open on DIRTY + Dart Analyze red; six-app reflected uid encode + tests; kodjima APPROVE ≠ merge. kodjima APPROVE is the size gate, not maintainer merge. I am not approving or merging this SHA. |
…n apps Seven plugin apps still reflected the client-controlled uid query parameter into URLs without encoding: HTML form actions and hrefs (dropbox, google-calendar), a hidden input value (google-calendar), and redirect targets (dropbox, hive, linear, ms365, shipbob, shopify). A uid containing a double quote breaks out of the attribute (reflected XSS on an unauthenticated page); a bare & or # corrupts the query handed to the next hop. The same hardening already landed for six apps in PR BasedHardware#13658 and for omi-twitter-app via BasedHardware#14350; this completes the sweep for the remaining apps. Each encoded value is computed once per handler (urllib.parse.quote, safe=''), and google-calendar's callback error page additionally HTML-escapes the client-controlled error parameter it renders. Verification: - python3 plugins/test_uid_reflection_remaining_apps.py -> 9 passed (hermetic: AST-driven per-app import stubbing; drives the real handlers - dropbox home connected/unconnected + disconnect, gcal root unconnected + disconnect + update-calendar + callback error page, hive/ms365/shipbob/shopify/linear disconnect or setup handlers, and linear's home template context) - registered plugin-remaining-apps-uid-reflection-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…lure pages Five plugin apps' OAuth callback failure branches interpolated dynamic strings into HTMLResponses without escaping: - omi-dropbox-app: token-exchange failure rendered the provider response body raw; the exception path rendered str(e) raw - omi-google-calendar-app: exception path rendered str(e) raw - omi-twitter-chat-tools-app: token-exchange failure rendered the provider response body raw; exception path rendered str(e) raw - omi-whoop-app: exception path rendered str(e) raw HTMLResponse defaults to text/html, so raw provider bodies or exception messages that embed a crafted URL execute as markup in the browser - the same reflected-content class as the uid fixes (BasedHardware#14350, BasedHardware#13658). Verification: - python3 plugins/test_callback_error_pages_escaped.py -> 6 passed (hermetic; drives the real callbacks through a failing token exchange and a raising transport, asserting the escaped form and no raw script) - registered plugin-callback-error-pages-escaped-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…ack pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in BasedHardware#14350 and PR BasedHardware#13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new
kodjima33
left a comment
There was a problem hiding this comment.
Real reflected-uid HTML injection across six plugin setup pages (whoop, twitter-chat-tools, github, notion, clickup, slack), fixed with consistent percent-encoding/html.escape at each sink, hermetic test drives the real handlers pre/post fix. Only red check is the same pre-existing unrelated Dart compile error.
|
Verified on This stays the six-app reflected-uid vehicle. Whoop, twitter-chat-tools, github, notion, and clickup still interpolate raw Slack uid I am not approving or merging this SHA. GitHub reports CONFLICTING/DIRTY on kodjima APPROVE is the size gate, not merge. Dart Analyze is still the unrelated flake. |
…lure pages Five plugin apps' OAuth callback failure branches interpolated dynamic strings into HTMLResponses without escaping: - omi-dropbox-app: token-exchange failure rendered the provider response body raw; the exception path rendered str(e) raw - omi-google-calendar-app: exception path rendered str(e) raw - omi-twitter-chat-tools-app: token-exchange failure rendered the provider response body raw; exception path rendered str(e) raw - omi-whoop-app: exception path rendered str(e) raw HTMLResponse defaults to text/html, so raw provider bodies or exception messages that embed a crafted URL execute as markup in the browser - the same reflected-content class as the uid fixes (BasedHardware#14350, BasedHardware#13658). Verification: - python3 plugins/test_callback_error_pages_escaped.py -> 6 passed (hermetic; drives the real callbacks through a failing token exchange and a raising transport, asserting the escaped form and no raw script) - registered plugin-callback-error-pages-escaped-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…n apps Seven plugin apps still reflected the client-controlled uid query parameter into URLs without encoding: HTML form actions and hrefs (dropbox, google-calendar), a hidden input value (google-calendar), and redirect targets (dropbox, hive, linear, ms365, shipbob, shopify). A uid containing a double quote breaks out of the attribute (reflected XSS on an unauthenticated page); a bare & or # corrupts the query handed to the next hop. The same hardening already landed for six apps in PR BasedHardware#13658 and for omi-twitter-app via BasedHardware#14350; this completes the sweep for the remaining apps. Each encoded value is computed once per handler (urllib.parse.quote, safe=''), and google-calendar's callback error page additionally HTML-escapes the client-controlled error parameter it renders. Verification: - python3 plugins/test_uid_reflection_remaining_apps.py -> 9 passed (hermetic: AST-driven per-app import stubbing; drives the real handlers - dropbox home connected/unconnected + disconnect, gcal root unconnected + disconnect + update-calendar + callback error page, hive/ms365/shipbob/shopify/linear disconnect or setup handlers, and linear's home template context) - registered plugin-remaining-apps-uid-reflection-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…ack pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in BasedHardware#14350 and PR BasedHardware#13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new
|
Whoop, Twitter chat tools, and ClickUp setup URLs on main still interpolate a raw uid. This head quotes those. GitHub, Notion, and Slack hunks in the same diff are already encoded on main, so rebase — Astar, on behalf of @aryanorastar |
…ack error page (#14352) ## What The Twitter voice-posting plugin's OAuth callback error page (`plugins/omi-twitter-app/main_simple.py`, `GET /auth/callback`) now percent-encodes and HTML-escapes the `state` query param before building its "Try again" link, instead of reflecting the raw value into an `href` attribute. Fixes #14350. ## Why Any token-exchange failure renders the error page, and its link was `f'<a href="/auth?uid={error_uid}">'` with `error_uid = state`, where `state` is `Query(None)` straight from the request. On current `main`: ``` GET /auth/callback?code=x&state=%22%3E%3Cscript%3Ealert(1)%3C/script%3E -> <p><a href="/auth?uid="><script>alert(1)</script>">Try again</a></p> ``` The quote closes the attribute and the script executes on the plugin's origin (reflected XSS). The branch is reachable without any session: a `state` with no stored OAuth handler makes `get_access_token()` raise `OAuth session not found`, which is the path that renders the page. A benign `&` or `#` in `state` corrupted the retry query the same way. The value is now encoded at both boundaries it crosses — `urllib.parse.quote(value, safe="")` for the query, `html.escape(..., quote=True)` for the attribute — so the link still carries the original value (it round-trips through `parse_qs`) but can no longer break out of the `href`. ## Changes - `plugins/omi-twitter-app/main_simple.py`: import `html` and `urllib.parse.quote`; the callback error page interpolates `html.escape(quote(state, safe=""), quote=True)`. - Second commit (leave it better, same file): the setup page at `GET /?uid=` built its "Connect Twitter Account" link as `f"/auth?uid={uid}"` inside an `href` — the same raw reflection. Encoded the same way. omi-twitter-app is not among the six apps the pattern-wide PR #13658 covers; no overlap with that diff. Open PR #13782 also edits `main_simple.py`, but only its logging lines (hunks at `main` lines 222-231, 638-649, 665-671 and 697-752); this branch touches the import block, `root()` (`main_simple.py:29-35`) and the `auth_callback` error branch (`:523-536`), so the two do not overlap textually either. - `plugins/omi-twitter-app/test_callback_error_escaping.py` (new): hermetic regression test — stubs FastAPI, dotenv and the sibling modules, drives the real `auth_callback` handler down its error branch and the real `root` handler, parses the page with `html.parser` the way a browser would and pins that no `<script>` element opens, the `href` is percent-encoded, `&`/`#` cannot corrupt the query, and the uid round-trips; plain and missing `state` keep their links unchanged. - `.github/checks-manifest.yaml`: registers `twitter-app-callback-error-escaping-tests` (local + ci lanes, triggered by `plugins/omi-twitter-app/**`). ## Tests ``` PYTHONUTF8=1 python3 plugins/omi-twitter-app/test_callback_error_escaping.py PASS test_script_in_state_is_not_reflected_raw PASS test_try_again_link_round_trips_state PASS test_plain_state_link_is_unchanged PASS test_missing_state_falls_back_to_unknown PASS test_setup_page_encodes_uid_in_connect_link 5 tests passed ``` Same test against `main`'s `main_simple.py` fails as intended (control cases pass): ``` FAIL test_script_in_state_is_not_reflected_raw: ... <a href="/auth?uid="><script>alert(1)</script>">Try again</a> ... FAIL test_try_again_link_round_trips_state: ('"><script>alert(1)</script>', '/auth?uid=') PASS test_plain_state_link_is_unchanged PASS test_missing_state_falls_back_to_unknown FAIL test_setup_page_encodes_uid_in_connect_link: ['/auth?uid='] ``` Also run: `python3 plugins/oauth/test_client_log_safety.py` (OK, 5 tests), `git diff --check main..fix/twitter-app-callback-xss` (clean), `bash scripts/pr-preflight --pr-body-file <this body>` (passed). The live path (a real Twitter OAuth round trip on a deployed instance with client credentials) needs a Railway deployment and X app keys I do not have; the handlers were exercised through the hermetic harness above, which calls the real functions with only FastAPI and the network-bound siblings stubbed. ## Failure-Class Failure-Class: none (`scripts/failure-class prepare` validates the declaration (`OK: prepare`, patch operation=none) and none of the 253 registry definitions describes client input reflected unescaped into HTML; the advisory candidates it surfaced for this path — nonexecuting-verification-command, runtime-image-boundary, secret-printed-to-plugin-logs — do not apply.) ## Invariants `scripts/pr-preflight --suggest` reports no affected product invariants for this diff (plugin-only change). ## Bounty Claims the US$25 proposed in #14350; payout details will be sent to [email protected] after merge as the Contribution guide asks. <sub>Authored with Claude Code on behalf of @Suyann; every command listed was actually run on this branch.</sub> <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/14352?utm_source=github" target="_blank" rel="noopener noreferrer" data-no-image-dialog="true"><picture><source media="(prefers-color-scheme: dark)" srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source media="(prefers-color-scheme: light)" srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img alt="Review in cubic" src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a> <!-- End of auto-generated description by cubic. -->
…setup page
GET / on omi-dropbox-app is unauthenticated and takes uid straight off the
query string, then renders it into href/action attributes:
<a href="/auth/dropbox?uid={uid}" class="btn">Connect Dropbox</a>
A uid of "><script>alert(1)</script> breaks out of the attribute and executes
on the plugin's origin. A bare & or # silently corrupts the query instead.
folder_name is a second, stored sink: the user sets it via POST /settings and
it is rendered back into value="{...}" with no escaping. display_name/email
from Dropbox and the auth-callback error page (which interpolated str(e)) are
escaped for the same reason.
Follows the encoding pattern of BasedHardware#13658, which fixed this class in six sibling
apps but did not cover omi-dropbox-app: quote(uid, safe="") for URL contexts,
html.escape() for text and attribute contexts.
Verified:
- plugins/omi-dropbox-app/test_uid_reflection.py — 6/6 pass on this head
- red→green: 5 of the 6 fail against main's plugin code (the sixth is the
"ordinary uid still renders" control, which passes both ways)
- registered as dropbox-uid-reflection-encoding-tests; manifest parses,
228 checks, no duplicate ids
Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>
…n apps (#14502) * fix(plugins): percent-encode reflected uid across the remaining plugin apps Seven plugin apps still reflected the client-controlled uid query parameter into URLs without encoding: HTML form actions and hrefs (dropbox, google-calendar), a hidden input value (google-calendar), and redirect targets (dropbox, hive, linear, ms365, shipbob, shopify). A uid containing a double quote breaks out of the attribute (reflected XSS on an unauthenticated page); a bare & or # corrupts the query handed to the next hop. The same hardening already landed for six apps in PR #13658 and for omi-twitter-app via #14350; this completes the sweep for the remaining apps. Each encoded value is computed once per handler (urllib.parse.quote, safe=''), and google-calendar's callback error page additionally HTML-escapes the client-controlled error parameter it renders. Verification: - python3 plugins/test_uid_reflection_remaining_apps.py -> 9 passed (hermetic: AST-driven per-app import stubbing; drives the real handlers - dropbox home connected/unconnected + disconnect, gcal root unconnected + disconnect + update-calendar + callback error page, hive/ms365/shipbob/shopify/linear disconnect or setup handlers, and linear's home template context) - registered plugin-remaining-apps-uid-reflection-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new * test(omi-hive-app): update create-task fixture to the (project, candidates) contract find_project_by_name returns (project, candidates) since the disambiguation work, but test_create_task_success still stubbed the old single-project return, so the handler raised TypeError on the unpack and the lane has been red on main for every hive change. Repair the fixture, restore the lane to green: - python3 plugins/omi-hive-app/test_main.py -> 7 tests OK * fix: drop duplicate gcal-uid-reflection-encoding-tests manifest id * test: stub fastapi.Depends so shipbob uid-reflection suite imports --------- Co-authored-by: omi-bounty-contributor <[email protected]>
…ack pages (#14503) * fix(plugins): html-escape reflected OAuth error params in three callback pages The OAuth callback error branches of omi-dropbox-app, omi-ms365-app, and omi-notion-app interpolated the client-controlled error and error_description query parameters into HTML without escaping, so a crafted callback URL (e.g. error=<script>alert(1)</script>) is a reflected-XSS vector on an unauthenticated route. Same class as the uid reflections fixed in #14350 and PR #13658, via the error fields. Verification: - python3 plugins/test_oauth_error_params_escaped.py -> 3 passed (hermetic; drives the real auth_callback / notion_callback handlers through a hostile error value per app) - same suite against unpatched main.py files -> dropbox fails at the script-reflection assertion (execution stops at the first failure) Failure-Class: new * fix: put oauth-error-params check under checks:, valid YAML --------- Co-authored-by: omi-bounty-contributor <[email protected]>
…lure pages Five plugin apps' OAuth callback failure branches interpolated dynamic strings into HTMLResponses without escaping: - omi-dropbox-app: token-exchange failure rendered the provider response body raw; the exception path rendered str(e) raw - omi-google-calendar-app: exception path rendered str(e) raw - omi-twitter-chat-tools-app: token-exchange failure rendered the provider response body raw; exception path rendered str(e) raw - omi-whoop-app: exception path rendered str(e) raw HTMLResponse defaults to text/html, so raw provider bodies or exception messages that embed a crafted URL execute as markup in the browser - the same reflected-content class as the uid fixes (BasedHardware#14350, BasedHardware#13658). Verification: - python3 plugins/test_callback_error_pages_escaped.py -> 6 passed (hermetic; drives the real callbacks through a failing token exchange and a raising transport, asserting the escaped form and no raw script) - registered plugin-callback-error-pages-escaped-tests in .github/checks-manifest.yaml (local + ci lanes) Failure-Class: new
…setup page
GET / on omi-dropbox-app is unauthenticated and takes uid straight off the
query string, then renders it into href/action attributes:
<a href="/auth/dropbox?uid={uid}" class="btn">Connect Dropbox</a>
A uid of "><script>alert(1)</script> breaks out of the attribute and executes
on the plugin's origin. A bare & or # silently corrupts the query instead.
folder_name is a second, stored sink: the user sets it via POST /settings and
it is rendered back into value="{...}" with no escaping. display_name/email
from Dropbox and the auth-callback error page (which interpolated str(e)) are
escaped for the same reason.
Follows the encoding pattern of BasedHardware#13658, which fixed this class in six sibling
apps but did not cover omi-dropbox-app: quote(uid, safe="") for URL contexts,
html.escape() for text and attribute contexts.
Verified:
- plugins/omi-dropbox-app/test_uid_reflection.py — 6/6 pass on this head
- red→green: 5 of the 6 fail against main's plugin code (the sixth is the
"ordinary uid still renders" control, which passes both ways)
- registered as dropbox-uid-reflection-encoding-tests; manifest parses,
228 checks, no duplicate ids
Failure-Class: none
Co-Authored-By: Claude Opus 5 <[email protected]>
|
Keeping this open. Not approving — Astar, on behalf of @aryanorastar |
aryanorastar
left a comment
There was a problem hiding this comment.
be3204d87f7e — plugins/omi-clickup-app/main.py, plugins/omi-github-app/main.py, and plugins/omi-slack-app/main.py still render Failed to complete authentication: {str(e)}. That detail has to be a fixed string.
…setup page (#14578) (#14579) * fix(dropbox-app): encode reflected uid and escape stored settings in setup page GET / on omi-dropbox-app is unauthenticated and takes uid straight off the query string, then renders it into href/action attributes: <a href="/auth/dropbox?uid={uid}" class="btn">Connect Dropbox</a> A uid of "><script>alert(1)</script> breaks out of the attribute and executes on the plugin's origin. A bare & or # silently corrupts the query instead. folder_name is a second, stored sink: the user sets it via POST /settings and it is rendered back into value="{...}" with no escaping. display_name/email from Dropbox and the auth-callback error page (which interpolated str(e)) are escaped for the same reason. Follows the encoding pattern of #13658, which fixed this class in six sibling apps but did not cover omi-dropbox-app: quote(uid, safe="") for URL contexts, html.escape() for text and attribute contexts. Verified: - plugins/omi-dropbox-app/test_uid_reflection.py — 6/6 pass on this head - red→green: 5 of the 6 fail against main's plugin code (the sixth is the "ordinary uid still renders" control, which passes both ways) - registered as dropbox-uid-reflection-encoding-tests; manifest parses, 228 checks, no duplicate ids Failure-Class: none Co-Authored-By: Claude Opus 5 <[email protected]> * fix(dropbox-app): escape auth_callback error and token-exchange sinks (#14578) Addresses aryanorastar review on #14579: the two remaining unauthenticated HTML sinks in /auth/dropbox/callback are now escaped the same way as the 500 handler — `error_description or error` (reflected OAuth params) and the token-exchange failure body (provider-supplied response.text) both go through html.escape(..., quote=True). Tests: 3 new hermetic cases in test_uid_reflection.py prove the <script>alert(1)</script> payload cannot appear raw in either body (9 tests, all passing). Failure-Class: none --------- Co-authored-by: Claude Opus 5 <[email protected]>
Summary
The client-controlled
uidquery param was reflected raw into HTML on the connect/setup pages of six plugins —auth_url = f"/auth?uid={uid}"rendered inside<a href="{auth_url}">, plus disconnect/back links,RedirectResponsetargets,fetch()URLs, avalue="{uid}"attribute, and a JS string literal in github's page:omi-whoop-app,omi-twitter-chat-tools-app,omi-github-app,omi-notion-app,omi-clickup-app,omi-slack-appuid=x" onmouseover="alert(1)breaks thehrefattribute — verified end-to-end: the raw payload reaches the rendered page.&,#,?in a uid also corrupt the query param handed to the auth flow.Each affected handler now percent-encodes
uidonce (uid_q = quote(uid, safe="")) for URL/href contexts; github's JS object literal usesjson.dumps(uid); thevalue=attributes in the clickup/slack test pages usehtml.escape. Stats/logging paths keep the raw uid.Verification
plugins/test_uid_reflection.py(new, hermetic, registered asplugin-uid-reflection-encoding-testsin.github/checks-manifest.yaml) loads each plugin'smain.pywith stubbed FastAPI/db/storage imports and drives the realroot()handler on the not-connected branch:uid='x" onmouseover="alert(1)&admin=1': on the old code every plugin emits a brokenhref(" onmouseover=survives — assertion fails on all six); with the fix the page carriesx%22%20onmouseover%3D...uid=user_123still producesuid=user_123links in all six pages2/2 pass covering all six plugins; the injection assertion fails on the original code.
Failure-Class: none