Commit 99cffb9
committed
fix: enforce max_script_bytes, fix decorator silent skip, rm flag parsing, tee dead branch
1. Enforce max_script_bytes: single-line giant payloads with no newlines
are now caught by a byte-size check alongside the existing line-count
check. Both trigger DENY with a blocklist pre-scan.
2. Decorator silent skip: @safety_wrapper now logs a warning when the
script_arg_name is not found in kwargs / positional dict args, so
callers can detect missing protection.
3. _check_blocklist_override now receives script_type — Python
string-literal stripping is skipped for Bash to avoid false negatives
on cat '/etc/shadow' etc.
4. rm flag detection: parse short flags character-by-character instead of
substring matching (rm -i no longer falsely triggers rm -rf).
5. tee dead branch: tee writes to sensitive paths (tee /etc/shadow,
tee ~/.aws/credentials) are now detected.
6. Evidence truncation: <truncated:N> now reports len-300 consistently.
7. Redundant ternary: Decision.DENY if x else Decision.DENY → Decision.DENY.1 parent 0305e68 commit 99cffb9
3 files changed
Lines changed: 91 additions & 31 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
| 331 | + | |
332 | 332 | | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
333 | 350 | | |
334 | 351 | | |
335 | 352 | | |
| |||
338 | 355 | | |
339 | 356 | | |
340 | 357 | | |
341 | | - | |
342 | | - | |
343 | | - | |
344 | | - | |
345 | | - | |
346 | | - | |
347 | | - | |
348 | | - | |
349 | | - | |
350 | | - | |
351 | | - | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
352 | 377 | | |
353 | 378 | | |
354 | 379 | | |
| |||
363 | 388 | | |
364 | 389 | | |
365 | 390 | | |
366 | | - | |
| 391 | + | |
367 | 392 | | |
368 | 393 | | |
369 | 394 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
37 | 38 | | |
38 | 39 | | |
39 | 40 | | |
| 41 | + | |
| 42 | + | |
40 | 43 | | |
41 | 44 | | |
42 | 45 | | |
| |||
217 | 220 | | |
218 | 221 | | |
219 | 222 | | |
220 | | - | |
| 223 | + | |
221 | 224 | | |
222 | 225 | | |
223 | 226 | | |
| |||
226 | 229 | | |
227 | 230 | | |
228 | 231 | | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
229 | 239 | | |
230 | 240 | | |
231 | 241 | | |
232 | 242 | | |
233 | | - | |
| 243 | + | |
234 | 244 | | |
235 | 245 | | |
236 | 246 | | |
237 | 247 | | |
238 | 248 | | |
239 | 249 | | |
240 | 250 | | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
241 | 258 | | |
242 | 259 | | |
243 | 260 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| 106 | + | |
106 | 107 | | |
107 | 108 | | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
112 | 113 | | |
| 114 | + | |
| 115 | + | |
113 | 116 | | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
114 | 123 | | |
115 | 124 | | |
116 | 125 | | |
| |||
126 | 135 | | |
127 | 136 | | |
128 | 137 | | |
129 | | - | |
130 | | - | |
131 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
132 | 141 | | |
133 | 142 | | |
134 | 143 | | |
| |||
152 | 161 | | |
153 | 162 | | |
154 | 163 | | |
155 | | - | |
| 164 | + | |
156 | 165 | | |
157 | 166 | | |
158 | | - | |
| 167 | + | |
159 | 168 | | |
160 | 169 | | |
161 | 170 | | |
| |||
214 | 223 | | |
215 | 224 | | |
216 | 225 | | |
217 | | - | |
| 226 | + | |
218 | 227 | | |
219 | 228 | | |
220 | 229 | | |
| |||
745 | 754 | | |
746 | 755 | | |
747 | 756 | | |
748 | | - | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
749 | 761 | | |
750 | 762 | | |
751 | 763 | | |
752 | 764 | | |
753 | | - | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
754 | 768 | | |
755 | 769 | | |
756 | 770 | | |
| |||
762 | 776 | | |
763 | 777 | | |
764 | 778 | | |
765 | | - | |
766 | | - | |
767 | | - | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
768 | 786 | | |
769 | 787 | | |
770 | 788 | | |
| |||
824 | 842 | | |
825 | 843 | | |
826 | 844 | | |
827 | | - | |
| 845 | + | |
828 | 846 | | |
829 | 847 | | |
830 | 848 | | |
| |||
0 commit comments