{"record":{"id":"2b037654c8a6d53f","repo":"paperclipai/paperclip","slug":"refusing-unsafe-provider-pack-output-path-outpu","errorCode":null,"errorMessage":"Refusing unsafe provider-pack output path: ${outputRoot}","messagePattern":"Refusing unsafe provider-pack output path: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/paperclip-runner/scripts/build-provider-pack.mjs","lineNumber":34,"sourceCode":"} from \"node:fs\";\nimport { tmpdir } from \"node:os\";\nimport { dirname, join, relative, resolve } from \"node:path\";\nimport { createRequire } from \"node:module\";\nimport { fileURLToPath } from \"node:url\";\n\nconst packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), \"..\");\nconst workspaceRoot = resolve(packageRoot, \"../..\");\nconst outputArgument = process.argv.slice(2).find((value) => value !== \"--\");\nconst outputRoot = resolve(\n  process.cwd(),\n  outputArgument ?? join(packageRoot, \"provider-pack\"),\n);\nif (\n  outputRoot === workspaceRoot ||\n  outputRoot === packageRoot ||\n  outputRoot === \"/\"\n) {\n  throw new Error(`Refusing unsafe provider-pack output path: ${outputRoot}`);\n}\n\nconst temporaryParent = mkdtempSync(join(tmpdir(), \"paperclip-provider-pack-\"));\nconst temporaryRoot = join(temporaryParent, \"pack\");\n\nfunction canonicalJson(value) {\n  if (Array.isArray(value)) return `[${value.map(canonicalJson).join(\",\")}]`;\n  if (value && typeof value === \"object\") {\n    return `{${Object.keys(value)\n      .sort()\n      .map((key) => `${JSON.stringify(key)}:${canonicalJson(value[key])}`)\n      .join(\",\")}}`;\n  }\n  return JSON.stringify(value);\n}\n\nfunction sha256File(path) {\n  return `sha256:${createHash(\"sha256\")","sourceCodeStart":16,"sourceCodeEnd":52,"githubUrl":"https://github.com/paperclipai/paperclip/blob/01ad8584922b5d85292b1723cae71fa0d9b07a19/packages/paperclip-runner/scripts/build-provider-pack.mjs#L16-L52","documentation":"Safety guard at the top of build-provider-pack.mjs: the resolved output root (CLI argument or default provider-pack dir) equals the workspace root, the package root, or another explicitly refused location. The script writes/deletes trees and refuses destructive output paths that would clobber the repository itself.","triggerScenarios":"Thrown at packages/paperclip-runner/scripts/build-provider-pack.mjs:34 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an explicit output directory outside the workspace and package roots","Use the default provider-pack output path instead of overriding it","If the default now collides with a refused path, move the workspace layout or update the refused-path list in the script"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"01ad8584922b5d85292b1723cae71fa0d9b07a19","analyzedAt":"2026-09-10T03:14:50.855Z","contentChangedAt":"2026-09-10T03:14:50.855Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}