Repository navigation
fix(plugins): html-escape provider and exception strings in OAuth failure pages - #14504
tluangtea-lab wants to merge 1 commit into
Conversation
|
Verified end to end — this is a clean, complete fix. Thank you @tluangtea-lab! Per-file review (all 7 changed files):
I also scanned every plugins/*/main.py for other HTMLResponse f-string interpolations: no remaining raw response.text/str(e) reflections; the only unescaped ones left are integer status codes. Failure-Class: new is the correct classification here. Not submitting a formal approval since this modifies OAuth callback failure paths — leaving merge sign-off on that auth surface to a human maintainer. The change itself looks correct and is well pinned by tests. AI-generated 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 |
kodjima33
left a comment
There was a problem hiding this comment.
Confirmed reflected-XSS on main: raw f-string interpolation of response.text/str(e) into HTMLResponse in dropbox/google-calendar/twitter/whoop OAuth failure pages. Narrow html.escape fix + hermetic regression suite, 5/5. Merging.
`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
b60b3a0 to
9b19b4d
Compare
9b19b4d to
d3702df
Compare
kodjima33
left a comment
There was a problem hiding this comment.
Confirmed real reflected-XSS in OAuth failure pages, 5/5, but DIRTY (conflict) -- approve only.
…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
d3702df to
97e711c
Compare
|
Verified on Leaving this open as the remaining-hole vehicle on Not approving from here: hosted checks are not green (0-check / UNSTABLE / FTC). kodjima APPROVE is not a merge. I am not merging. |
97e711c to
fa0979c
Compare
fa0979c to
21816ef
Compare
aryanorastar
left a comment
There was a problem hiding this comment.
Dropbox, Google Calendar, Twitter, and Whoop OAuth pages on main still interpolate raw exception text into HTML. This head escapes those four, and the regression test pins a script payload. Hygiene is green on 909b9bbaec90.
…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
909b9bb to
2527f91
Compare
|
OAuth error-page escaping on — Astar, on behalf of @aryanorastar |
|
Thanks for the clarification. I audited the overlap against the single-app keep series and confirmed that the four-app scope of #14504 is largely subsumed by #15476 (Whoop), #15493 (Google Calendar), #15497 (Dropbox), and #15517 (Twitter). I also confirmed that the remaining Twitter token-exchange response.text sink is already identified in #15517, so I won't duplicate that work in a separate PR. I'm therefore closing #14504 as superseded and will keep any remaining fixes within the canonical single-app PRs. |
|
Hey @tluangtea-lab 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
html.escape provider response bodies and exception strings on OAuth failure pages in dropbox, google-calendar, twitter-chat-tools, and whoop apps.
Verification
python3 plugins/test_callback_error_pages_escaped.py— 6 passed.plugin-callback-error-pages-escaped-testsin.github/checks-manifest.yaml.Failure-Class: new