Repository navigation
fix(whoop-app): escape callback error and quote uid across OAuth endpoints - #20399
kaleidoscopeAI wants to merge 3 commits into
Conversation
15c8b23 to
2e7a681
Compare
|
CI is green on this head — ready to merge. Head: Fix (plugins/omi-whoop-app/main.py): HTML-escape the OAuth callback Tests (plugins/omi-whoop-app/test_settings_page_encoding.py): 6 hermetic tests driving hostile error/uid values through the real handlers, asserting escaped forms, percent-encoding, and intact attributes — registered as Failure-Class: FC-oauth-error-params-reflected-into-html Fresh branch off current main ( |
|
Verified the security fix end to end and ran the new hermetic suite locally (6/6 passing) - nice work, and thanks for rebasing onto current main so CI could actually run. Per-file notes:
Housekeeping: this supersedes #14891 (same change, older merge base) - a maintainer may want to close that one in favor of this. Since this touches the OAuth/uid flow, leaving formal sign-off to a human maintainer; the security-sensitive auth-surface change needs maintainer review before merge. Feedback generated by review 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 |
|
Verified end-to-end against Per file:
Relationship to #14891: I verified this branch carries the identical security changes (the test file is byte-identical; the escapes are unchanged) rebased onto current main, with the old branch's stale-base problem gone. Since #14891 was previously kept open deliberately as a landing vehicle, which PR lands is a maintainer call — once one is chosen, the other can be closed with credit. This touches the OAuth callback/auth surface, so it needs maintainer sign-off before merge despite the verified fix; the positive signal stands. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Match the notion-app hardening: a truthy non-string `error` was previously ignored (`if error and isinstance(error, str)`) and could fall through to token exchange when code/state were present. Treat any truthy error as terminal and escape it when it is a string. Add a regression test asserting no token exchange occurs for a non-string error.
|
Reviewed this head in full (head plugins/omi-whoop-app/main.py
plugins/omi-whoop-app/test_settings_page_encoding.py — clean hermetic design: framework-only stubs, no third-party deps, no network, and assertions check both escaped output present and raw payload absent. .github/checks-manifest.yaml — Two small PR-description notes (non-blocking): main already escaped the callback This is a genuine, well-tested hardening of a reflected-XSS surface — thank you. Since it modifies the OAuth callback/disconnect flow, I'm keeping by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
On 016ba1aba6142e2585829039164b39f05d4a6c20, plugins/omi-whoop-app/main.py still returns html.escape(str(e)) in the callback 500. Use a fixed message.
|
The production change is correct, well scoped, and the fixed 500 message requested in the earlier maintainer review is now in place — leaving formal sign-off to a human maintainer since this is an auth-flow security fix. plugins/omi-whoop-app/main.py
plugins/omi-whoop-app/test_settings_page_encoding.py
.github/checks-manifest.yaml
Security: closes reflected-XSS and URL-injection paths in the Whoop OAuth plugin. UX: OAuth failures now show a generic message instead of raw exception text (the exception type is still logged server-side). Blast radius: USER IMPACT: Whoop connect/disconnect pages can no longer be tricked into rendering attacker-controlled text or links via crafted uid/error parameters; OAuth errors show a clean generic message. Nothing blocking from my side. Since the earlier human review was filed against a previous head and its specific concern is addressed here, leaving re-review and sign-off with the maintainer. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
Resolves #14890
Fresh branch off current main (
d536878). The original branch wascut from an older main and could no longer compute mergeability, so
its checks never ran; this rebase restores a clean merge base so CI
runs.
Summary
Hardens
plugins/omi-whoop-app/main.pyagainst reflected XSS andparameter injection:
HTML Escaping: escapes the
errorquery parameter in the OAuthcallback error box (
safe_error = html.escape(error)) and theexception string in the OAuth exception handler
(
Authentication error: {safe_error}), plusisinstance(..., str)guards on the callback query params.
URL Encoding & Attribute Escaping: quotes
uidviaquote(uid, safe='')in the connect link (auth_url), disconnectlink, and continue-to-settings link; escapes every href attribute
target with
html.escape(..., quote=True); quotesuidin the/disconnectRedirectResponse.Hermetic Regression Suite: adds
plugins/omi-whoop-app/test_settings_page_encoding.py(6 tests)covering connect-URL quoting, disconnect-link escaping, reflected
callback-error escaping, callback-success URL quoting, exception
message escaping, and redirect quoting. Registered as
whoop-app-settings-encoding-testsin.github/checks-manifest.yaml.Note on the manifest
Only
whoop-app-settings-encoding-testsis registered. Thecompanion
test_whoop_hardening.pydoes a barefrom main importthat requires real fastapi/requests/dotenv, so it cannot run in the
hermetic pyyaml-only Hygiene lane; registering it would turn CI red.
The security fix itself is fully covered by the hermetic suite above.
Verification
fastapi/requests/dotenv/db/models so it runs in the hermetic lane.
whoop-weekly-summary-hardening-tests, whoop-app-settings-encoding-tests).
test_disconnect_redirect_quotes_uid.Failure-Class: FC-oauth-error-params-reflected-into-html