Commit 09d725b
committed
feat: add NixOS support
On NixOS, executables live under /nix/store and PATH entries such as
/run/current-system/sw/bin are symlinks into the store. Inside the bwrap
sandbox /run is replaced with a tmpfs, so those symlinks become
dangling.
- Replaces the hardcoded /bin/true probe with exec.LookPath("true"),
which
works on NixOS and any distro that does not provide /bin/true.
- Mount /nix read-only in bwrap (like /usr, /opt) and add it to Landlock
read paths so store binaries are reachable inside the sandbox.
- resolveToolPath: resolve the directory component of shell/sleep paths
to
their real /nix/store location while preserving the basename so
multi-call binaries (coreutils) still dispatch via argv[0].
- resolvePathInEnv: rewrite PATH entries in the hardened env to their
real
paths and deduplicate, making the sandbox PATH consistent with what is
actually mounted.1 parent 1ab2de3 commit 09d725b
4 files changed
Lines changed: 76 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
639 | 639 | | |
640 | 640 | | |
641 | 641 | | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
642 | 652 | | |
643 | 653 | | |
644 | 654 | | |
| |||
807 | 817 | | |
808 | 818 | | |
809 | 819 | | |
810 | | - | |
| 820 | + | |
| 821 | + | |
811 | 822 | | |
812 | 823 | | |
813 | 824 | | |
| |||
1086 | 1097 | | |
1087 | 1098 | | |
1088 | 1099 | | |
| 1100 | + | |
| 1101 | + | |
| 1102 | + | |
| 1103 | + | |
| 1104 | + | |
| 1105 | + | |
| 1106 | + | |
| 1107 | + | |
1089 | 1108 | | |
1090 | 1109 | | |
1091 | 1110 | | |
| |||
1542 | 1561 | | |
1543 | 1562 | | |
1544 | 1563 | | |
1545 | | - | |
| 1564 | + | |
1546 | 1565 | | |
1547 | 1566 | | |
1548 | 1567 | | |
1549 | 1568 | | |
1550 | 1569 | | |
1551 | 1570 | | |
1552 | 1571 | | |
1553 | | - | |
| 1572 | + | |
1554 | 1573 | | |
1555 | 1574 | | |
1556 | | - | |
| 1575 | + | |
1557 | 1576 | | |
1558 | 1577 | | |
1559 | 1578 | | |
| |||
1571 | 1590 | | |
1572 | 1591 | | |
1573 | 1592 | | |
1574 | | - | |
| 1593 | + | |
1575 | 1594 | | |
1576 | 1595 | | |
1577 | | - | |
| 1596 | + | |
1578 | 1597 | | |
1579 | 1598 | | |
1580 | 1599 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
209 | 209 | | |
210 | 210 | | |
211 | 211 | | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
217 | 223 | | |
218 | 224 | | |
219 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| 63 | + | |
63 | 64 | | |
64 | 65 | | |
65 | 66 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
45 | 46 | | |
46 | 47 | | |
47 | 48 | | |
48 | | - | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
49 | 87 | | |
50 | 88 | | |
51 | 89 | | |
| |||
0 commit comments