Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion crates/flare-git-shim/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,9 @@ fn main() {
classify::Disposition::Deny { .. }
| classify::Disposition::Passthrough
| classify::Disposition::SilentExempt => {
if matches!(subcommand.as_str(), "commit" | "push") {
if matches!(subcommand.as_str(), "commit" | "push")
&& agentflare_shim::in_scoped_project(&repo_root, dirs::home_dir().as_deref())
{
match scope_check_outcome(&subcommand) {
ScopeCheckOutcome::Pass => {}
ScopeCheckOutcome::Deny(reason) => {
Expand Down
20 changes: 20 additions & 0 deletions crates/flare-git-shim/tests/shim_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,26 @@ fn read_only_command_passes_through_and_succeeds() {
assert!(out.status.success(), "{out:?}");
}

#[test]
fn untracked_repo_commit_never_runs_scope_or_secret_checks() {
let repo = init_repo();
std::fs::remove_dir(repo.path().join(".agentflare")).unwrap();
let home = tempfile::TempDir::new().unwrap();
let out = Command::new(env!("CARGO_BIN_EXE_git"))
.args(["commit", "--allow-empty", "-m", "untracked"])
.current_dir(repo.path())
.env("CLAUDECODE", "1")
.env("AGENTFLARE_HOME_OVERRIDE", home.path())
.env(
"AGENTFLARE_GIT_SCOPE_CHECK_BIN",
home.path().join("missing-checker"),
)
.env_remove("AGENTFLARE_GIT_BYPASS")
.output()
.unwrap();
assert!(out.status.success(), "{out:?}");
}

#[test]
fn checkout_to_protected_branch_is_denied_and_real_git_never_runs() {
let repo = init_repo();
Expand Down
Loading
Loading