fix(security): skip hidden directories in skill template discovery#433
Open
HMAKT99 wants to merge 1 commit intogarrytan:mainfrom
Open
fix(security): skip hidden directories in skill template discovery#433HMAKT99 wants to merge 1 commit intogarrytan:mainfrom
HMAKT99 wants to merge 1 commit intogarrytan:mainfrom
Conversation
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.
hmzyly
pushed a commit
to hmzyly/gstack
that referenced
this pull request
Mar 24, 2026
- Add handoff/SKILL.md.tmpl and handoff/SKILL.md: structured context transfer between agents. Captures decisions, assumptions, danger zones, and open threads. Two modes: quick (~30s) and deep (~2min, default). Artifact lands at HANDOFF.md (gitignored) and is auto-injected into CLAUDE.md so the next agent loads it automatically. - Fix security issue garrytan#433: skip dot-prefixed directories in discoverTemplates() to prevent malicious symlinked .tmpl files in .claude/.agents/.codex/ from being discovered and processed. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
discoverTemplates()inscripts/discover-skills.tsscans subdirectories for.tmplfilesnode_modules,.git,dist.claude/,.agents/,.codex/) were being scanned.tmplin a symlinked skill directory would be discovered and processed bygen-skill-docsFix
Skips all dot-prefixed directories. All 28 legitimate skills still generate. All tests pass.
1 file, 1 line changed
scripts/discover-skills.tsTest plan
.claude/,.agents/,.codex/directories skipped