Skip to content

fix(core): NUL-safe git argv, RFC 3986 redirect join, fail-closed AllowlistApprover::new - #291

Merged
ajianaz merged 2 commits into
developfrom
fix/scan2-git-web-approval
Oct 7, 2026
Merged

ajianaz merged 2 commits into
developfrom
fix/scan2-git-web-approval

Conversation

@ajianaz

@ajianaz ajianaz commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

What

Three rescan-2 fixes: git NUL argv validation, RFC 3986 redirect resolution in web_fetch, and fail-closed AllowlistApprover::new.

Why

Changes

  • Closes git: NUL byte in message/path panics Command::spawn instead of Err #282: GitTool::execute rejects any argv element containing NUL with git: arguments must not contain NUL bytes.
  • Closes web: join_redirect merges relative Locations against the wrong base (RFC 3986) #281: join_redirect now implements RFC 3986 section 5.2 (absolute, //host, /abs, ?query, relative merge, dot-segment removal) against the current hop's URL (the loop already passes the latest URL). Hand-written; the url crate is not a dependency of tole-core, so none was added.
  • Closes approval: AllowlistApprover::new(Deny) semantics — listed tools allowed? #283: with a Deny/Ask default, new() ignores the patterns, so the default is the final verdict (fail closed). Only Decision::Allow keeps patterns (redundant). Rationale: no production caller uses new() (CLI/MCP use allow_only); constructor stays non-panicking and signature-compatible; allow_only/deny_only give the explicit allow/deny-set semantics; Destructive stays always denied; the three enforcement layers are untouched. Existing tests that relied on the old trap were migrated to allow_only. Behavior change for external embedders of the published crate who used new(p, Deny) expecting an allowlist: they now get deny-all (safe direction); migrate to allow_only.

Testing

  • New: git::tests::nul_byte_in_argv_is_a_clear_error_not_a_panic, web::tests::join_redirect_resolves_per_rfc3986, approval::tests::new_with_deny_default_denies_listed_tools (replaces the old test that codified the trap). Each fails on the previous code.
  • cargo fmt --all, cargo clippy --workspace --all-targets -- -D warnings, cargo test --workspace all pass; cora review --staged: no issues.

🤖 Generated with Claude Code

…owlistApprover::new

- git: reject NUL bytes in argv with a clear tool error (#282)
- web: resolve redirect Location per RFC 3986 against the current hop (#281)
- approval: new(patterns, Deny|Ask) no longer allows listed tools (#283)

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

join_redirect now passes any absolute reference through, so the fetch loop
refuses file:/ftp:/gopher: Locations explicitly (Cora finding on #291).

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@ajianaz
ajianaz merged commit f37b64e into develop Oct 7, 2026
17 checks passed
@ajianaz
ajianaz deleted the fix/scan2-git-web-approval branch October 9, 2026 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant