48 lines
1.4 KiB
Markdown
48 lines
1.4 KiB
Markdown
---
|
|
id: DIS-005
|
|
status: ready
|
|
phase: 0
|
|
priority: p0
|
|
labels: [phase:0, type:fix, priority:p0, security]
|
|
branch: phase-0/path-traversal-check
|
|
assignee: null
|
|
started: null
|
|
pr: null
|
|
merged: null
|
|
---
|
|
|
|
# DIS-005: Path-Traversal-Check in `/new-agent`
|
|
|
|
## Ziel
|
|
`/new-agent name:<x>` akzeptiert keinen Namen, der aus dem Workspace-Root ausbricht.
|
|
Defense in depth: Regex-Validierung + expliziter `path.resolve`-Containment-Check.
|
|
|
|
## Kontext
|
|
Aktuell gibt es Regex-Validierung in `src/commands/new-agent.ts`, aber keinen
|
|
`path.resolve`-Containment-Check. Edge-Cases: `..`, Unicode-Homoglyphen, `.`, leere Strings, Windows-reserved Names.
|
|
→ `docs/development-plan.md` Phase 0 Task 4.
|
|
|
|
## Scope
|
|
- **In**: Nach Regex in `new-agent.ts`:
|
|
```ts
|
|
const root = path.resolve(config.workspaces_root);
|
|
const wsPath = path.resolve(root, name);
|
|
if (!wsPath.startsWith(root + path.sep)) throw new Error("Path traversal");
|
|
```
|
|
Saubere User-Fehlermeldung im Discord-Channel.
|
|
- **Out**: Unicode-Normalisierung über Regex hinaus
|
|
|
|
## Definition of Done
|
|
- [ ] Containment-Check ist aktiv in `src/commands/new-agent.ts`
|
|
- [ ] Unit-Test `tests/unit/path-traversal.test.ts` deckt: `../etc`, `..`, `./foo`, `a/../b`, leerer String, `CON` (Windows-reserved), Unicode-Homoglyphen
|
|
- [ ] `npm run build && npm test` grün
|
|
|
|
## Dateien (erwartet)
|
|
- `src/commands/new-agent.ts`
|
|
- `tests/unit/path-traversal.test.ts`
|
|
|
|
## Abhängigkeiten
|
|
Keine. Kann parallel laufen.
|
|
|
|
## Spec
|
|
→ `docs/backlog.md` #DIS-005
|