Commit c272b53
fix(security): shell-quote Rust conventional-crate manifest path
The Rust mapper's conventional-crate discovery reads `crates/*` directly
via readdir and interpolated each directory name into
`cargo test --manifest-path <dir>/Cargo.toml` unquoted. Because the
validation pipeline runs commands through `spawn(_, { shell: true })`, a
crate directory literally named e.g. `$(id)` executed arbitrary commands —
the same command-injection class this PR closes for the Node/Nx/Turbo/
Elixir/Swift mappers, but this one filesystem-derived sink was missed.
Route the manifest path through `shellQuotePath`, matching every other
mapper. Ordinary crate names stay unquoted (no over-quoting); names with
shell metacharacters are quoted and escaped.
Adds an end-to-end regression test that builds a workspace containing a
`crates/$(id)-crate` directory and asserts the produced `--manifest-path`
command is shell-safe. The test fails against the prior code and passes
with the fix.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent a902287 commit c272b53
2 files changed
Lines changed: 48 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
| 77 | + | |
81 | 78 | | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| 79 | + | |
86 | 80 | | |
87 | 81 | | |
88 | 82 | | |
| |||
140 | 134 | | |
141 | 135 | | |
142 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
143 | 178 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
89 | 90 | | |
90 | 91 | | |
91 | 92 | | |
92 | | - | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
93 | 97 | | |
94 | 98 | | |
95 | 99 | | |
| |||
0 commit comments