Commit a251a9a
Sanitize peer / leader addresses in error messages; cap handshake-failure body
Three security-adjacent client error-text fixes:
- ``DqliteProtocol._addr_suffix()`` interpolated ``self._address``
directly into exception messages. The address can be server-
controlled in the leader-redirect reconnect path
(LeaderResponse.address is intentionally not sanitised at
decode — sanitising would split allowlist sets) so a hostile
leader could inject CRLF / control-chars / U+2028 / U+2029 into
the address and produce log lines that splice across rows.
Sanitise via ``_sanitize_server_text`` before interpolation.
- ``cluster._find_leader_impl``'s aggregate error builder
interpolated ``node.address`` directly at three sites
(no-leader-known, timed-out, transport-failure). Same hostile-
leader risk on the redirect-reconnect path. Sanitise each
interpolation.
- ``DqliteProtocol.handshake``'s failure-response raise wrapped
``_failure_text(response)`` directly in a bare ProtocolError,
bypassing the OperationalError display-cap that bounds every
other raise site in the protocol module. Run the body through
``_truncate_error`` so a hostile-or-buggy peer cannot inflate
the handshake error into a multi-KiB log line.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent 24da777 commit a251a9a
2 files changed
Lines changed: 37 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
351 | 351 | | |
352 | 352 | | |
353 | 353 | | |
354 | | - | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
355 | 364 | | |
356 | 365 | | |
357 | 366 | | |
| |||
361 | 370 | | |
362 | 371 | | |
363 | 372 | | |
364 | | - | |
| 373 | + | |
365 | 374 | | |
366 | 375 | | |
367 | 376 | | |
| |||
376 | 385 | | |
377 | 386 | | |
378 | 387 | | |
379 | | - | |
| 388 | + | |
380 | 389 | | |
381 | 390 | | |
382 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
233 | 233 | | |
234 | 234 | | |
235 | 235 | | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
236 | 244 | | |
237 | | - | |
| 245 | + | |
| 246 | + | |
238 | 247 | | |
239 | 248 | | |
240 | 249 | | |
| |||
699 | 708 | | |
700 | 709 | | |
701 | 710 | | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
702 | 721 | | |
703 | | - | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
704 | 727 | | |
705 | 728 | | |
706 | 729 | | |
| |||
0 commit comments