omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(ms365-app): prevent internal exception leaks and sanitize tool dispatch error responses ($50 proposed)

Open gewenbo888 opened this issue 2 months ago • 4 comments

Following the contribution guide's invitation to propose paid work — @kodjima33, @josancamon19, would a US\ bounty be appropriate for this? Proposed amount, not an existing award. Fix and hermetic tests are already submitted and verified in PR #15601.

Symptom

In plugins/omi-ms365-app/main.py, the _auth_guard helper and tool_dispatch endpoint previously risked leaking internal exception text, OAuth descriptions, and stack traces into user-facing HTTP responses:

  1. _auth_guard caught auth.AuthError as e and raised HTTPException(401, f"Microsoft not connected — {e}"), reflecting upstream OAuth error strings directly into the client response.
  2. In tool_dispatch, TypeError as e was caught and reflected into HTTPException(400, f"Bad arguments for {tool_name}: {e}"), exposing Python argument names and internal traceback frames.
  3. Unexpected runtime errors or upstream Graph/network failures in tool handlers were completely unhandled at the dispatch boundary, leading to unhandled 500 runtime crashes.

What changed

  1. Sanitized Auth Guard: Updated _auth_guard to log full exception context server-side with log.warning while returning a fixed, clean user-facing detail ("Microsoft not connected — please connect in settings.").
  2. Sanitized Dispatch Errors: Sanitized TypeError handling to return clean f"Bad arguments for {tool_name}" and added structured HTTPException / Exception guards catching unexpected faults and Graph errors with server-side error logging (log.error(..., exc_info=True)).
  3. Hermetic Regression Test Suite: Added plugins/omi-ms365-app/test_error_handling.py (4 tests, passing under plain python3 -S) validating that token errors, internal IPs, credentials, and stack traces never leak across dispatch or auth boundaries.
  4. Checks Manifest: Registered ms365-error-handling-tests in .github/checks-manifest.yaml. All 52 plugin and hermetic tests pass.

PR: #15601 Destination: Base / EVM (gewenbo.eth / 0x240C74A953Fc04Fe8cD713c68b53e94d9b449F8C)

gewenbo888 avatar Sep 22 '26 01:09 gewenbo888

Claiming this proposal. Implementing exception sanitization + hermetic tests.

Payout (PayPal): [email protected]

Ljunqiang avatar Sep 23 '26 05:09 Ljunqiang

Standing down this claim — on closer look the linked PRs are already up (#15601 / #15599 / #15587 by @gewenbo888, or already merged for wikipedia). Not competing with an existing delivery. PayPal claim withdrawn for this issue.

Ljunqiang avatar Sep 23 '26 05:09 Ljunqiang

This task is already completed and submitted via PR #15601 by @gewenbo888.

  • Current Blocker: None (PR submitted, awaiting maintainer review).
  • Acceptance Criterion: Full hermetic regression test suite passing (52/52 tests), OAuth and tool dispatch exceptions sanitized.
  • Confirmed Payout Path: EVM (Base Mainnet): 0x240C74A953Fc04Fe8cD713c68b53e94d9b449F8C (gewenbo.eth)

@autonoma-avalix Please note this task is already delivered.

gewenbo888 avatar Sep 27 '26 01:09 gewenbo888

Thanks for putting this together. We aren't doing bounties at the moment, so we're closing the bounty proposal issues for now — thanks for the fix! 🙏

undivisible avatar Oct 22 '26 11:10 undivisible