Kong/insomnia · error · Error

Proto path escapes temporary directory: "${candidatePath}"

Error message

Proto path escapes temporary directory: "${candidatePath}"

What it means

Error "Proto path escapes temporary directory: "${candidatePath}"" thrown in Kong/insomnia.

Source

Thrown at packages/insomnia/src/network/grpc/write-proto-file.node.ts:26

import { database as db } from '../../common/database';

const { isProtoDirectory } = models.protoDirectory;
const { isProtoFile } = models.protoFile;

interface WriteResult {
  filePath: string;
  dirs: string[];
}

const sanitizeName = (name: string): string => {
  const base = path.basename(name);
  return !base || base === '..' || base === '.' ? '_' : base;
};

const assertWithinTempRoot = (tempRoot: string, candidatePath: string): void => {
  const relative = path.relative(tempRoot, candidatePath);
  if (relative.startsWith('..') || path.isAbsolute(relative)) {
    throw new Error(`Proto path escapes temporary directory: "${candidatePath}"`);
  }
};

const recursiveWriteProtoDirectory = async (
  dir: ProtoDirectory,
  descendants: BaseModel[],
  currentDirPath: string,
  tempRoot: string,
): Promise<string[]> => {
  const dirPath = path.join(currentDirPath, sanitizeName(dir.name));
  assertWithinTempRoot(tempRoot, dirPath);
  fs.mkdirSync(dirPath, { recursive: true });
  // Get and write proto files
  const files = descendants.filter(isProtoFile).filter(f => f.parentId === dir._id);
  await Promise.all(
    files.map(protoFile => {
      const fullPath = path.join(dirPath, sanitizeName(protoFile.name));
      assertWithinTempRoot(tempRoot, fullPath);

View on GitHub (pinned to d9bb2b0142)

When it happens

Trigger: Thrown at packages/insomnia/src/network/grpc/write-proto-file.node.ts:26 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Kong/insomnia@d9bb2b0142 (2026-08-26). Data as JSON: /api/errors/ad2e805fb751c74c. Report an issue: GitHub.