fix(security): restrict skill download target paths

This commit is contained in:
Peter Steinberger
2026-02-16 03:46:32 +01:00
parent c6c53437f7
commit 2363e1b085
9 changed files with 442 additions and 324 deletions

View File

@@ -0,0 +1,11 @@
import path from "node:path";
import type { SkillEntry } from "./types.js";
import { safePathSegmentHashed } from "../../infra/install-safe-path.js";
import { resolveConfigDir } from "../../utils.js";
import { resolveSkillKey } from "./frontmatter.js";
export function resolveSkillToolsRootDir(entry: SkillEntry): string {
const key = resolveSkillKey(entry.skill, entry);
const safeKey = safePathSegmentHashed(key);
return path.join(resolveConfigDir(), "tools", safeKey);
}