Commit 7144c52
hardening(examples): sanitize UCP self-test exception, drop unused Any import
CodeQL flagged the `/_selftest/ucp` route returning `str(exc)` to the HTTP
response body as information exposure. Match the round-26 sanitization
pattern used in core/store: log the full exception server-side via
logger.exception, expose only `type(exc).__name__` + the structured
verification code to the caller. The error class name is enough for an
operator to triage without revealing internal verification machinery.
Also drop the unused `Any` import from tests/test_ucp.py; the only cast()
target gets retyped to `OperatorVerification` (the actual field type),
which keeps the typed-empty-wins-over-raw test intent intact.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 4b9571e commit 7144c52
2 files changed
Lines changed: 7 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
386 | 386 | | |
387 | 387 | | |
388 | 388 | | |
389 | | - | |
| 389 | + | |
390 | 390 | | |
391 | 391 | | |
392 | 392 | | |
| |||
0 commit comments