Repository navigation
fix(core): NUL-safe git argv, RFC 3986 redirect join, fail-closed AllowlistApprover::new - #291
Merged
Merged
Conversation
…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]>
🔍 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Three rescan-2 fixes: git NUL argv validation, RFC 3986 redirect resolution in web_fetch, and fail-closed
AllowlistApprover::new.Why
Command::spawn. On current std this is anErr, NOT a panic (issue premise partly stale), but the surfaced error was the misleading "failed to spawn subprocess (is it on PATH?)".join_redirectappended relative Locations to the full base (/a/b/c+ggave/a/b/c/g), ignored..,?q, and//hostforms, mis-routing redirects.AllowlistApprover::new(patterns, Decision::Deny)ALLOWED listed tools, contradicting the configured default verdict.Changes
GitTool::executerejects any argv element containing NUL withgit: arguments must not contain NUL bytes.join_redirectnow 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; theurlcrate is not a dependency of tole-core, so none was added.Deny/Askdefault,new()ignores the patterns, so the default is the final verdict (fail closed). OnlyDecision::Allowkeeps patterns (redundant). Rationale: no production caller usesnew()(CLI/MCP useallow_only); constructor stays non-panicking and signature-compatible;allow_only/deny_onlygive 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 toallow_only. Behavior change for external embedders of the published crate who usednew(p, Deny)expecting an allowlist: they now get deny-all (safe direction); migrate toallow_only.Testing
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 --workspaceall pass;cora review --staged: no issues.🤖 Generated with Claude Code