Skip to content

Commit 4d0b9e0

Browse files
author
Claude Code
committed
Archive investigation for issue #312
1 parent 959f75c commit 4d0b9e0

File tree

1 file changed

+159
-0
lines changed

1 file changed

+159
-0
lines changed
Lines changed: 159 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
# Investigation: Security: Picomatch has HIGH severity ReDoS and Method Injection vulnerabilities
2+
3+
**Issue**: #312 (https://github.com/tbrandenburg/made/issues/312)
4+
**Type**: CHORE
5+
**Investigated**: 2026-03-27T06:15:00Z
6+
7+
### Assessment
8+
9+
| Metric | Value | Reasoning |
10+
| ---------- | ----------------------------- | ------------------------------------------------------------------------------------------------------ |
11+
| Priority | HIGH | HIGH severity security vulnerabilities (ReDoS and Method Injection) require immediate remediation |
12+
| Complexity | LOW | Single command fix (`npm audit fix`), no code changes required, low risk of breaking changes |
13+
| Confidence | HIGH | Vulnerability details are clear, fix is documented in npm audit output, toolchain supports automated fix |
14+
15+
---
16+
17+
## Problem Statement
18+
19+
The `picomatch` package (transitive dependency) has 2 HIGH severity security vulnerabilities that affect multiple packages in the frontend:
20+
- **ReDoS via extglob quantifiers** (GHSA-c2c7-rcm5-vvqj) - Regular Expression Denial of Service
21+
- **Method Injection in POSIX Character Classes** (GHSA-3v7f-55p6-f55p) - Security bypass via incorrect glob matching
22+
23+
These vulnerabilities affect picomatch versions <=2.3.1 and 4.0.0-4.0.3. Safe versions are 2.3.2+ or 4.0.4+.
24+
25+
---
26+
27+
## Analysis
28+
29+
### Root Cause / Change Rationale
30+
31+
picomatch is a **transitive dependency** pulled in by:
32+
- `tinyglobby@1.2.1``picomatch@4.0.3` (VULNERABLE)
33+
- `vitest@3.1.4``picomatch@4.0.3` (VULNERABLE)
34+
- `vite@6.3.5``picomatch@4.0.3` (VULNERABLE)
35+
36+
These packages pin picomatch@4.0.3 as a dependency range that includes the vulnerable versions. npm cannot automatically update transitive dependencies, so we need to **add picomatch as a direct dependency with an overridden version**.
37+
38+
### Evidence Chain
39+
40+
WHY: `npm audit` reports picomatch vulnerabilities
41+
↓ BECAUSE: picomatch@4.0.3 (and older) has known security flaws
42+
↓ BECAUSE: tinyglobby, vitest, and vite depend on picomatch transitively without version pinning
43+
↓ ROOT CAUSE: No direct dependency override to force a safe picomatch version
44+
Evidence: `packages/frontend/package.json` - no picomatch override exists
45+
46+
### Affected Files
47+
48+
| File | Lines | Action | Description |
49+
| ------------------------------ | ----- | ------ | ---------------------------------------- |
50+
| `packages/frontend/package.json` | ALL | UPDATE | Add picomatch override to force safe version |
51+
| `package.json` | ALL | UPDATE | Add root-level npm overrides for workspace |
52+
53+
### Integration Points
54+
55+
- npm package manager handles dependency resolution
56+
- No code changes required - only dependency version override
57+
58+
### Git History
59+
60+
- **Not a regression** - this is a transitive dependency vulnerability that emerged as upstream packages updated
61+
62+
---
63+
64+
## Implementation Plan
65+
66+
### Step 1: Add npm overrides for picomatch
67+
68+
**File**: `package.json` (root)
69+
**Action**: UPDATE
70+
71+
Add overrides section to root package.json for npm workspaces:
72+
```json
73+
{
74+
"overrides": {
75+
"picomatch": "4.0.4"
76+
}
77+
}
78+
```
79+
80+
**File**: `packages/frontend/package.json`
81+
**Action**: UPDATE
82+
83+
Add picomatch as devDependency and overrides:
84+
```json
85+
{
86+
"devDependencies": {
87+
"picomatch": "^4.0.4"
88+
},
89+
"overrides": {
90+
"picomatch": "4.0.4"
91+
}
92+
}
93+
```
94+
95+
**Why**: npm overrides force all transitive dependencies to use the specified version. Using exact version "4.0.4" ensures consistency across all packages.
96+
97+
### Step 2: Reinstall dependencies
98+
99+
**Command**: `npm install` (from root)
100+
101+
This will:
102+
1. Update all nested `node_modules` to use picomatch@4.0.4
103+
2. Regenerate `package-lock.json`
104+
105+
### Step 3: Verify fix
106+
107+
**Command**: `npm audit`
108+
109+
Expected output: No picomatch vulnerabilities reported.
110+
111+
---
112+
113+
## Validation
114+
115+
### Automated Checks
116+
117+
```bash
118+
# Run security audit (no flags = check everything)
119+
npm audit
120+
121+
# Verify picomatch version
122+
npm ls picomatch
123+
124+
# Run full test suite to ensure no regressions
125+
npm test
126+
127+
# Verify build works
128+
npm run build
129+
```
130+
131+
### Manual Verification
132+
133+
1. Run `npm audit` - should show 0 vulnerabilities for picomatch
134+
2. Run `npm test` - all tests should pass
135+
3. Run `npm run build` - frontend should build successfully
136+
137+
---
138+
139+
## Scope Boundaries
140+
141+
**IN SCOPE:**
142+
143+
- Adding npm overrides for picomatch in package.json
144+
- Running npm install to update lockfile
145+
- Verifying fix with npm audit
146+
147+
**OUT OF SCOPE (do not touch):**
148+
149+
- Updating vite, vitest, or tinyglobby versions (unless needed for other reasons)
150+
- Changes to Python backend
151+
- Any code refactoring
152+
153+
---
154+
155+
## Metadata
156+
157+
- **Investigated by**: GHAR
158+
- **Timestamp**: 2026-03-27T06:15:00Z
159+
- **Artifact**: `.ghar/issues/issue-312.md`

0 commit comments

Comments
 (0)