Skip to content

fix(slack-app): prevent internal exception text from leaking into HTTP responses - #15469

Merged
kodjima33 merged 1 commit into
BasedHardware:mainfrom
Evos09:fix/slack-app-exception-leaks
Sep 21, 2026
Merged

kodjima33 merged 1 commit into
BasedHardware:mainfrom
Evos09:fix/slack-app-exception-leaks

Conversation

@Evos09

@Evos09 Evos09 commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Remediates sensitive exception leakage across HTTP response boundaries in plugins/omi-slack-app:

  1. OAuth Initialization (/auth): Internal exceptions during OAuth initialization now raise HTTPException(status_code=500, detail="OAuth initialization failed") instead of reflecting raw str(e) details to the client.
  2. Settings and Session Management: /update-channel, /refresh-channels, and /logout map unexpected internal exceptions to stable, user-facing error messages while maintaining server-side error logging.
  3. Webhook Payload Ingestion (/webhook): Malformed JSON parsing errors return clean HTTPException(status_code=400, detail="Invalid JSON payload").
  4. Chat-Tool Routes (/api/send_message, /api/search_messages, /api/search_channels): Unhandled exceptions now return generic {"error": "Internal server error"} at HTTP 500 rather than leaking raw exception strings.
  5. Slack Client SDK Boundary: Wraps WebClient initialization inside try/except blocks in send_message, get_channel_history, and search_messages, ensuring connection/credential exceptions do not escape unhandled.
  6. Hermetic Regression Suite: Added test_error_handling.py covering all 8 endpoints/methods with sensitive trace injection assertions, registered in .github/checks-manifest.yaml.

Verification

  • python plugins/omi-slack-app/test_error_handling.py: 9/9 passing.
  • Full Slack suite: 27/27 passing (test_channel_resolution.py, test_segments.py, test_slack_search.py, test_settings_page.py, test_error_handling.py).
  • Manifest check validation: test_run_checks.py passing (53 tests passed, 0 failures).

Failure-Class: none

Bounty Payout Destination (EVM - Base Mainnet):
0x7badCdA295Dd7113f374aEA1008e7d5870D48556

Review in cubic

…P responses

- Hide raw str(e) from OAuth initialization HTTPException detail
- Replace raw exception text in /update-channel, /refresh-channels, and /logout with generic stable client messages
- Sanitize /webhook JSON parsing HTTPException detail
- Return generic 'Internal server error' on unexpected failures across send_message, search_messages, and search_channels tool endpoints
- Catch WebClient initialization exceptions in SlackClient methods without leaking raw traceback details
- Add hermetic stdlib-only unit test suite test_error_handling.py and register in .github/checks-manifest.yaml

Failure-Class: none

@kodjima33 kodjima33 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.

Well-scoped fix: replaces raw exception string leakage with generic client-facing messages while preserving server-side logging, across all 8 endpoints named in issue #15471. Comprehensive hermetic test suite added. Confidence 5/5.

@kodjima33
kodjima33 merged commit bf41010 into BasedHardware:main Sep 21, 2026
1 check passed
aryanorastar added a commit that referenced this pull request Sep 22, 2026
…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. -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants