Skip to content

Commit 7c1ea36

Browse files
committed
chore: apply AI code review suggestions from PR #42
- hooks/deny-vendor-write.sh: fail-open → fail-closed for path canonicalization (cubic-dev-ai: path traversal bypass via realpath failure) - .claude/commands/generate-skill.md: quote $ARGUMENTS in shell commands (cubic-dev-ai: word-splitting/path expansion bugs with unquoted variables)
1 parent 0f4fbdd commit 7c1ea36

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

.claude/commands/generate-skill.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Follow the guidelines in `docs/skills-generator.md` to generate Type 1 skills.
1818
- `references/*.md` — one file per concept (prefixed by category, e.g. `core-syntax.md`, `features-plugins.md`)
1919
5. **Copy** the generated skills into the plugin directory:
2020
```bash
21-
mkdir -p plugins/$ARGUMENTS/skills/$ARGUMENTS/ && cp -r skills/$ARGUMENTS/. plugins/$ARGUMENTS/skills/$ARGUMENTS/
21+
mkdir -p "plugins/$ARGUMENTS/skills/$ARGUMENTS/" && cp -r "skills/$ARGUMENTS/." "plugins/$ARGUMENTS/skills/$ARGUMENTS/"
2222
```
2323
> Note: `bun run skills:sync` only handles Type 2 (vendor) and Type 3 (manual) skills.
2424
> Type 1 (generated) skills must be copied manually to the plugin directory.

hooks/deny-vendor-write.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,16 @@ case "$file_path" in
3636
esac
3737

3838
# .. 세그먼트를 정규화하여 경로 우회 방지 (realpath -m은 파일이 없어도 작동)
39-
abs_path="$(realpath -m "$abs_path" 2>/dev/null || echo "$abs_path")"
39+
# fail-open 대신 fail-closed: 경로 정규화 실패 시 요청 차단
40+
if ! abs_path="$(realpath -m "$abs_path" 2>/dev/null)"; then
41+
echo '{
42+
"hookSpecificOutput": {
43+
"permissionDecision": "deny",
44+
"permissionDecisionReason": "경로 정규화에 실패하여 요청을 차단했습니다."
45+
}
46+
}' >&2
47+
exit 2
48+
fi
4049

4150
# 쓰기 금지 디렉토리 목록 확인 (프로젝트 루트에 앵커링)
4251
project_dir="${CLAUDE_PROJECT_DIR%/}"

0 commit comments

Comments
 (0)