Skip to content

fix(config): omit rejected provider payloads from shape receipts - #1644

Merged
EffortlessSteven merged 2 commits into
mainfrom
fix/1427-redact-rejected-payloads
Nov 4, 2026
Merged

EffortlessSteven merged 2 commits into
mainfrom
fix/1427-redact-rejected-payloads

Conversation

@EffortlessSteven

Copy link
Copy Markdown
Member

Defect (#1427)

sanitize_providers_section interpolated the whole rejected TOML value into PolicyError.detail (six format sites, including src/config.rs:1154 and the policy-value site at src/config.rs:1188 pre-diff). policy_errors serializes into effective-config.json — written for plan (src/plan_artifacts.rs:105) and for the run (src/main.rs:4581 passes the raw config, unlike cmd_plan which redacts via diagnostic_artifact_config, src/main.rs:4501) — and build_gate_outcome copies each detail verbatim into gate reasons (src/gate.rs:584-588). A pasted API key under any rejected provider key therefore published into uploaded artifacts, while preflight_diagnostics::config_diagnostic (src/preflight_diagnostics.rs:10) already treats details as secret-bearing and never renders them.

Fix

  • New rejected_value_shape helper (src/config.rs:1138): describes a rejected value's TOML type plus length for string/array/table, never its text.
  • All six rejected-value interpolations in sanitize_providers_section now embed the shape instead of the value; field paths, section IDs, expected-shape text, and one fail-closed receipt per malformed value are unchanged.
  • preflight_diagnostics behavior is unchanged and stays aligned: config_diagnostic never renders detail; diagnostic_artifact_config still overwrites details defensively for plan artifacts.

Regression tests

  • config::tests::provider_receipts_describe_shape_and_omit_rejected_payload: canary sk-SYNTHETIC-PRIVATE-CANARY under a top-level scalar providers, non-table arrays for both minimax and opencode, and under [providers].policy — asserts each receipt names its field and the shape, and serde_json::to_string(&Config) (the effective-config.json form) contains no canary bytes; valid siblings (e.g. policy = "minimax-only") survive.
  • gate::tests::invalid_provider_shape_fails_gate_without_serializing_payload: same sentinel; gate still fails with two policy reasons pointing at effective-config.json, and the serialized GateOutcome contains no canary.
  • Four existing tests asserting the old raw-value detail text were deliberately updated to shape-only expectations (providers_section_parses_policy_and_receipts_invalid_values, providers_section_receipts_invalid_table_shapes_and_keeps_valid_siblings, providers_section_receipts_invalid_max_concurrency, providers_section_receipts_invalid_prompt_cache). tests::providers_policy_config_parses_resolves_and_receipts_invalid_values (src/main.rs:8144) asserts only the invalid [providers] policy value prefix and needed no change.

Validation

From F:/Temp/fix-1427 at ab18e6e:

  • cargo fmt --all then cargo fmt --all --check — clean.
  • cargo clippy --locked --workspace --all-targets — no warnings from this diff; three pre-existing warnings in files untouched here (tests/common/executable_fixture.rs:26 unused fixture_status on Windows, tests/pr_context_hydration.rs:40 unneeded mut, src/proof/red_green.rs:385 unused import — the tolerated one).
  • cargo test --locked --bin ub-review -- <11 named tests> --exact — 11 passed; 0 failed (both new tests plus all provider/gate receipt tests).
  • cargo test --locked --bin ub-review provider — 41 passed; 0 failed.

Known gaps

  • The same value-interpolation class exists in sibling sanitizers outside the issue's provider scope (e.g. [impact] at src/config.rs:1101, plus gate/tools/proof/review_body key receipts) and in the Windows-vs-Linux gated test surface; Unix-gated tests are covered by the Linux gate, not locally.
  • Validation used a private target dir (F:/Temp/fix-1427-target) instead of the shared H:/Code/Rust/ub-review/target: three concurrent cargo/rustc processes from other sessions were racing the same ub-review fingerprint keys, producing a fresh-looking artifact without this branch's code (verified by grepping the binary for the test names). Artifact fidelity required the private dir.

Fixes #1427

@coderabbitai

coderabbitai Bot commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

  • Ask an admin to enable usage-based reviews

Open in CodeRabbit

Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 152 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Essentials
  • Run ID: ec15d147-7809-4359-9dea-c377da1fc0e2
Commits

Reviewing files that changed from the base of the PR and between c6bc743 and 407f712.

Files selected for processing: 3
  • .ripr/suppressions.toml
  • src/config.rs
  • src/gate.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@EffortlessSteven
EffortlessSteven merged commit 3953fc0 into main Nov 4, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(config): omit rejected provider payloads from shape receipts

1 participant