bug(skill-manifest): SKILL.md is read without a file-type or size check; a symlink to /dev/zero aborts the command
Pre-submission checklist
- I have searched existing issues and this bug has not already been reported
GSD Version
1.15.0 (next @ cf77f8030)
Runtime
All runtimes (the CLI command gsd-tools skill-manifest)
Operating System
Linux
Node.js Version
v24.20.0
Shell
bash
Installation Method
From a source checkout of next
What happened?
buildSkillManifest (src/init.cts) reads every SKILL.md under the skill roots with platformReadSync (src/init.cts:4718 and :4740 on next), which is fs.readFileSync with no file-type or size check. A repository can commit .claude/skills/<name>/SKILL.md as a symlink to /dev/zero; gsd-tools skill-manifest then allocates until V8 aborts. A FIFO would block the read instead.
@davesienkowski found this in review 5357051994 on #5079, where a health rule briefly routed /gsd-health through the same read. That rule was dropped from #5079; the read itself predates it.
What did you expect?
A SKILL.md that is not a regular file, or is larger than a limit, is skipped like a missing one. readSmallRegularFile (src/capability-ledger.cts) already reads other untrusted files that way: open once, fstat the descriptor, require a regular file, cap the size.
Steps to reproduce
$ mkdir -p repro/.claude/skills/evil && cd repro
$ ln -s /dev/zero .claude/skills/evil/SKILL.md
$ (ulimit -v 3000000; node <gsd-core>/gsd-core/bin/gsd-tools.cjs skill-manifest); echo "exit $?"The ulimit only keeps the reproduction bounded. With a regular SKILL.md in the same place, the command exits 0. Reproduced at 3ebe64e89; the read path is unchanged on next @ cf77f8030.
Error output / logs
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
exit 134Source: open-gsd/gsd-core