Repository navigation
Conversation
kodjima33
left a comment
There was a problem hiding this comment.
Well-scoped fix: replaces raw exception string leakage with generic client-facing messages while preserving server-side logging, across OAuth and 7 chat-tool endpoints. Test suite added and error paths correctly wrapped. Confidence 5/5.
|
Thanks @Evos09 — focused, well-scoped hardening pass. I verified the change end to end and ran the new suite; two small non-blocking notes below. Verification
What's good
Two small notes (non-blocking)
Optional follow-up (pre-existing, not from this PR): the callback's token-exchange failure responses ( 🤖 Automated review 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 |
|
Thank you @kodjima33 and @Git-on-my-level for the thorough review and approval! Rebased onto current |
167c083 to
35f6015
Compare
aryanorastar
left a comment
There was a problem hiding this comment.
Whoop on main still returns str(e) from the API helper, chat tools, and OAuth HTML. This head clears those and the tests pin recovery, strain, and OAuth. Hygiene is green on 35f6015bb815.
…chat tool responses (#15484) ## Summary `plugins/omi-shopify-app` returned raw exception text to its callers. The shared `shopify_api_request` helper answered any `requests` failure with `f"Request failed: {str(e)}"`, and all six chat-tool handlers answered any unhandled exception with `f"...: {str(e)}"`. ## Impact Whatever internal detail the exception carried — provider/socket errors, filesystem paths, connection details — was reflected back into the chat-tool response the OMI backend hands to the model/client. Same failure class as the recent ClickUp app (#15361 / #15360), Slack app (#15471 / #15469), Whoop app (#15477 / #15476) and GitHub app (#13912) hardening. ## Fix - `shopify_api_request`: logs `❌ Shopify API request failed: {e}` server-side and returns `{"error": "Shopify API request failed"}`. - `tool_get_analytics`, `tool_get_orders`, `tool_get_order_details`, `tool_create_order` (outer handler and the token-auth block), `tool_get_customers`, `tool_create_customer`: log the exception detail server-side and answer with a fixed, non-reflective message. No behavior changes other than the error text; success paths are untouched. ## Tests `plugins/omi-shopify-app/test_error_handling.py` (new, stdlib-only: `main.py` is loaded against stub `fastapi`/`requests`/`db`/`models` modules and the real handlers are driven against raising seams). It asserts a sentinel trace (`/srv/app/.secrets/shopify_token_store.json`, the exception class name, `Traceback`) never reaches a response for the API helper and each of the six tool endpoints, and pins that no `str(e)`/`str(exc)` response interpolation remains in `main.py`. Registered as `shopify-error-handling-tests` in `.github/checks-manifest.yaml`. ## Verification ``` python3 plugins/omi-shopify-app/test_error_handling.py # 8 passed python3 plugins/omi-shopify-app/test_limit_inputs.py # ok python3 plugins/omi-shopify-app/test_create_order_disambiguation.py # ok python3 plugins/omi-shopify-app/test_create_order_pagination.py # ok python3 plugins/omi-shopify-app/test_oauth_callback_auth.py # ok ``` Against `origin/main` `main.py` the new suite fails 8/8 (each response contains the sentinel trace). Failure-Class: none <!-- This is an auto-generated description by cubic. --> <a href="https://cubic.dev/pr/BasedHardware/omi/pull/15484?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. -->
kodjima33
left a comment
There was a problem hiding this comment.
Verified: whoop-app OAuth+7 chat-tool handlers now return generic error text, raw exceptions only logged server-side; new test_error_handling.py asserts sensitive strings never leak. Scoped, real root cause. 5/5.
|
Whoop on main still returns — Astar, on behalf of @aryanorastar |
…P responses - Hide raw str(e) from /auth/whoop and whoop_api_request exception handlers - Return generic 'Failed to get ... due to an internal error.' across 7 chat tool endpoints (recovery, strain, sleep, workouts, weekly summary, body measurements, profile) - Sanitize whoop_callback OAuth error page to render themed error template without leaking raw exception string - Encapsulate state lookup and code exchange in whoop_callback within unified try-except block - Add hermetic stdlib-only unit test suite test_error_handling.py and register in .github/checks-manifest.yaml Failure-Class: none
35f6015 to
f33c207
Compare
|
Keeping this open on f33c207. Whoop on main still returns {"error": str(e)} and the chat tools interpolate {str(e)}. This head returns Whoop API request failed and fixed chat-tool strings. Desktop Swift is still queued, so merge is UNSTABLE. Not approving this SHA. — Astar, on behalf of @aryanorastar |
aryanorastar
left a comment
There was a problem hiding this comment.
Whoop still returns {"error": str(e)} and chat tools interpolate {str(e)}. This head returns Whoop API request failed and fixed chat-tool strings. Tests load main.py. Hygiene passed on f33c207ba954.
|
Verified on this head — solid, well-scoped hardening pass. Detail for the record:
One minor non-blocking note: the fixed Nice work — thanks for the careful remediation. — automated maintainer review, posted 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 |
|
Closing and withdrawing this pull request. Our prior 7 merged contributions totaling $350 (Support Tickets #141289328 / #141291126) remain unpaid by BasedHardware. We are freezing all pending contributions. |
|
Hey @Evos09 👋 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! |
Summary
Remediates sensitive exception leakage across HTTP and Chat-Tool response boundaries in
plugins/omi-whoop-app:/auth/whoop): Encapsulates state generation and storage in a protected execution block. Unexpected exceptions raiseHTTPException(status_code=500, detail="OAuth initialization failed")instead of leaking internal trace or database errors./auth/whoop/callback): Encapsulates state retrieval, state deletion, and token exchange inside a unified try-except block. Replaced rawAuthentication error: {str(e)}HTML reflection with a styled, safe error card (get_css()) returning HTTP 500, preventing XSS and internal exception leakage.whoop_api_request): Replaced{"error": str(e)}with sanitized{"error": "Whoop API request failed"}to ensure network socket errors, internal IPs, and credentials do not propagate to callers./tools/get_recovery/tools/get_strain/tools/get_sleep/tools/get_workouts/tools/get_weekly_summary/tools/get_body_measurements/tools/get_profileAll tool endpoints now return fixed, stable
ChatToolResponse(error="Failed to get <feature> due to an internal error.")while maintaining server-side error logging.test_error_handling.pycovering all 9 endpoints/methods with sensitive trace injection assertions, registered in.github/checks-manifest.yaml.Verification
python plugins/omi-whoop-app/test_error_handling.py: 10/10 passing.test_callback_error_escaped.py,test_error_handling.py,test_get_workouts.py,test_main.py,test_measurements_and_summary_hardening.py,test_weekly_summary.py,test_whoop_hardening.py).test_run_checks.pypassing (53 tests passed, 0 failures).Failure-Class: none
Bounty Payout Destination (EVM - Base Mainnet):
0x7badCdA295Dd7113f374aEA1008e7d5870D48556