omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(usgs-earthquake): prevent internal exception leaks and sanitize chat tool 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 #15599.

Symptom

When upstream USGS network errors, timeouts, or unhandled runtime exceptions occur in plugins/omi-usgs-earthquake-app, _usgs_get previously reflected raw {exc} string values into {"error": f"USGS request failed: {exc}"}, risking exposure of private IPs, proxy parameters, and hostnames to the LLM chat context. Additionally, endpoints /tools/recent_earthquakes, /tools/nearby_earthquakes, and /tools/earthquake_details lacked top-level exception guards against unforeseen runtime faults.

What changed

  1. Exception Sanitization: Refined _usgs_get exception handling to log detailed errors internally via logger while returning safe, sanitized error strings ("USGS request failed due to a network error.", "USGS request failed: invalid non-JSON response.", etc.) that preserve API contract expectations without exposing internal stack or transport details.
  2. Endpoint Crash Prevention: Added top-level try...except Exception blocks to tool_recent_earthquakes, tool_nearby_earthquakes, and tool_earthquake_details returning graceful ChatToolResponse(success=False, ...) upon unexpected runtime errors.
  3. Comprehensive Leak Prevention Tests: Added plugins/omi-usgs-earthquake-app/test_error_handling.py (6 test cases) testing sensitive internal IP, token, and credential masking across all USGS chat tools.
  4. Hermetic Test Compatibility: Updated test_main.py stubs to support HTTPStatusError, RequestError, and TimeoutException.
  5. CI Checks Manifest: Registered usgs-earthquake-error-handling-tests in .github/checks-manifest.yaml. All 44 tests pass hermetically.

PR: #15599 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 #15599 by @gewenbo888.

  • Current Blocker: None (PR submitted, awaiting maintainer review).
  • Acceptance Criterion: Full hermetic test suite passing (44/44 tests), all USGS chat tool endpoints 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