Commit 130c76b
committed
fix(pi): harden the Babysit push against a repository the agent controls
Every host-side guard before the push was computed by a git invocation the
agent could influence from inside `.git/`, which is never committed and so is
covered by neither the config digest nor any content check.
- Diff measurement ignored `.git/info/attributes`. One line saying `* -diff`
reduced a 500 KB change to `Binary files differ`: verified locally as 119
bytes reported against a real 500,147, so the 200 KB cumulative bound never
fired, and the `diff` block output — the only record of what an unattended,
review-comment-steered agent pushed — recorded the same nothing. Both diffs
now run `--text --no-ext-diff --no-textconv` with an empty
`core.attributesFile`.
- `rev-list --count` and `merge-base --is-ancestor` answered about replaced
history. A `refs/replace/*` mapping makes a five-commit chain report one,
while the pushed SHA stays real. `GIT_NO_REPLACE_OBJECTS` is now set for
both the prepare and push commands.
- The push asserted HEAD's *shape* — right branch, one commit past the pin, a
descendant — every part of which survives `commit --amend` to a different
tree. So the bounds, the quoted-path refusal, the `.github/` refusal and the
reported diff could all describe a commit other than the one pushed. The
validated SHA is now passed in and the refspec names it.
- The digest comparison resolved `cat`, `sha256sum` and `cut` through `$PATH`
in the same script that invokes git absolutely for exactly that reason, and
was handed the expected digest in its own environment — so a shim could
print it. The utilities are now absolute.
- The clone left the token in `.git/config` when the pinned-SHA assertion
failed, because `set -e` aborted before `remote set-url`. Reordered.
- `changedFiles` reached the block output unscrubbed on the Babysit path,
where Create PR already scrubs it. Names are agent-chosen.
These reduce exposure; they do not bound it. E2B runs each command as
`bash -l`, so a login-shell profile the agent writes executes ahead of the
next host command with the token in its environment. Removing the token from
the sandbox entirely means pushing host-side through the Git Data API, which
the ≤50-file / ≤200 KB bound already makes practical.1 parent a4aff13 commit 130c76b
4 files changed
Lines changed: 145 additions & 40 deletions
File tree
- apps/sim
- executor/handlers/pi
- tools/github
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
516 | 516 | | |
517 | 517 | | |
518 | 518 | | |
519 | | - | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
520 | 524 | | |
521 | 525 | | |
522 | 526 | | |
523 | 527 | | |
| 528 | + | |
| 529 | + | |
524 | 530 | | |
525 | 531 | | |
526 | 532 | | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
527 | 556 | | |
528 | 557 | | |
529 | 558 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
126 | 130 | | |
127 | 131 | | |
128 | 132 | | |
129 | 133 | | |
130 | 134 | | |
131 | | - | |
132 | 135 | | |
| 136 | + | |
133 | 137 | | |
134 | 138 | | |
135 | 139 | | |
136 | 140 | | |
137 | 141 | | |
138 | 142 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
145 | 156 | | |
146 | 157 | | |
147 | 158 | | |
| |||
157 | 168 | | |
158 | 169 | | |
159 | 170 | | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
164 | 175 | | |
165 | 176 | | |
166 | 177 | | |
167 | 178 | | |
168 | 179 | | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
169 | 194 | | |
170 | 195 | | |
171 | | - | |
| 196 | + | |
172 | 197 | | |
| 198 | + | |
173 | 199 | | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
178 | 204 | | |
179 | 205 | | |
180 | 206 | | |
| |||
524 | 550 | | |
525 | 551 | | |
526 | 552 | | |
| 553 | + | |
527 | 554 | | |
528 | 555 | | |
529 | 556 | | |
| |||
589 | 616 | | |
590 | 617 | | |
591 | 618 | | |
| 619 | + | |
592 | 620 | | |
| 621 | + | |
593 | 622 | | |
594 | 623 | | |
595 | 624 | | |
| |||
994 | 1023 | | |
995 | 1024 | | |
996 | 1025 | | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
997 | 1030 | | |
998 | | - | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
999 | 1035 | | |
1000 | 1036 | | |
1001 | 1037 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
103 | 122 | | |
104 | 123 | | |
105 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
31 | 37 | | |
32 | | - | |
| 38 | + | |
33 | 39 | | |
34 | | - | |
35 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
36 | 45 | | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
42 | 56 | | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
46 | 60 | | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
52 | 67 | | |
53 | 68 | | |
54 | 69 | | |
55 | 70 | | |
56 | | - | |
57 | | - | |
| 71 | + | |
58 | 72 | | |
59 | | - | |
| 73 | + | |
60 | 74 | | |
61 | 75 | | |
62 | 76 | | |
63 | | - | |
| 77 | + | |
64 | 78 | | |
65 | 79 | | |
66 | 80 | | |
67 | 81 | | |
68 | | - | |
| 82 | + | |
69 | 83 | | |
70 | 84 | | |
71 | 85 | | |
| |||
133 | 147 | | |
134 | 148 | | |
135 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
136 | 157 | | |
137 | 158 | | |
138 | | - | |
139 | | - | |
| 159 | + | |
| 160 | + | |
140 | 161 | | |
141 | 162 | | |
142 | | - | |
| 163 | + | |
143 | 164 | | |
144 | 165 | | |
145 | 166 | | |
| |||
0 commit comments