omi icon indicating copy to clipboard operation
omi copied to clipboard

[Bounty proposal] Harden backend/database/live_owner_continuity.py against invalid IDs, non-finite continuity values, and malformed snapshots ($50 proposed)

Open huynhnhatquandongnai-source opened this issue 1 month ago • 3 comments

What's wrong

In ackend/database/live_owner_continuity.py:

  1. Unsanitized identifiers (uid, conversation_id, segment_id): Empty/whitespace-only strings, path separators (/, , ..), control characters, and overly long identifiers are passed directly into Firestore document paths without validation.
  2. Malformed snapshot payloads (snapshot.to_dict()): When snapshot.to_dict() returns None or a non-dict object, field reads raise uncaught AttributeError.
  3. Non-finite numeric fields (NaN, inf, booleans): Continuity timestamps, durations, confidence scores, and counters accept ool, NaN, or inf, corrupting stored continuity state.
  4. Transient store failure fragility & lack of client injection seam: Direct global client lookups without error boundaries or optional irestore_client injection prevent graceful degradation and hermetic unit testing.

Proposed Fix

  1. Validate and sanitize identifiers (uid, conversation_id, segment_id) against empty strings, path traversal tokens, and control characters.
  2. Guard snapshot.to_dict() against None/non-dict payloads and wrap Firestore read/write operations in safe error boundaries.
  3. Normalize and validate numeric continuity fields against ool, NaN, and inf.
  4. Add optional irestore_client injection across public functions and add 51 hermetic unit tests in ackend/tests/unit/test_live_owner_continuity_resilience.py.

Proposed Bounty

$50

Bounty settlement address (Base Mainnet USDC): 0xb9f3765aeb1974c27a193463f655a1a57b3aec94

Implemented in #22901: id/token/revision validation, snapshot shape guards, fail-closed reads, client seam, 167 hermetic tests

Bounty settlement address (Base Mainnet USDC): 0x93c0d4e7100bc6b59e28e074f30a1ac37244b6af

Andu1223 avatar Oct 20 '26 16:10 Andu1223

Hi! I'm interested in contributing to this bounty. I noticed that PR #22901 has already been mentioned for this issue. Is the bounty still open for additional contributions, or has the existing PR already covered all the requirements? I'd like to confirm before starting work. Thanks!

Nikhil1869 avatar Oct 20 '26 18:10 Nikhil1869

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