Skip to content

Commit 9620522

Browse files
committed
fix: validate Kimi native-skills directory for symlink/containment
The Kimi fallback path (ai_skills=false) used is_dir() which follows symlinks, so a symlinked .kimi/skills could cause writes outside the project root. Now validates with _ensure_safe_shared_directory(create= False) before returning the directory.
1 parent fae1e6a commit 9620522

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/specify_cli/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,13 @@ def resolve_active_skills_dir(project_root: Path) -> Path | None:
353353

354354
if not ai_skills_enabled:
355355
# Kimi native-skills fallback: use the directory only if it exists.
356-
return skills_dir if skills_dir.is_dir() else None
356+
if not skills_dir.is_dir():
357+
return None
358+
_ensure_safe_shared_directory(
359+
project_root, skills_dir,
360+
create=False, context="agent skills directory",
361+
)
362+
return skills_dir
357363

358364
# ai_skills is explicitly enabled — create the directory safely.
359365
_ensure_safe_shared_directory(

0 commit comments

Comments
 (0)