Commit d99f228
authored
fix(builtins): block unset of internal variables and readonly marker bypass (#1013)
## Summary
- Block `unset _READONLY_*` and other internal marker variables via
`is_internal_variable()` check
- Defense-in-depth: checks in both interpreter's `execute_unset_builtin`
and `Unset` builtin struct
## What & Why
`unset _READONLY_FOO` could directly remove the readonly marker, making
`FOO` mutable again. This defeats readonly protection, which may be
security-critical. Now the interpreter's unset handler checks
`is_internal_variable()` before removing any variable, blocking
manipulation of all internal markers.
## Tests Added
- `unset_readonly_marker_blocked` — verifies `unset _READONLY_X` doesn't
defeat readonly
- `unset_normal_variable_works` — verifies normal unset still works
Closes #10061 parent 07b499f commit d99f228
File tree
3 files changed
+72
-1
lines changed- crates/bashkit
- src
- builtins
- interpreter
- tests
3 files changed
+72
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13 | 13 | | |
14 | 14 | | |
15 | 15 | | |
| 16 | + | |
16 | 17 | | |
| 18 | + | |
| 19 | + | |
17 | 20 | | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
18 | 38 | | |
19 | 39 | | |
20 | 40 | | |
21 | 41 | | |
22 | | - | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
23 | 47 | | |
24 | 48 | | |
25 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4605 | 4605 | | |
4606 | 4606 | | |
4607 | 4607 | | |
| 4608 | + | |
| 4609 | + | |
| 4610 | + | |
| 4611 | + | |
4608 | 4612 | | |
4609 | 4613 | | |
4610 | 4614 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
252 | 252 | | |
253 | 253 | | |
254 | 254 | | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
255 | 298 | | |
256 | 299 | | |
257 | 300 | | |
| |||
0 commit comments