paperclipai/paperclip · error

Kubernetes sync ${label} path escapes the workspace remote d

Error message

Kubernetes sync ${label} path escapes the workspace remote dir: ${candidate}

What it means

Error "Kubernetes sync ${label} path escapes the workspace remote dir: ${candidate}" thrown in paperclipai/paperclip.

Source

Thrown at packages/plugins/sandbox-providers/kubernetes/src/file-sync.ts:137

 * inbound, the sync source for outbound) MUST be an absolute path that
 * canonicalizes lexically inside the workspace remote dir; absolute escapes and
 * `..` traversal are rejected fail-closed before any bytes move. Sandbox paths
 * are POSIX.
 */
export function assertConfinedSandboxPath(remoteDir: string, candidate: string, label: string): void {
  const normalizedRoot = path.posix.normalize(remoteDir);
  const normalized = path.posix.normalize(candidate);
  if (
    !path.posix.isAbsolute(normalized) ||
    normalized === ".." ||
    normalized.includes("/../") ||
    normalized.endsWith("/..")
  ) {
    throw new Error(`Kubernetes sync ${label} path is not a confined absolute path: ${candidate}`);
  }
  const prefix = normalizedRoot.endsWith("/") ? normalizedRoot : `${normalizedRoot}/`;
  if (normalized !== normalizedRoot && !normalized.startsWith(prefix)) {
    throw new Error(`Kubernetes sync ${label} path escapes the workspace remote dir: ${candidate}`);
  }
}

/**
 * True when `relative` (a POSIX path) escapes its anchoring directory once
 * normalized: an absolute path, `..`, or a `..`-leading traversal all break out.
 */
function posixPathEscapes(relative: string): boolean {
  const normalized = path.posix.normalize(relative);
  return normalized === ".." || normalized.startsWith("../") || path.posix.isAbsolute(normalized);
}

async function withHostTempDir<T>(fn: (dir: string) => Promise<T>): Promise<T> {
  const dir = await fs.mkdtemp(path.join(os.tmpdir(), "paperclip-k8s-sync-"));
  try {
    return await fn(dir);
  } finally {
    await fs.rm(dir, { recursive: true, force: true }).catch(() => undefined);

View on GitHub (pinned to 120ae5428f)

Solutions

  1. Keep the sync path inside the workspace remote dir; remove '..' or absolute escapes.

When it happens

Trigger: Thrown at packages/plugins/sandbox-providers/kubernetes/src/file-sync.ts:137 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of paperclipai/paperclip@120ae5428f (2026-08-18). Data as JSON: /api/errors/fbf15ec009a7bb8d. Report an issue: GitHub.