#18852·omi

[Bounty proposal] fix(backend/candidates): sanitize store error and task link validation 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 #18851.

What problem is being solved?

In backend/routers/candidates.py, caught WorkstreamCandidateResolverUnavailableError, generic CandidateStoreError, and TaskLinkValidationError previously reflected raw str(exc) directly into HTTP responses. This risks exposing internal database schemas, collection identifiers, or validator implementation internals in API error envelopes.

What is the proposed solution?

  1. Introduce _sanitize_candidate_error(exc: Exception, fallback: str) -> str to log underlying failure classes via logger.warning server-side, while strictly returning standardized fallback strings ("Workstream candidate resolver is temporarily unavailable", "Candidate operation could not be completed", "Invalid candidate task link parameters").
  2. Wire _raise_store_error and accept_candidate exception handlers through the sanitized error helper.
  3. Add full hermetic test coverage in backend/tests/unit/test_candidates_error_sanitization.py verifying sanitized behavior and ensuring zero raw exception leaks remain.

Implemented and tested in PR #18851.