Repository navigation
fix(shopify-app): stop leaking internal exception text into HTTP and chat tool responses - #15484
Conversation
|
Bounty proposal for this fix: #15485 ($50 proposed). |
…chat tool responses
cfa29af to
ec9ea4c
Compare
aryanorastar
left a comment
There was a problem hiding this comment.
Shopify shopify_api_request plus the tool excepts still interpolate str(e) on main. This head closes that class with hermetic tests. Complementary to hmac/uid/setup vehicles on the same file, not a later copy.
Not merging. MERGE=0.
|
Verified end to end: ran the new suite locally in a clean environment - 8/8 pass, and the sentinel exception text (including a fake secrets-path trace) shows up only in server-side logs, never in a response. Per file:
Consistent with the recent ClickUp/Slack/Whoop/GitHub app hardening series, and a human maintainer has already approved this head. From my side this is ready - the merge decision (and the companion bounty proposal in #15485) remains a maintainer call. 🤖 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 |
Summary
plugins/omi-shopify-appreturned raw exception text to its callers. The sharedshopify_api_requesthelper answered anyrequestsfailure withf"Request failed: {str(e)}", and all six chat-tool handlers answered any unhandled exception withf"...: {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.pyis loaded against stubfastapi/requests/db/modelsmodules 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 nostr(e)/str(exc)response interpolation remains inmain.py.Registered as
shopify-error-handling-testsin.github/checks-manifest.yaml.Verification
Against
origin/mainmain.pythe new suite fails 8/8 (each response contains the sentinel trace).Failure-Class: none