Commit 345944d
committed
fix(permissions): deny env and exec -a wrapper invocations of the remote shell utilities (Gentleman-Programming#4324)
Close the remaining resolution bypasses flagged by the Gentleman-Programming#4330 review: env(1)
execs the utility after optional flags and NAME=VALUE assignments, and exec -a
renames argv[0] before executing it, so both fell through the wildcard allow
as single parsed command nodes.
Both overlays now enumerate, per tool: the env exact/prefix forms (env X,
env X:*) and the internal-glob forms (env * X *, exec -a * X *) covering
env -i X and env NAME=VALUE X. Verified against OpenCode wildcard.ts (every
* compiles to .*) and Claude Code glob docs (internal wildcards supported;
bare forms kept separate per #26229).
The boundary fixtures flip with the policy: env/-i/assignment and exec -a
invocations are denied matcher inputs, while &&-chains and interpreter
programs remain out of scope. Glob entries are deliberately conservative:
benign commands like env LC_ALL=C sort ssh_keys.txt also match and are
denied — the safe side of a remote-execution boundary.1 parent a9b8307 commit 345944d
2 files changed
Lines changed: 78 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
| |||
76 | 85 | | |
77 | 86 | | |
78 | 87 | | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
79 | 92 | | |
80 | 93 | | |
81 | 94 | | |
| |||
86 | 99 | | |
87 | 100 | | |
88 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
89 | 106 | | |
90 | 107 | | |
91 | 108 | | |
| |||
96 | 113 | | |
97 | 114 | | |
98 | 115 | | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
99 | 120 | | |
100 | 121 | | |
101 | 122 | | |
| |||
105 | 126 | | |
106 | 127 | | |
107 | 128 | | |
108 | | - | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
109 | 134 | | |
110 | 135 | | |
111 | 136 | | |
| |||
122 | 147 | | |
123 | 148 | | |
124 | 149 | | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
125 | 161 | | |
126 | 162 | | |
127 | 163 | | |
| |||
142 | 178 | | |
143 | 179 | | |
144 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
145 | 184 | | |
146 | 185 | | |
147 | 186 | | |
| |||
152 | 191 | | |
153 | 192 | | |
154 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
155 | 197 | | |
156 | 198 | | |
157 | 199 | | |
| |||
162 | 204 | | |
163 | 205 | | |
164 | 206 | | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
165 | 210 | | |
166 | 211 | | |
167 | 212 | | |
| |||
171 | 216 | | |
172 | 217 | | |
173 | 218 | | |
174 | | - | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
175 | 223 | | |
176 | 224 | | |
177 | 225 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
70 | | - | |
71 | | - | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | 78 | | |
75 | 79 | | |
76 | 80 | | |
77 | | - | |
78 | | - | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
79 | 85 | | |
80 | 86 | | |
81 | 87 | | |
| |||
719 | 725 | | |
720 | 726 | | |
721 | 727 | | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
722 | 742 | | |
723 | 743 | | |
724 | 744 | | |
| |||
739 | 759 | | |
740 | 760 | | |
741 | 761 | | |
| 762 | + | |
| 763 | + | |
742 | 764 | | |
743 | 765 | | |
744 | 766 | | |
| |||
816 | 838 | | |
817 | 839 | | |
818 | 840 | | |
| 841 | + | |
| 842 | + | |
819 | 843 | | |
820 | 844 | | |
821 | 845 | | |
| |||
0 commit comments