SEP-2018: Keep an upstream error body out of the case-search failure log - #1514
Open
marcuscruz-percona wants to merge 1 commit into
Open
marcuscruz-percona wants to merge 1 commit into
marcuscruz-percona wants to merge 1 commit into
Conversation
The case-search route's degraded path logged with `exc_info=True`. RemoteAPI maps an upstream error body's `detail` onto the exception it raises, and Starlette renders that detail in `HTTPException.__str__`, so a receiver-supplied string reached a WARNING record every SEP admin can read. The route now logs the caught exception's type name and no traceback, matching the contract `read_delivery_connection` already holds for its own log line. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
marcuscruz-percona
requested review from
maxbube,
peter-o-addo and
yyyyyyyan
as code owners
September 14, 2026 13:52
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The focused logging change addresses the leak and includes non-vacuous regression coverage.
Pull request overview
Prevents receiver-supplied upstream error details from entering ATW case-search warning logs while preserving degraded-response behavior.
Changes:
- Logs only the caught exception type without traceback data.
- Adds regression coverage for response-body and credential leakage.
File summaries
| File | Description |
|---|---|
app/sep/apps/atw/api_routes.py |
Sanitizes degraded case-search logging. |
tests/app/sep/apps/atw/test_send_api.py |
Verifies sensitive values and tracebacks are not logged. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
atw_case_search's degraded path now logs the caught exception's type instead of passingexc_info=True.RemoteAPI.requestmaps an upstream error body'sdetailonto the exception it raises, so rendering that exception put a receiver-supplied value into a WARNING-level record. This mirrors the contractread_delivery_connectionalready holds for its own route-written log line (SEP-1997), and touches neitherRemoteAPI.request()norsearch_cases().TestAtwCaseSearchthat mocks a non-2xx response carrying adetailbody and asserts the value never reachescaplog.textcaptured at the default level, with a positive control on the route's own line so the sentinel cannot hold vacuously.test_a_failed_search_leaves_no_secret_in_the_logs: itsstr(record.exc_info)guard could no longer fail once the traceback was gone, so it now asserts that no record carriesexc_infoat all — reintroducing a traceback at this call site fails the suite.The transport's own DEBUG-level response-body line at this call site is unchanged and stays SEP-1999's contract; the new test captures at the default level for exactly that reason.
Tested
case_searchsection, make the receiver answer the search with a non-2xx status and adetailbody, issue a search from the Collect Diagnostic Data send dialog's case-reference field, and confirm the resulting WARNING line names only the exception typeChecklist
make test) — 12996 passed; the only 6 failures aretests/app/tasks/db/test_seed.py::TestArtifactLauncher, which fail identically onmain(macOSxargshas no--arg-file)make run-pre-commit)make makemigrations) — N/A, no model changechangelog.d/if the change is user-facing (make changelog-add), or confirmed N/A (internal-only change, or a same-release-cycle fix for an unreleased sibling ticket)🤖 Generated with Claude Code