Commit ec8b347
fix(sandbox): address review feedback on execute_file and ABI message
Code-review fixes from PR #1367:
* execute_file no longer allowlists the script's entire parent
directory for Landlock read. Only the script file itself is granted
read access, so sibling files on the host are never exposed (gemini
flagged this as high severity). Verified end-to-end against real
sandlock: a script that tries to read a sibling file is denied.
* _build_sandbox_kwargs filters extra_readable with os.path.exists
instead of os.path.isdir, so individual files (not just directories)
can be allowlisted — required for the file-only execute_file path.
* Corrected the Landlock kernel version in the fail-loud error message.
The wrapper now requires ABI >= min_landlock_abi() (currently v6),
which shipped in Linux 6.12 — not 6.7. The message is phrased around
the ABI version so it stays correct as the SDK's minimum changes.
* test_sandlock_execution_success now uses bytes for stdout/stderr (to
exercise the _decode() byte path, matching real sandlock) and sets
result.success = True explicitly.
Note: the suggestion to also add temp_dir/working_dir to fs_readable
was not applied — sandlock's fs_writable already grants read access
("fs_readable ... in addition to writable paths"), confirmed by test.1 parent c0c4eee commit ec8b347
2 files changed
Lines changed: 21 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
76 | 76 | | |
77 | 77 | | |
78 | 78 | | |
79 | | - | |
80 | | - | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| |||
87 | 88 | | |
88 | 89 | | |
89 | 90 | | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
94 | 96 | | |
95 | 97 | | |
96 | 98 | | |
| |||
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
162 | 168 | | |
163 | | - | |
| 169 | + | |
164 | 170 | | |
165 | 171 | | |
166 | 172 | | |
| |||
358 | 364 | | |
359 | 365 | | |
360 | 366 | | |
361 | | - | |
362 | | - | |
363 | | - | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
364 | 370 | | |
365 | 371 | | |
366 | 372 | | |
| |||
386 | 392 | | |
387 | 393 | | |
388 | 394 | | |
389 | | - | |
| 395 | + | |
390 | 396 | | |
391 | 397 | | |
392 | 398 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
| 120 | + | |
120 | 121 | | |
121 | | - | |
122 | | - | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
123 | 125 | | |
124 | 126 | | |
125 | 127 | | |
| |||
0 commit comments