#18860·omi

[Bounty proposal] fix(backend/memories): sanitize temporal read view and device scope error reflections ($50 proposed)

Author: ajin558Created Sep 25, 2026Updated Sep 28, 2026

Following the contribution guide's invitation to propose paid work — @kodjima33, @josancamon19, would a US$50 bounty be appropriate for this? Proposed amount, not an existing award. Fix and tests are already up as PR #18859.

What problem is being solved?

In backend/routers/memories.py, caught DeviceScopeValidationError (resolving client device scope) and ValueError (normalizing temporal read view) previously reflected raw str(exc) directly into HTTP 400 and HTTP 422 responses. If untrusted input containing injected payloads or unexpected internal validation messages is passed, raw exception reflection could leak internal parameters or reflect unvalidated client data.

What is the proposed solution?

  1. Introduce _sanitize_memories_error(exc: Exception, fallback: str) -> str to log underlying failure classes via logger.warning server-side, preserving clean domain validation messages while strictly returning standardized fallback strings ("unsupported memory read view", "device_scope must be one of: all, current, explicit") for unhandled or unexpected internal exceptions.
  2. Wire _resolve_get_memories_device_scope and get_memories exception handlers through the sanitized error helper.
  3. Add full hermetic test coverage in backend/tests/unit/test_memories_error_sanitization.py verifying sanitized behavior and ensuring zero raw exception leaks remain in the memories router.

Implemented and tested in PR #18859.