Repository navigation
Commit e985c5f
fix(rest): Critic remediation — stop leaking raw response bodies via error context (F1); correct trust-model provenance and residue scoping (F2-F7)
Remediates the NOT-CONVERGED review of 38802b7 (1 S1 + 2 S2 + 4 S3/S4).
F1 (S1) — the raw-body leak defeated the whole unit. `deserialize_catalog_response`
attached the RAW 200-OK body via `.with_context("json", …)` on any parse failure, and
`iceberg::Error` renders context VERBATIM in both `Display` and `Debug`. Every type
redacted in the parent commit routes through that function — `CatalogConfig`
(catalog.rs:592), `LoadTableResult` incl. `storage_credentials` (:988/:1059/:1208),
`LoadViewResult` (:1439/:1475), `NamespaceResponse` (:810/:838) — so a single parse
failure printed exactly what the `Debug` impls had just masked. The trigger is realistic:
a server returning a payload this parser rejects (unknown V3 field, version skew) hands
back the same body carrying the vended `s3.session-token`.
Fixed with the pattern already used on the token endpoint (client.rs:295-307): attach
`status`, `url` and `response_body_len` — never the body. Two mockito guard tests drive
the Critic's probe shape end-to-end (`/v1/config` with a sentinel in `defaults` and
`overrides` missing; and a real `load_table` body carrying vended credentials, corrupted
so it cannot parse) and assert the sentinel is absent from BOTH renderings while the safe
diagnostics are present. Both go RED when the raw-body attach is restored.
`with_source` is retained (AGENTS.md requires the chain); `serde_json`'s message can echo
the offending token at the failure POSITION, never the surrounding payload. The
load_table test pins that bound. Documented as residue.
SCOPED, not changed: the NON-2xx path (`deserialize_unexpected_catalog_error`) still
attaches its body. A non-2xx response means no table was loaded, so no `config` overlay
and no vended credentials were issued; the body is an `ErrorResponse` whose `message` is
the diagnostic value, and Java surfaces exactly this (`ErrorHandlers`). The one non-2xx
body that could echo credentials — the token endpoint's — already withholds it. Rationale
recorded on the function.
F2 (S2) — the trust-model doc was factually wrong about provenance. `merge_with_config`
lets the SERVER's /v1/config `overrides.uri` replace `self.uri`, and server
defaults/overrides merge into `props`, so `oauth2-server-uri` can be server-supplied: a
compromised server can redirect the token POST — carrying the operator's `client_secret` —
to a third-party host. The doc now names BOTH provenances, adjudicates the server-override
variant as parity-shared (Java builds both the client and `AuthConfig.fromProperties` from
`mergedProps`, RESTSessionCatalog.java:211-230), and reconciles with the
`disable-header-redaction` strip: that key is a client-only logging control with no wire
meaning (pure downside if server-set, so stripped), whereas `uri`/`oauth2-server-uri`
server override is a documented functional part of the config protocol. No behavior change.
F3 (S2) — `CommitTableResponse` carries `metadata: TableMetadata` (with `.properties`); it
was wrongly in the "identifier/pagination-only, no value map" all-clear bucket. Moved into
the named core-crate residue paragraph.
F4 (S3) — corrected the `OAuth2Manager` citation to :275-293 and the guard wording: the
WARN fires only when the key is absent AND (`initToken != null` OR non-empty `credential`).
F5 (S3) — added `ViewVersion.summary` (derived `Debug`, `String -> String`, reachable via
`CreateViewRequest.view_version` and both view-metadata paths) to the named residue.
F6 (S3) — reframed `ErrorModel`/`ErrorResponse`/`OAuthError` from all-clear to RESIDUE:
their fields are server-controlled free text, and `message`/`error_description` are now the
one channel by which response-body content still reaches logs after F1.
F7 (S4) — added the transport-layer nuance: Iceberg configures no redirect policy on either
side, so Java inherits HC5 defaults (max 50, no cross-origin header strip) while this fork
inherits reqwest's (max 10, strips Authorization/Cookie/Proxy-Authorization cross-origin).
We are STRICTER, not looser — "no restriction of any kind" was imprecise.
Tests: rest lib 93 -> 95 (+2); 15/15 mutations RED (13 prior + F1a/F1b).
`cargo test -p iceberg --lib` 2855 green.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01MRhAQnro5233xoVDLfib1X1 parent 38802b7 commit e985c5f
3 files changed
Lines changed: 256 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
60 | 86 | | |
61 | 87 | | |
62 | | - | |
| 88 | + | |
63 | 89 | | |
64 | 90 | | |
65 | 91 | | |
| |||
71 | 97 | | |
72 | 98 | | |
73 | 99 | | |
74 | | - | |
75 | | - | |
76 | | - | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
77 | 105 | | |
78 | 106 | | |
79 | 107 | | |
80 | 108 | | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
81 | 118 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
87 | 125 | | |
88 | 126 | | |
89 | 127 | | |
| |||
2373 | 2411 | | |
2374 | 2412 | | |
2375 | 2413 | | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
| 2451 | + | |
| 2452 | + | |
| 2453 | + | |
| 2454 | + | |
| 2455 | + | |
| 2456 | + | |
| 2457 | + | |
| 2458 | + | |
| 2459 | + | |
| 2460 | + | |
| 2461 | + | |
| 2462 | + | |
| 2463 | + | |
| 2464 | + | |
| 2465 | + | |
| 2466 | + | |
| 2467 | + | |
| 2468 | + | |
| 2469 | + | |
| 2470 | + | |
| 2471 | + | |
| 2472 | + | |
| 2473 | + | |
| 2474 | + | |
| 2475 | + | |
| 2476 | + | |
| 2477 | + | |
| 2478 | + | |
| 2479 | + | |
| 2480 | + | |
| 2481 | + | |
| 2482 | + | |
| 2483 | + | |
| 2484 | + | |
| 2485 | + | |
| 2486 | + | |
| 2487 | + | |
| 2488 | + | |
| 2489 | + | |
| 2490 | + | |
| 2491 | + | |
| 2492 | + | |
| 2493 | + | |
| 2494 | + | |
| 2495 | + | |
| 2496 | + | |
| 2497 | + | |
| 2498 | + | |
| 2499 | + | |
| 2500 | + | |
| 2501 | + | |
| 2502 | + | |
| 2503 | + | |
| 2504 | + | |
| 2505 | + | |
| 2506 | + | |
| 2507 | + | |
| 2508 | + | |
| 2509 | + | |
| 2510 | + | |
| 2511 | + | |
| 2512 | + | |
| 2513 | + | |
| 2514 | + | |
| 2515 | + | |
| 2516 | + | |
| 2517 | + | |
| 2518 | + | |
| 2519 | + | |
| 2520 | + | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
| 2532 | + | |
| 2533 | + | |
| 2534 | + | |
| 2535 | + | |
| 2536 | + | |
| 2537 | + | |
| 2538 | + | |
| 2539 | + | |
| 2540 | + | |
| 2541 | + | |
| 2542 | + | |
| 2543 | + | |
| 2544 | + | |
| 2545 | + | |
2376 | 2546 | | |
2377 | 2547 | | |
2378 | 2548 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
555 | 555 | | |
556 | 556 | | |
557 | 557 | | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
558 | 584 | | |
559 | 585 | | |
560 | 586 | | |
| 587 | + | |
| 588 | + | |
561 | 589 | | |
562 | 590 | | |
563 | 591 | | |
564 | 592 | | |
565 | 593 | | |
566 | 594 | | |
567 | 595 | | |
568 | | - | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
569 | 599 | | |
570 | 600 | | |
571 | 601 | | |
| |||
615 | 645 | | |
616 | 646 | | |
617 | 647 | | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
618 | 657 | | |
619 | 658 | | |
620 | 659 | | |
| |||
0 commit comments