Repository navigation
fix(retrieval): sanitize unexpected exception leakage in fetch url tool - #19616
naufalfx805-source wants to merge 1 commit into
Conversation
- Mask raw exception detail in fetch_url_tool with a safe generic error message - Keep logger.error server-side logging for diagnostics while preventing infrastructure, network, and traceback disclosure to the model and user - Add hermetic unit tests in test_fetch_url_tool_sanitization.py verifying error masking and preservation of validation errors
4df34da to
a22fd74
Compare
|
Reviewed — this is a clean, well-scoped hardening of the fetch_url_tool error path, and it matches the acceptance intent of #19617. backend/utils/retrieval/tools/web_tools.py — the change is exactly right: the broad backend/tests/unit/test_fetch_url_tool_sanitization.py — good hermetic coverage using the repo's Only minor observation, non-blocking: callers of the tool now get a less specific failure reason for transient network errors — that trade-off is the point of the fix and is fine. Thanks for the contribution! Leaving the merge decision to a human maintainer. This feedback is AI-generated on behalf of the maintainer team. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
|
Closing as a later copy of #19406. The earlier pull request is the one to keep. |
|
Hey @naufalfx805-source 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Before your next PR, please skim:
If this was declined for direction or taste, maintainers should cite an invariant ID or open a proposed one — ask if that citation is missing. Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! |
Failure-Class: none
Problem
In
backend/utils/retrieval/tools/web_tools.py,fetch_url_toolhandles unexpected exceptions during page fetching by directly interpolatingsanitize(str(e))into the returned error message:While
sanitizemasks known PII patterns, raw exception strings from low-level network libraries (e.g.,httpx,asyncio,ssl, DNS lookups, proxy transports) can expose internal network topology, proxy hostnames, connection pool errors, ports, or unexpected tracebacks directly into the agent tool response and model prompt.Fixes #19617
Solution
fetch_url_toolto return a safe generic message ('Error: Failed to fetch the URL. Please try again later.') while preserving full diagnostic details inlogger.error.ValueError, unsupported scheme) remain unaffected.backend/tests/unit/test_fetch_url_tool_sanitization.pyverifying that:_fetch_pageare sanitized and do not leak sensitive error messages/tokens.