{"record":{"id":"c0b3210d5055349a","repo":"paperclipai/paperclip","slug":"daytona-sync-label-path-escapes-the-workspace-r","errorCode":null,"errorMessage":"Daytona sync ${label} path escapes the workspace remote dir: ${candidate}","messagePattern":"Daytona sync (.+?) path escapes the workspace remote dir: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/plugins/sandbox-providers/daytona/src/file-sync.ts","lineNumber":125,"sourceCode":"function shellQuote(value: string): string {\n  return `'${value.replace(/'/g, `'\"'\"'`)}'`;\n}\n\n/**\n * Convert a POSIX numeric mode (e.g. `0o600`) to the octal string the Daytona\n * SDK's `setFilePermissions` expects (e.g. `\"600\"`), masked to the permission\n * bits so an accidental type flag never widens the mode.\n */\nfunction toOctalModeString(mode: number): string {\n  return (mode & 0o7777).toString(8).padStart(3, \"0\");\n}\n\n/**\n * Host-side complete-mediation guard applied as defense-in-depth below the\n * orchestrator's own confinement. Every sandbox-side path (the sync target for\n * inbound, the sync source for outbound) MUST canonicalize inside the workspace\n * remote dir; absolute escapes and `..` traversal are rejected fail-closed before\n * any bytes move. Sandbox paths on the server are POSIX.\n */\nexport function assertConfinedSandboxPath(remoteDir: string, candidate: string, label: string): void {\n  const normalizedRoot = path.posix.normalize(remoteDir);\n  const normalized = path.posix.normalize(candidate);\n  if (\n    !path.posix.isAbsolute(normalized) ||\n    normalized === \"..\" ||\n    normalized.includes(\"/../\") ||\n    normalized.endsWith(\"/..\")\n  ) {\n    throw new Error(`Daytona sync ${label} path is not a confined absolute path: ${candidate}`);\n  }\n  const prefix = normalizedRoot.endsWith(\"/\") ? normalizedRoot : `${normalizedRoot}/`;\n  if (normalized !== normalizedRoot && !normalized.startsWith(prefix)) {\n    throw new Error(`Daytona sync ${label} path escapes the workspace remote dir: ${candidate}`);\n  }\n}\n","sourceCodeStart":107,"sourceCodeEnd":143,"githubUrl":"https://github.com/paperclipai/paperclip/blob/3f1d897a7c018d76563a21c6e39c3c9b03933622/packages/plugins/sandbox-providers/daytona/src/file-sync.ts#L107-L143","documentation":"Traversal-escape guard in assertConfinedSandboxPath: the candidate path is absolute but path.posix.normalize places it outside the workspace remote dir root (e.g. via leading '..' segments). Rejecting it prevents an untrusted sandbox-side path from reading or writing host files outside the confined workspace tree during sync.","triggerScenarios":"Thrown at packages/plugins/sandbox-providers/daytona/src/file-sync.ts:121 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Keep the sync path inside the workspace remote dir; remove '..' or absolute escapes."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"3f1d897a7c018d76563a21c6e39c3c9b03933622","analyzedAt":"2026-08-18T22:49:45.177Z","contentChangedAt":"2026-08-18T22:49:45.177Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}