Commit bfa937c
harden: defensively coerce untrusted describe() metadata
The native-AST describe() export is untrusted plugin output. A plugin
returning a malformed extensions array (e.g. [123], [null], [{}]) threw
an uncaught TypeError out of buildNativeRegistry and crashed the scan
(opt-in path only, but below the "coerce all untrusted plugin JSON" bar
the rest of native-loader holds).
- languageId: ignore unless it's a string (an array/object id no longer
leaks into routing or warning messages).
- extensions: keep only string entries; a malformed array degrades to the
built-in default map (or is skipped) instead of throwing.
145/145 tests pass; default-off behavior unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 7f504dd commit bfa937c
1 file changed
Lines changed: 8 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
166 | 166 | | |
167 | 167 | | |
168 | 168 | | |
169 | | - | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
170 | 172 | | |
171 | 173 | | |
172 | 174 | | |
| |||
181 | 183 | | |
182 | 184 | | |
183 | 185 | | |
184 | | - | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| |||
0 commit comments