T09 · Insecure Skill Coding Practices
- Location
index.ts:22- Finding
Unvalidated Agent Identifier Enables Path Traversal and Arbitrary File Overwrite
- Content
View full analysis
${targetPath}`, err); } return false; } ``` ```typescript function syncDir(sourceDir: string, targetDir: string): boolean { try { if (!fs.existsSync(sourceDir)) { return false; } if (!fs.existsSync(targetDir)) { fs.mkdirSync(targetDir, { recursive: true }); } const entries = fs.readdirSync(sourceDir, { withFileTypes: true }); for (const entry of entries) { const sourcePath = path.join(sourceDir, entry.name); const targetPath = path.join(targetDir, entry.name); if (entry.isDirectory()) { syncDir(sourcePath, targetPath); } else if (entry.isFile()) { // Always prefer the main Agent version and overwrite the target file fs.copyFileSync(sourcePath, targetPath); } } return true; } catch (err) { con ...[truncated 4597 chars]- Remediation
View remediation
