Commit 157a4ff
committed
fix: use shallow clone to prevent reward hacking via git history
Use --depth 1 when cloning repositories to prevent agents from accessing
git history and exploiting it to retrieve original function implementations
that were stripped out.
This addresses a reward hacking vulnerability where agents can use
git log/diff/show commands to find and copy original implementations
instead of writing them from scratch.
For Commit0Spec, also fetch the specific env_setup_commit with --depth 1
before resetting to it, since shallow clone only gets the default branch tip.
Co-authored-by: openhands <openhands@all-hands.dev>1 parent 4bbfa86 commit 157a4ff
1 file changed
+7
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
117 | | - | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
118 | 120 | | |
119 | 121 | | |
| 122 | + | |
120 | 123 | | |
121 | 124 | | |
122 | 125 | | |
| |||
218 | 221 | | |
219 | 222 | | |
220 | 223 | | |
221 | | - | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
| |||
0 commit comments