omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(semantic-scholar-app): exception text leaks into chat tool responses across 3 endpoints ($50 proposed)

Open NoYouDeal opened this issue 1 month ago • 1 comments

Following the contribution guide's invitation to propose paid work — @kodjima33, @josancamon19, would a US$50 bounty be appropriate for this? Proposed amount, not an existing award.

Product impact

• Primary loop layer: Security [✓] Internal host/network details reflected into chat tool responses (broken trust in the tool loop)

Symptom

plugins/omi-semantic-scholar-app returns raw exception strings ({exc}) to callers, reflecting internal socket errors, DNS resolver output, and host details into chat-tool responses:

• POST /tools/search_semantic_scholar_papers returns ChatToolResponse(error=f"Semantic Scholar request failed: {exc}") and error=f"Unexpected error: {exc}") • POST /tools/get_semantic_scholar_paper — same two patterns • POST /tools/get_semantic_scholar_author_papers — same two patterns

Transport failures (DNS/errno/timeouts from the plugin host) and any unexpected internal exception reach the chat model verbatim. The httpx.HTTPStatusError branches are already clean (status code only) and stay unchanged.

Fix (PR #22981)

For all three endpoints:

  • httpx.HTTPError (non-status transport failures) → fixed message "the API could not be reached. Please try again later."
  • unexpected Exception → fixed message "request failed unexpectedly. Please try again later." (never interpolated)
  • status mappings preserved: 404 → "Paper not found." / "Author not found."; other codes → Semantic Scholar API error: {code}

Tests

test_error_handling.py (hermetic, stdlib-only, api_get seam): 10 tests — transport sanitization for all 3 endpoints, 404/other status mappings preserved, unexpected-exception containment (internal paths/redis text must never surface), search happy path, empty-result behavior. Registered in .github/checks-manifest.yaml as semantic-scholar-error-handling-tests.

Precedent

Same failure class as CoinGecko (#15522), Google Calendar (#15493), Shopify (#15484 / #15485), ClickUp (#15361 / #15360), Slack (#15471 / #15469), Whoop (#15477 / #15476), and arXiv app (#15587) hardening.

Disclosed: authored with AI assistance (Z.ai agent swarm).

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

PR: #22981

NoYouDeal avatar Oct 21 '26 05:10 NoYouDeal

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 12:10 undivisible