Repository navigation
fix(dropbox-app): encode reflected uid and escape stored settings in setup page (#14578) - #14579
Conversation
|
/claim #14578 PayPal: [email removed] Alternative rail if that one is awkward — USDC on Base: |
…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]>
|
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.
Follow-up (pre-existing on main, not introduced here): 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 |
|
Encoding on Please rebase onto current main and union the manifest entry — do not resolve that file in the web editor. Leave Heads-up: #14502 also percent-encodes Dropbox The leftover |
aryanorastar
left a comment
There was a problem hiding this comment.
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:
error_description or erroris still interpolated into<p>{...}</p>with nohtml.escape.- 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.
…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
8a1824c to
57c1174
Compare
…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
|
Addressed in
|
|
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. |
|
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
left a comment
There was a problem hiding this comment.
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.
|
Dropbox setup on main still interpolates stored settings such as — Astar, on behalf of @aryanorastar |
…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
0d7f2e7 to
b3aa017
Compare
|
Dropbox settings XSS is real, but — Astar, on behalf of @aryanorastar |
…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
b3aa017 to
a03b1da
Compare
aryanorastar
left a comment
There was a problem hiding this comment.
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.
|
Verified this head independently:
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 |
What changed and why
GET /onomi-dropbox-appis unauthenticated and readsuidstraight off the query string, then renders it into HTML attributes with no encoding:Requesting
/?uid="><script>alert(1)</script>breaks out of thehrefattribute and executes script on the plugin's origin (reflected XSS). A benign&or#inuidsilently corrupts the query instead of erroring.There is a second, stored sink on the same page:
folder_nameis set by the user throughPOST /settingsand rendered straight back intovalue="{...}".display_name/email(from Dropbox) and the auth-callback error page (which interpolatedstr(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 coveromi-dropbox-app:quote(uid, safe="")for URL contexts (three HTML attributes plus the threeRedirectResponsetargets)html.escape()for text and attribute contextsNo behaviour change for ordinary ids:
/?uid=abc123still 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 realget_home_page_html: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.&/#query corruption, the storedfolder_namesink, Dropbox-supplieddisplay_name/email, and the ordinary-uid control.dropbox-uid-reflection-encoding-testsin.github/checks-manifest.yaml(triggers onplugins/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