Skip to content

fix(dropbox-app): encode reflected uid and escape stored settings in setup page (#14578) - #14579

Merged
undivisible merged 2 commits into
BasedHardware:mainfrom
t3ratech:fix/dropbox-uid-reflection
Oct 19, 2026
Merged

undivisible merged 2 commits into
BasedHardware:mainfrom
t3ratech:fix/dropbox-uid-reflection

Conversation

@t3ratech

@t3ratech t3ratech commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

What changed and why

GET / on omi-dropbox-app is unauthenticated and reads uid straight off the query string, then renders it into HTML attributes with no encoding:

<a href="/auth/dropbox?uid={uid}" class="btn">Connect Dropbox</a>

Requesting /?uid="><script>alert(1)</script> breaks out of the href attribute and executes script on the plugin's origin (reflected XSS). A benign & or # in uid silently corrupts the query instead of erroring.

There is a second, stored sink on the same page: folder_name is set by the user through POST /settings and rendered straight back into value="{...}". display_name/email (from Dropbox) and the auth-callback error page (which interpolated str(e)) are escaped for the same reason.

This follows the encoding pattern established by #13658, which fixed this exact class in six sibling apps — omi-clickup-app, omi-github-app, omi-notion-app, omi-slack-app, omi-twitter-chat-tools-app, omi-whoop-app — but did not cover omi-dropbox-app:

  • quote(uid, safe="") for URL contexts (three HTML attributes plus the three RedirectResponse targets)
  • html.escape() for text and attribute contexts

No behaviour change for ordinary ids: /?uid=abc123 still renders /auth/dropbox?uid=abc123.

Product invariants affected

None. The change is confined to output encoding inside plugins/omi-dropbox-app/; no auth, storage, or tool-contract behaviour is altered.

How it was verified

plugins/omi-dropbox-app/test_uid_reflection.py — hermetic, stdlib-only, framework and sibling modules stubbed, exercising the real get_home_page_html:

  • 6/6 pass on this head.
  • red→green: 5 of the 6 fail against main's plugin code. The sixth (test_ordinary_uid_still_renders) is a control that passes both ways, so the suite proves the fix rather than just asserting current behaviour.
  • Coverage: the unauthenticated disconnected page, the connected page, &/# query corruption, the stored folder_name sink, Dropbox-supplied display_name/email, and the ordinary-uid control.
  • Registered as dropbox-uid-reflection-encoding-tests in .github/checks-manifest.yaml (triggers on plugins/omi-dropbox-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-dropbox-app/test_uid_reflection.py, registered in the checks manifest so a future edit to this plugin re-runs it. The red→green result above is the evidence it would have caught the bug.

Failure-Class: none

Fixes #14578

Review in cubic

@t3ratech

t3ratech commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor Author

/claim #14578 PayPal: [email removed]

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

kodjima33 pushed a commit that referenced this pull request Sep 18, 2026
…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]>

@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 reflected/stored XSS still present on main (unescaped uid/folder_name interpolation); fix scoped to omi-dropbox-app, matches sibling-app encoding pattern from #13658, tests added, CI green. 5/5.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified the encoding fix end to end - this closes the reflected and stored sinks from #14578 cleanly, and the test suite is built the right way.

plugins/omi-dropbox-app/main.py - all reflection sites are covered: the three attribute sinks in get_home_page_html (form action=/settings?uid=..., href=/disconnect?uid=..., href=/auth/dropbox?uid=...) now use quote(uid, safe=""), and the three RedirectResponse targets (auth_callback, disconnect, update_settings) do the same. display_name/email and the stored folder_name value="..." attribute go through html.escape(), as does the str(e) interpolation on the authorization error page. Ordinary ids still render byte-identically (/auth/dropbox?uid=abc123), so no behavior change for legitimate traffic.

plugins/omi-dropbox-app/test_uid_reflection.py - hermetic, stdlib-only, stubs the framework and sibling modules but exercises the real get_home_page_html. I re-ran it standalone: 6/6 pass on this head, and 5/6 fail against main's plugin code with the ordinary-uid control passing both ways - so the suite genuinely pins the fix rather than just asserting current behavior.

.github/checks-manifest.yaml - the new dropbox-uid-reflection-encoding-tests entry is wired consistently with the sibling app entries (local + ci lanes, trigger glob scoped to plugins/omi-dropbox-app/**).

Follow-up (pre-existing on main, not introduced here): auth_callback still renders {error_description or error} and the token-exchange {response.text} into HTML unescaped. Both are attacker/upstream-influenced and are the same output-encoding class fixed here, so they would be a natural follow-up issue or PR rather than scope creep on this one.

Already approved by kodjima33; no blockers from my side once the follow-up is tracked.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Sep 18, 2026
@aryanorastar

Copy link
Copy Markdown
Collaborator

Encoding on 78904c1 still looks right for #14578 (uid quote, stored folder_name + Dropbox display_name/email escaped, exception page escaped). I am not approving this SHA: it is CONFLICTING/DIRTY on .github/checks-manifest.yaml only.

Please rebase onto current main and union the manifest entry — do not resolve that file in the web editor. Leave plugins/omi-dropbox-app/main.py and test_uid_reflection.py as they are.

Heads-up: #14502 also percent-encodes Dropbox uid but does not close the stored folder_name (or display_name/email) sinks. This PR is still the one that actually fixes #14578; if #14502 lands first, keep the html.escape parts when you rebase.

The leftover error_description / token-exchange HTML sinks David noted are already #14503 / #14504. Please do not fold those in here.

@aryanorastar aryanorastar 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.

Uid/setup encoding on 78904c13 still looks right for #14578, and the generic except now uses html.escape(str(e)). Two unauthenticated auth_callback HTML sinks remain:

  1. error_description or error is still interpolated into <p>{...}</p> with no html.escape.
  2. Token-exchange failure still returns HTMLResponse(f"Token exchange failed: {response.text}").

Please escape both the same way as the 500 handler (html.escape(..., quote=True)) and extend test_uid_reflection.py so a payload like <script>alert(1)</script> cannot appear raw in those bodies.

#15022 is the OAuth-HTML vehicle for #14892 if you want a reference for the callback sinks. This PR remains the uid/setup-encoding vehicle for #14578.

t3ratech added a commit to t3ratech/omi that referenced this pull request Sep 20, 2026
…BasedHardware#14578)

Addresses aryanorastar review on BasedHardware#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
@t3ratech
t3ratech force-pushed the fix/dropbox-uid-reflection branch from 8a1824c to 57c1174 Compare September 20, 2026 15:29
t3ratech added a commit to t3ratech/omi that referenced this pull request Sep 20, 2026
…BasedHardware#14578)

Addresses aryanorastar review on BasedHardware#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
@t3ratech

Copy link
Copy Markdown
Contributor Author

Addressed in 57c1174 (rebased onto current main, manifest union-resolved):

  • error_description or error now goes through html.escape(..., quote=True) before interpolation into the authorization-failed page.
  • Token-exchange failure now returns html.escape(response.text, quote=True) in the HTMLResponse.
  • test_uid_reflection.py extended: the response stub now captures bodies, and three new hermetic cases prove <script>alert(1)</script> cannot appear raw in either sink (9/9 tests pass locally).

@t3ratech

Copy link
Copy Markdown
Contributor Author

Follow-up on the requested callback-sink fixes: head contains both changes and the three regression cases; local plugin harness is 9/9 green. GitHub currently reports with no conflict; the remaining state is only because this review is still . Please re-review this head when available. The payout comment remains on the PR.

@t3ratech

Copy link
Copy Markdown
Contributor Author

Follow-up on the requested callback-sink fixes: head 57c1174 contains both html.escape(..., quote=True) changes and the three regression cases; the local plugin harness is 9/9 green. GitHub currently reports MERGEABLE with no conflict; the remaining state is BLOCKED only because this review is still CHANGES_REQUESTED. Please re-review this head when available. The /claim #14578 payout comment remains on the PR.

@aryanorastar aryanorastar 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.

Encoding on 57c1174 matches the RC: error_description or error and token-exchange response.text go through html.escape(..., quote=True), and test_uid_reflection.py now covers both (9 tests). Uid quote(..., safe="") plus stored folder_name / Dropbox display_name/email escapes still close #14578.

Not merging this SHA. Hygiene is still the main tenacity miss in dropbox-token-refresh-and-tools-tests — that stays #15186, do not fold it here.

This main.py encoding now overlaps already-approved #15022. Land one of the two after #15186, not both.

No second ping for David.

@aryanorastar

Copy link
Copy Markdown
Collaborator

Dropbox setup on main still interpolates stored settings such as folder_name into the page. This head escapes that. 0d7f2e742194 is dirty, so rebase it. This stays open and unapproved.

— Astar, on behalf of @aryanorastar

t3ratech added a commit to t3ratech/omi that referenced this pull request Sep 22, 2026
…BasedHardware#14578)

Addresses aryanorastar review on BasedHardware#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
@t3ratech
t3ratech force-pushed the fix/dropbox-uid-reflection branch from 0d7f2e7 to b3aa017 Compare September 22, 2026 13:15
@aryanorastar

Copy link
Copy Markdown
Collaborator

Dropbox settings XSS is real, but b3aa017e61e4 is DIRTY and the error-page lines overlap #14504. Rebase before approval.

— Astar, on behalf of @aryanorastar

t3ratech and others added 2 commits September 23, 2026 11:45
…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]>
…BasedHardware#14578)

Addresses aryanorastar review on BasedHardware#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
@t3ratech
t3ratech force-pushed the fix/dropbox-uid-reflection branch from b3aa017 to a03b1da Compare September 23, 2026 09:47

@aryanorastar aryanorastar 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.

Dropbox setup still interpolates stored folder_name, display_name, and email. This head escapes them. test_uid_reflection.py pins test_stored_folder_name_is_escaped. Hygiene passed on a03b1dab910e.

@Git-on-my-level

Copy link
Copy Markdown
Member

Verified this head independently:

  • plugins/omi-dropbox-app/main.py — get_home_page_html() now escapes display_name/email and the stored folder_name (the POST /settings sink), and auth_callback() escapes error/error_description, the token-exchange body, and the exception text on the 500 page. uid was already percent-encoded at the merge base and still is. I scanned the rest of the file: remaining interpolations ({uid} in logs, {folder_name} in the Dropbox path, {error}/{str(e)} in JSON error fields) are non-HTML sinks — no unescaped HTML reflection left.
  • plugins/omi-dropbox-app/test_uid_reflection.py — ran the suite hermetically on this head: 9/9 pass, including coverage of the reflected uid, the stored folder_name, and the callback error paths.
  • Confirmed the folder_name/display_name/token-exchange escaping is still absent on main, so this isn't superseded.

Thanks @t3ratech — clean, well-scoped fix with real regression coverage. Human approval is already on this head; from automation's side this is merge-ready.


This review was produced by AI automation on behalf of the Omi maintainers.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible
undivisible merged commit 3bf104c into BasedHardware:main Oct 19, 2026
33 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bounty proposal] security: omi-dropbox-app reflects raw uid into setup-page HTML (reflected XSS) + stored folder_name sink ($75 proposed)

5 participants