mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 20:58:26 +00:00
fix(security): restrict skill download target paths
This commit is contained in:
11
src/agents/skills/tools-dir.ts
Normal file
11
src/agents/skills/tools-dir.ts
Normal 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);
|
||||
}
|
||||
Reference in New Issue
Block a user