Repository navigation
fix(retrieval-tools): sanitize internal exception disclosure in action_item_tools - #18486
Conversation
|
Official bounty proposal submitted at #19363. All 12 hermetic unit tests in |
|
Thanks @naufalfx805-source — this is a solid, well-scoped follow-up to #17827 that closes out the remaining exception-disclosure sites called out in that review. backend/utils/retrieval/tools/action_item_tools.py (+24/−28)
backend/tests/unit/test_action_item_tools_sanitization.py (+229, new)
CI note: the failing Backend unit suite job is tests/unit/test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_complete — an OpenAPI decode-site ratchet unrelated to the two files changed here (that workflow is green on other branches from later in the week). It looks like a stale merge base; a rebase onto latest main should clear it. This feedback is AI-generated on behalf of the Omi maintainers. Left for human maintainer review before merge. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
…n_item_tools
- Sanitize raw exception formatting (str(e), f{e}) and date parsing ValueError leaks across get_action_items_tool, create_action_item_tool, and update_action_item_tool.
- Remove redundant traceback.print_exc() calls in favor of structured logging with exc_info=True to preserve backend observability.
- Add hermetic unit test suite backend/tests/unit/test_action_item_tools_sanitization.py with 12 test cases.
Failure-Class: none
a8ec405 to
7911956
Compare
|
Incremental note on the earlier review of this head (commit 7911956): the CI failure flagged then — tests/unit/test_app_client_schema_inventory.py::test_inventory_openapi_route_response_decode_migration_complete — has cleared at this head; Backend Hermetic Merge Gate, Backend unit suite, Formatting, and Hygiene are all green. I also re-checked backend/utils/retrieval/tools/action_item_tools.py at this head: all nine exception-disclosure sites remain fixed, no str(e)/print_exc survives in returned strings, and the f"Error: {scope_err}" site near line 197 is still the controlled domain message from apply_chat_scope_dates, not a leak. Nothing further outstanding from my side — the only remaining step is human maintainer merge sign-off. This feedback is AI-generated on behalf of the Omi maintainers. by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with |
aryanorastar
left a comment
There was a problem hiding this comment.
791195622b95 origin/main ad94069 backend/utils/retrieval/tools/action_item_tools.py:289 returns Error retrieving action items: {str(e)} (create/update paths similar). This head returns static strings; test_action_item_tools_sanitization.py pins them. Hygiene + Backend Hermetic SUCCESS. mergeable_state blocked, not dirty. Earlier than later same-file open copies (#19556/#19680/#19734). Required checks on this head are green.
Description
Follow-up to PR #17827 addressing the observation by @Git-on-my-level:
This PR hardens error handling and closes all internal exception disclosure sites in
backend/utils/retrieval/tools/action_item_tools.py.Summary of Changes
str(e),f"{e}"), date parsingValueErrorleaks, andtraceback.print_exc()calls in returned tool strings so internal database queries, credentials, and stack traces are never disclosed to the agent context or end users.exc_info=Truetologger.error(...).backend/tests/unit/test_action_item_tools_sanitization.pycontaining 12 unit tests validating error sanitization and hermetic module isolation across all 3 action item tools.backend/scripts/check_module_stub_pollution.py(0 violations).Test Verification
Ran full hermetic pytest suite:
Regression test suites:
Hygiene check:
Failure-Class: none
cc @kodjima33
Payout address (Base / EVM):
0x496e32ff3851cdb9146223a811e3d4f9218dd954