{"record":{"id":"e8a26f05cdbddbc1","repo":"Fission-AI/OpenSpec","slug":"path-is-outside-the-allowed-directory-specpath","errorCode":null,"errorMessage":"Path is outside the allowed directory: ${specPath}","messagePattern":"Path is outside the allowed directory: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/commands/spec.ts","lineNumber":22,"sourceCode":"import { MarkdownParser } from '../core/parsers/markdown-parser.js';\nimport { Validator } from '../core/validation/validator.js';\nimport type { Spec } from '../core/schemas/index.js';\nimport type { RootOutput } from '../core/root-selection.js';\nimport { isInteractive } from '../utils/interactive.js';\nimport { getSpecIds } from '../utils/item-discovery.js';\nimport { discoverSpecFiles } from '../utils/spec-discovery.js';\nimport { FileSystemUtils } from '../utils/file-system.js';\n\nconst SPECS_DIR = 'openspec/specs';\n\nfunction assertSpecPath(specsDir: string, specPath: string): void {\n  const relativePath = path.relative(path.resolve(specsDir), path.resolve(specPath));\n  if (\n    relativePath === '..' ||\n    relativePath.startsWith(`..${path.sep}`) ||\n    path.isAbsolute(relativePath)\n  ) {\n    throw new Error(`Path is outside the allowed directory: ${specPath}`);\n  }\n\n  try {\n    // Preserve confined spec.md links, including links to a sibling capability.\n    FileSystemUtils.assertPathWithin(specsDir, specPath);\n  } catch {\n    // A capability directory may intentionally be a monorepo symlink. Treat it\n    // as the trust root while still rejecting a link outside that capability.\n    FileSystemUtils.assertPathWithin(path.dirname(specPath), specPath);\n  }\n}\n\ninterface ShowOptions {\n  json?: boolean;\n  // JSON-only filters (raw-first text has no filters)\n  requirements?: boolean;\n  scenarios?: boolean; // --no-scenarios sets this to false (JSON only)\n  requirement?: string; // JSON only","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/Fission-AI/OpenSpec/blob/6926ccb18afa4ff621112813e9968334576ee11a/src/commands/spec.ts#L4-L40","documentation":"Error \"Path is outside the allowed directory: ${specPath}\" thrown in Fission-AI/OpenSpec.","triggerScenarios":"Thrown at src/commands/spec.ts:22 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":"6926ccb18afa4ff621112813e9968334576ee11a","analyzedAt":"2026-08-25T12:29:45.729Z","schemaVersion":2},"datasetVersion":"2026-08-25T16:17:27.014Z"}