Repository navigation
Commit 356bc47
committed
fix(web/shell): #107 review — an agent's command cannot write .GIT/config or .VSCODE/tasks.json
The protected paths of shellCommit.js (.git, .vscode, .levelcode, .cursor, .husky, .github/workflows) were matched
as typed; only the instruction-file pattern ignored case. On a disk that ignores case — the usual folder from the
computer: APFS on a Mac, NTFS on Windows — `.GIT/config` is `.git/config`, so an agent's
`printf '[core]\n\tfsmonitor = sh evil.sh\n' > .GIT/config` went to the review as an ordinary file and was applied
("1 file changed, ready for Keep/Undo: ~.GIT/config"), reproduced against 187fd21.
isProtected now matches the folded path (foldCase): NFC, as the shell folds names in its own commit
(web/shell/src/commit.js), then upper case before lower case, so that U+017F (long s) and U+0131 (dotless i)
land on s and i too; U+212A (the Kelvin sign) is K once normalised. Wider than any one disk, which only refuses names
nobody would choose.
The visitor's own terminal (web/shell/src/commit.js) has no protected list, by design ("the user's own terminal is not
held to this"), so there was nothing to fold there.
Test (test/shellCommit.test.js): "protected paths are refused in any letter case" — the reported command, each
protected name in other cases and as a delete, the three Unicode letters, and names that only look similar
(.GITIGNORE, my.GIT/x) still allowed. It fails on 187fd21 (the .GIT/config write is not refused) and passes here.1 parent 720f5a3 commit 356bc47
2 files changed
Lines changed: 38 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
| 22 | + | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
114 | 115 | | |
115 | 116 | | |
116 | 117 | | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
117 | 130 | | |
118 | | - | |
| 131 | + | |
119 | 132 | | |
120 | 133 | | |
121 | 134 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
161 | 161 | | |
162 | 162 | | |
163 | 163 | | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
164 | 186 | | |
165 | 187 | | |
166 | 188 | | |
| |||
0 commit comments