@@ -114,9 +114,13 @@ def make_repo_script_list(self) -> list[str]:
114114 base_commit = self .instance ["base_commit" ]
115115
116116 setup_commands = [
117- f"git clone -o origin https://github.com/{ repo } { self .repo_directory } " ,
117+ # Use --depth 1 for shallow clone to prevent agents from accessing
118+ # git history and exploiting it to retrieve original implementations
119+ f"git clone --depth 1 -o origin https://github.com/{ repo } { self .repo_directory } " ,
118120 f"chmod -R 777 { self .repo_directory } " , # So nonroot user can run tests
119121 f"cd { self .repo_directory } " ,
122+ # Fetch both commits needed: env_setup_commit for setup and base_commit for later reset
123+ f"git fetch --depth 1 origin { env_setup_commit } { base_commit } " ,
120124 f"git reset --hard { env_setup_commit } " ,
121125 # Remove the remote so the agent won't see newer commits.
122126 "git remote remove origin" ,
@@ -217,10 +221,15 @@ def make_repo_script_list(self) -> list[str]:
217221 if version < 7 :
218222 specs ["python" ] = 3.7
219223
224+ base_commit = self .instance ["base_commit" ]
220225 setup_commands = [
221- f"git clone -o origin https://github.com/{ repo } { self .repo_directory } " ,
226+ # Use --depth 1 for shallow clone to prevent agents from accessing
227+ # git history and exploiting it to retrieve original implementations
228+ f"git clone --depth 1 -o origin https://github.com/{ repo } { self .repo_directory } " ,
222229 f"chmod -R 777 { self .repo_directory } " , # So nonroot user can run tests
223230 f"cd { self .repo_directory } " ,
231+ # Fetch base_commit needed for eval script reset
232+ f"git fetch --depth 1 origin { base_commit } " ,
224233 # Remove the remote so the agent won't see newer commits.
225234 "git remote remove origin" ,
226235 f"uv venv --python { specs ['python' ]} " ,
0 commit comments