{"record":{"id":"6224506de74aee1b","repo":"paperclipai/paperclip","slug":"invalid-log-path","errorCode":null,"errorMessage":"Invalid log path","messagePattern":"Invalid log path","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/src/services/workspace-operation-log-store.ts","lineNumber":48,"sourceCode":"export interface WorkspaceOperationLogStore {\n  begin(input: { companyId: string; operationId: string }): Promise<WorkspaceOperationLogHandle>;\n  append(\n    handle: WorkspaceOperationLogHandle,\n    event: { stream: \"stdout\" | \"stderr\" | \"system\"; chunk: string; ts: string },\n  ): Promise<void>;\n  finalize(handle: WorkspaceOperationLogHandle): Promise<WorkspaceOperationLogFinalizeSummary>;\n  read(handle: WorkspaceOperationLogHandle, opts?: WorkspaceOperationLogReadOptions): Promise<WorkspaceOperationLogReadResult>;\n}\n\nfunction safeSegments(...segments: string[]) {\n  return segments.map((segment) => segment.replace(/[^a-zA-Z0-9._-]/g, \"_\"));\n}\n\nfunction resolveWithin(basePath: string, relativePath: string) {\n  const resolved = path.resolve(basePath, relativePath);\n  const base = path.resolve(basePath) + path.sep;\n  if (!resolved.startsWith(base) && resolved !== path.resolve(basePath)) {\n    throw new Error(\"Invalid log path\");\n  }\n  return resolved;\n}\n\nfunction createLocalFileWorkspaceOperationLogStore(basePath: string): WorkspaceOperationLogStore {\n  async function ensureDir(relativeDir: string) {\n    const dir = resolveWithin(basePath, relativeDir);\n    await fs.mkdir(dir, { recursive: true });\n  }\n\n  async function readFileRange(filePath: string, offset: number, limitBytes: number): Promise<WorkspaceOperationLogReadResult> {\n    const stat = await fs.stat(filePath).catch(() => null);\n    if (!stat) throw notFound(\"Workspace operation log not found\");\n\n    const start = Math.max(0, Math.min(offset, stat.size));\n    const end = Math.max(start, Math.min(start + limitBytes - 1, stat.size - 1));\n\n    if (start > end) {","sourceCodeStart":30,"sourceCodeEnd":66,"githubUrl":"https://github.com/paperclipai/paperclip/blob/120ae5428fa29bee300bcf806491cd4d965fbb7c/server/src/services/workspace-operation-log-store.ts#L30-L66","documentation":"resolveWithin path-safety guard inside the workspace operation log store: joining the provided segments and resolving them produced a path that escapes the intended root directory (or is otherwise invalid). The error protects log storage from traversal-style paths before any file is opened.","triggerScenarios":"Thrown at server/src/services/workspace-operation-log-store.ts:48 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Provide a valid log path within the allowed log directory; absolute or traversal paths are rejected."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"120ae5428fa29bee300bcf806491cd4d965fbb7c","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}