Skip to content

Commit dbb094d

Browse files
committed
fix: Do not expose raw exception text in API warnings.
1 parent 5ce7702 commit dbb094d

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

models/parse_warnings.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,13 @@ def record_source_failure(self, exc: BaseException, source: str) -> None:
3131
Distinct from per-item parse skips: signals that an entire data source
3232
could not be searched so the API can warn callers that results may be
3333
incomplete.
34+
35+
The raw exception is intentionally not stored — it is logged server-side
36+
by the caller (``_logger.exception``) before this method is invoked.
37+
Only the source identifier is retained so ``to_api_list`` can produce a
38+
safe client message without leaking file paths or Python internals.
3439
"""
35-
self.source_failures.append({"source": source, "detail": str(exc)})
40+
self.source_failures.append({"source": source})
3641

3742
@property
3843
def has_warnings(self) -> bool:
@@ -80,7 +85,7 @@ def to_api_list(self) -> list[dict]:
8085
warnings.append({
8186
"type": "source_failure",
8287
"source": sf["source"],
83-
"detail": sf["detail"],
88+
"detail": f"Search source '{sf['source']}' could not be queried; results may be incomplete",
8489
})
8590
return warnings
8691

0 commit comments

Comments
 (0)