omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] fix(edit-tools): guard None configurable and null string parameters in chat edit tools ($50 proposed)

Open Dimank92 opened this issue 1 month ago • 2 comments

Summary

In backend/utils/retrieval/tools/edit_tools.py, domain mutation tools (update_conversation, rename_person, edit_memory, delete_memory) allow users and agents to update conversation metadata, rename contacts, and edit/delete stored memories.

Runtime Crashes & Vulnerabilities

  1. Fatal AttributeError: 'NoneType' object has no attribute 'get' in owner(config): At line 22:

    def owner(config):
        config = config or {}
        uid = config.get('configurable', {}).get('user_id')
        if not uid:
            raise PermissionError('Authenticated owner required')
        return uid
    

    When config is a dictionary containing 'configurable': None (common in LangChain runnable configurations when configurable is uninitialized), config.get('configurable', {}) returns None. Calling .get('user_id') on None raises an unhandled AttributeError, failing every single tool in edit_tools.py.

  2. AttributeError: 'NoneType' object has no attribute 'strip' in update_conversation(): At line 58:

    if not correction.strip() or len(correction) > 2000 or (title is None and overview is None):
    

    If a tool call passes correction=None (e.g. updating title or overview without explicit correction note), .strip() crashes immediately with AttributeError.

  3. AttributeError: 'NoneType' object has no attribute 'strip' in edit_memory(): At line 118:

    if not content.strip() or len(content) > 20000:
    

    If content is None, .strip() crashes with AttributeError.

  4. Missing validation on name in rename_person(): If name is empty or None, it is passed directly into mcp_people.rename_person() without early input validation.

Fix

  • In owner(config), safely extract configurable and user_id supporting both nested configurable and top-level user_id, raising PermissionError('Authenticated owner required') if invalid.
  • Ensure config.get('configurable') or {} is passed into resolve_edit_ref().
  • Defensively validate correction, content, and name against None before calling .strip().
  • Add comprehensive hermetic unit tests in backend/tests/unit/test_edit_tools.py.

Bounty Proposal

  • Proposed tier: $50 (Targeted bug fix + unit test coverage)
  • Settlement: Base Mainnet USDC / Stripe / Singapore Card

Dimank92 avatar Oct 21 '26 19:10 Dimank92

Resolved in PR #23134.

Added _extract_configurable helper to guard against {'configurable': None}, supported top-level/nested user_id resolution, added defensive null/whitespace checks for correction, name, and content, and added full unit test coverage (10/10 passing) in backend/tests/unit/test_edit_tools.py.

Payout address (Base USDC): 0xb95e2AD8E9D9e9BF902c7531577Cd0E1ceB203D4

Booshdag-io avatar Oct 21 '26 20:10 Booshdag-io

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