diff --git a/codex-rs/core-plugins/src/startup_sync.rs b/codex-rs/core-plugins/src/startup_sync.rs index 90b54930af..19234e6a5f 100644 --- a/codex-rs/core-plugins/src/startup_sync.rs +++ b/codex-rs/core-plugins/src/startup_sync.rs @@ -612,7 +612,7 @@ fn git_ls_remote_head_sha(codex_home: &Path, git_binary: &Path) -> Result '{}'\nprintf '{}\\tHEAD\\n'\n", + marker.display(), + TEST_CURATED_PLUGIN_SHA + ), + ); + run_git( + &repository, + &["config", "--local", "protocol.ext.allow", "always"], + ); + let rewrite_key = format!("url.ext::{} %S .insteadOf", transport.display()); + run_git( + &repository, + &["config", "--local", &rewrite_key, OPENAI_PLUGINS_GIT_URL], + ); + + let global_config = fixture.path().join("global-gitconfig"); + std::fs::write( + &global_config, + format!( + "[url \"file://{}/\"]\n\tinsteadOf = https://github.com/\n", + fixture.path().join("missing-remotes").display() + ), + ) + .expect("write global Git config"); + let git_wrapper = fixture.path().join("git-from-untrusted-repository.sh"); + write_executable_script( + &git_wrapper, + &format!( + "#!/bin/sh\ncd '{}' || exit 1\nGIT_CONFIG_GLOBAL='{}' GIT_CONFIG_SYSTEM=/dev/null GIT_TERMINAL_PROMPT=0 exec git \"$@\"\n", + repository.display(), + global_config.display() + ), + ); + + let err = sync_openai_plugins_repo_via_git(&codex_home, &git_wrapper) + .expect_err("isolated probe should use the missing global-config remote"); + + assert!(err.contains("git ls-remote curated plugins repo")); + assert!( + !marker.exists(), + "pre-trust sync must not execute repository-local transport configuration" + ); +} + #[tokio::test] async fn ordinary_clone_rejects_tracked_embedded_bare_repository() { let temp_dir = tempdir().expect("create temporary directory");