Skip to content

fix(shopify-app): stop leaking internal exception text into HTTP and chat tool responses - #15484

Merged
aryanorastar merged 1 commit into
BasedHardware:mainfrom
kduailabs:fix/shopify-error-text-leak
Sep 22, 2026
Merged

aryanorastar merged 1 commit into
BasedHardware:mainfrom
kduailabs:fix/shopify-error-text-leak

Conversation

@kduailabs

@kduailabs kduailabs commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

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

Review in cubic

@kduailabs

Copy link
Copy Markdown
Contributor Author

Bounty proposal for this fix: #15485 ($50 proposed).

@kduailabs
kduailabs force-pushed the fix/shopify-error-text-leak branch from cfa29af to ec9ea4c Compare September 21, 2026 15:06

@aryanorastar aryanorastar left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@Git-on-my-level

Copy link
Copy Markdown
Member

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:

  • plugins/omi-shopify-app/main.py - all eight caught-exception paths that previously reflected str(e) into ChatToolResponse or the shopify_api_request error dict now log server-side and return fixed messages (analytics, orders, order details, create-order outer handler and token-auth block, customers, create-customer). I checked the head for residual leak surfaces: the only remaining str(e) (line 126) joins Shopify's own JSON errors entries from a 4xx body - provider-reported field text, not caught-exception internals - so that's fine to keep.
  • plugins/omi-shopify-app/test_error_handling.py - solid hermetic design: stub fastapi/requests/db/models keep it stdlib-only for CI, the real handlers are driven against raising seams, and the AST-based pin test checks the class of bug (an except handler interpolating the caught exception into a response) rather than exact strings, so it survives message rewording.
  • .github/checks-manifest.yaml - shopify-error-handling-tests is registered with the same triggers/lanes as the sibling shopify check; correct wiring.

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 need human response.

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution python labels Sep 21, 2026
@aryanorastar
aryanorastar merged commit 68e41b4 into BasedHardware:main Sep 22, 2026
41 of 42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

positive-signal Automation verified a genuine fix/quality contribution python

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants