diegosouzapw/OmniRoute · error
Skill file paths must be relative to the skill workspace
Error message
Skill file paths must be relative to the skill workspace
What it means
Path-traversal guard in resolveWorkspacePath: skill file operations accept only paths relative to the per-API-key workspace root. path.isAbsolute() detected an absolute input path (e.g. /etc/passwd or C:\...), which would bypass workspace isolation if resolved. This is a security boundary rejection of the caller-supplied path.
Solutions
- Pass a relative path anchored at the skill workspace root
- Strip leading slashes or drive letters before calling file_read/file_write
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/lib/skills/builtins.ts:69 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of diegosouzapw/OmniRoute@a179ffed5b (2026-08-25).
Data as JSON: /api/errors/81bd482044bddae5.
Report an issue: GitHub.
Appendix: source
Thrown at src/lib/skills/builtins.ts:69
"proxy-authorization",
]);
function getContextId(context: { apiKeyId: string }) {
// Not a password hash — SHA-256 is used here only to derive a short, stable
// filesystem-safe key from the API key identifier for workspace isolation.
return createHash("sha256") // lgtm[js/insufficient-password-hash]
.update(context.apiKeyId || "anonymous")
.digest("hex")
.slice(0, 24);
}
function getWorkspaceRoot(context: { apiKeyId: string }) {
return path.join(resolveDataDir(), "skills", "workspaces", getContextId(context));
}
function resolveWorkspacePath(inputPath: string, context: { apiKeyId: string }) {
if (path.isAbsolute(inputPath)) {
throw new Error("Skill file paths must be relative to the skill workspace");
}
const segments = inputPath.split(/[\\/]+/).filter(Boolean);
if (segments.some((segment) => FORBIDDEN_PATH_SEGMENTS.has(segment.toLowerCase()))) {
throw new Error("Skill file path contains a restricted segment");
}
const root = path.resolve(getWorkspaceRoot(context));
const resolved = path.resolve(root, inputPath);
const relative = path.relative(root, resolved);
if (!relative || relative.startsWith("..") || path.isAbsolute(relative)) {
throw new Error("Skill file path escapes the skill workspace");
}
return { root, resolved, relative };
}
function normalizePositiveInteger(value: unknown, fallback: number, max: number) {View on GitHub (pinned to a179ffed5b)