-
Notifications
You must be signed in to change notification settings - Fork 1
Closed
Description
Security Issue: Path Injection via DEVFLOW_DIR
Severity: HIGH
Priority: CRITICAL
Category: Input Validation
Problem
The getDevFlowDirectory() function accepts DEVFLOW_DIR environment variable without validation:
function getDevFlowDirectory(): string {
if (process.env.DEVFLOW_DIR) {
return process.env.DEVFLOW_DIR; // ⚠️ No validation!
}
return path.join(getHomeDirectory(), '.devflow');
}Attack Vector:
DEVFLOW_DIR=/tmp/malicious npx devflow-kit init
# settings.json now points to: /tmp/malicious/scripts/statusline.sh
# Attacker controls code executed by Claude CodeImpact
- Full code execution with user privileges
- Arbitrary command execution via malicious statusline.sh
- No user awareness of compromise
Solution
Validate that DEVFLOW_DIR is under home directory:
function getDevFlowDirectory(): string {
if (process.env.DEVFLOW_DIR) {
const dir = process.env.DEVFLOW_DIR;
const home = getHomeDirectory();
const resolved = path.resolve(dir);
// Only allow paths under home directory
if (!resolved.startsWith(home)) {
console.warn('⚠️ DEVFLOW_DIR must be under home directory, using default');
return path.join(home, '.devflow');
}
return resolved;
}
return path.join(getHomeDirectory(), '.devflow');
}Files to Modify
src/cli/commands/init.ts:39-45
Acceptance Criteria
- DEVFLOW_DIR is validated to be under home directory
- Warning logged if invalid path is provided
- Fallback to default path on validation failure
- Add test coverage for validation logic
- Update documentation with security note
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels