diegosouzapw/OmniRoute · error

Skill file path escapes the skill workspace

Error message

Skill file path escapes the skill workspace

What it means

Path-containment guard in resolveWorkspacePath: the relative path passed the earlier checks, but resolving it against the workspace root produces a result outside that root — i.e. the input used ../ sequences to escape the per-API-key workspace. The resolution is refused to preserve workspace isolation between API keys.

Solutions

  1. Remove ../ segments that climb out of the workspace root
  2. Reference files that actually live inside the skill workspace
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at src/lib/skills/builtins.ts:81 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/75212ffe6ef9eaf3. Report an issue: GitHub.

Appendix: source

Thrown at src/lib/skills/builtins.ts:81

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) {
  if (value === undefined || value === null) return fallback;
  const parsed = Number(value);
  if (!Number.isInteger(parsed) || parsed <= 0) return fallback;
  return Math.min(parsed, max);
}

function sanitizeHeaders(headers: unknown) {
  if (!headers || typeof headers !== "object" || Array.isArray(headers)) return undefined;

  const sanitized: Record<string, string> = {};
  for (const [key, value] of Object.entries(headers as Record<string, unknown>)) {
    const normalizedKey = key.trim();

View on GitHub (pinned to a179ffed5b)