{"record":{"id":"d18482788d8c9f48","repo":"diegosouzapw/OmniRoute","slug":"skill-file-path-contains-a-restricted-segment","errorCode":null,"errorMessage":"Skill file path contains a restricted segment","messagePattern":"Skill file path contains a restricted segment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/lib/skills/builtins.ts","lineNumber":74,"sourceCode":"  // filesystem-safe key from the API key identifier for workspace isolation.\n  return createHash(\"sha256\") // lgtm[js/insufficient-password-hash]\n    .update(context.apiKeyId || \"anonymous\")\n    .digest(\"hex\")\n    .slice(0, 24);\n}\n\nfunction getWorkspaceRoot(context: { apiKeyId: string }) {\n  return path.join(resolveDataDir(), \"skills\", \"workspaces\", getContextId(context));\n}\n\nfunction resolveWorkspacePath(inputPath: string, context: { apiKeyId: string }) {\n  if (path.isAbsolute(inputPath)) {\n    throw new Error(\"Skill file paths must be relative to the skill workspace\");\n  }\n\n  const segments = inputPath.split(/[\\\\/]+/).filter(Boolean);\n  if (segments.some((segment) => FORBIDDEN_PATH_SEGMENTS.has(segment.toLowerCase()))) {\n    throw new Error(\"Skill file path contains a restricted segment\");\n  }\n\n  const root = path.resolve(getWorkspaceRoot(context));\n  const resolved = path.resolve(root, inputPath);\n  const relative = path.relative(root, resolved);\n  if (!relative || relative.startsWith(\"..\") || path.isAbsolute(relative)) {\n    throw new Error(\"Skill file path escapes the skill workspace\");\n  }\n\n  return { root, resolved, relative };\n}\n\nfunction normalizePositiveInteger(value: unknown, fallback: number, max: number) {\n  if (value === undefined || value === null) return fallback;\n  const parsed = Number(value);\n  if (!Number.isInteger(parsed) || parsed <= 0) return fallback;\n  return Math.min(parsed, max);\n}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/lib/skills/builtins.ts#L56-L92","documentation":"Error \"Skill file path contains a restricted segment\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/lib/skills/builtins.ts:74 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}