Skip to content

Commit c372fd1

Browse files
committed
fix(security): skip hidden directories in skill template discovery
discoverTemplates() scans subdirectories for SKILL.md.tmpl files but only skips node_modules, .git, and dist. Hidden directories like .claude/, .agents/, and .codex/ (which contain symlinked skill installs) were being scanned, allowing a malicious .tmpl in a symlinked skill to inject into the generation pipeline. Fix: add !d.name.startsWith('.') to the subdirs() filter. This skips all dot-prefixed directories, matching the standard convention that hidden dirs are not source code.
1 parent 3501f5d commit c372fd1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

scripts/discover-skills.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const SKIP = new Set(['node_modules', '.git', 'dist']);
1010

1111
function subdirs(root: string): string[] {
1212
return fs.readdirSync(root, { withFileTypes: true })
13-
.filter(d => d.isDirectory() && !SKIP.has(d.name))
13+
.filter(d => d.isDirectory() && !d.name.startsWith('.') && !SKIP.has(d.name))
1414
.map(d => d.name);
1515
}
1616

0 commit comments

Comments
 (0)