resolver: skip auto-install for invalid npm package names #29255
+115
−1
Claude / Claude Code Review
completed
Apr 13, 2026 in 17m 13s
Code review found 1 potential issue
Found 5 candidates, confirmed 1. See review comments for details.
Details
| Severity | Count |
|---|---|
| 🔴 Important | 0 |
| 🟡 Nit | 0 |
| 🟣 Pre-existing | 1 |
| Severity | File:Line | Issue |
|---|---|---|
| 🟣 Pre-existing | src/resolver/resolver.zig:1907 |
isNPMPackageName accepts empty-scope @/pkg, hole in new auto-install gate |
Annotations
Check notice on line 1907 in src/resolver/resolver.zig
claude / Claude Code Review
isNPMPackageName accepts empty-scope @/pkg, hole in new auto-install gate
The new gate at resolver.zig:1907 relies on `strings.isNPMPackageName`, but that function has a pre-existing bug where empty-scope specifiers like `@/pkg` incorrectly pass the check. This means `@/pkg`-style specifiers still reach the auto-install path, potentially triggering the same reentrant `EventLoop.tick()` SIGSEGV this PR aims to prevent. The fix in `isNPMPackageNameIgnoreLength` should use `slash_index > 1` instead of `slash_index > 0` to require at least one character between `@` and `/
Loading