Commit 81f45d7
committed
Fence untrusted review content before it reaches the resolver
Greptile flagged the diff hunk restored earlier in this branch as a prompt-
injection vector, and it is right. `prRefreshIssueInventory` hands review data to
an agent that also holds `prReplyToReviewThread` and `prResolveReviewThread`,
neither of which asks for confirmation, so instruction-shaped text written by
whoever opened the PR could steer real GitHub review-state mutations.
Comment bodies had the same exposure and predate this branch, so the whole class
is swept rather than just the field that drew the comment: review-thread diffs,
review comments, and issue comments are each wrapped in an explicit fence that
names them as data written by an outside contributor and says not to follow
instructions inside. The wrapping happens in code on every value rather than
being asked for in a prompt, the tool description states the same contract, and
any occurrence of the fence marker inside a payload is defanged so content
cannot close its own fence and speak as ADE.
The regression test plants a forged END marker followed by an instruction and
asserts exactly one BEGIN and one END survive per field.1 parent 4ce263e commit 81f45d7
2 files changed
Lines changed: 73 additions & 6 deletions
Lines changed: 40 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
26 | 32 | | |
27 | 33 | | |
28 | 34 | | |
| |||
139 | 145 | | |
140 | 146 | | |
141 | 147 | | |
142 | | - | |
| 148 | + | |
| 149 | + | |
143 | 150 | | |
144 | 151 | | |
145 | 152 | | |
| |||
155 | 162 | | |
156 | 163 | | |
157 | 164 | | |
158 | | - | |
| 165 | + | |
| 166 | + | |
159 | 167 | | |
160 | 168 | | |
161 | 169 | | |
| |||
179 | 187 | | |
180 | 188 | | |
181 | 189 | | |
182 | | - | |
| 190 | + | |
183 | 191 | | |
184 | 192 | | |
185 | 193 | | |
186 | 194 | | |
187 | 195 | | |
188 | 196 | | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
189 | 226 | | |
190 | 227 | | |
191 | 228 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
27 | 57 | | |
28 | 58 | | |
29 | 59 | | |
| |||
496 | 526 | | |
497 | 527 | | |
498 | 528 | | |
499 | | - | |
| 529 | + | |
500 | 530 | | |
501 | 531 | | |
502 | 532 | | |
503 | | - | |
| 533 | + | |
504 | 534 | | |
505 | 535 | | |
506 | 536 | | |
| |||
509 | 539 | | |
510 | 540 | | |
511 | 541 | | |
512 | | - | |
| 542 | + | |
513 | 543 | | |
514 | 544 | | |
515 | 545 | | |
| |||
0 commit comments