Kong/insomnia · error

appendToTimeline: timelinePath is outside the allowed…

Error message

appendToTimeline: timelinePath is outside the allowed responses directory or does not end in .timeline

What it means

Security guard in the appendToTimeline IPC handler: the supplied timelinePath resolves outside the allowed responses directory or does not end in .timeline, so writing is refused to prevent arbitrary file writes from the renderer.

Solutions

  1. Use the timeline path derived from a valid response ID
  2. Report if a valid timeline write is rejected due to path resolution
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at packages/insomnia/src/main/ipc/main.ts:204 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/27c327b9ab82b156. Report an issue: GitHub.

Appendix: source

Thrown at packages/insomnia/src/main/ipc/main.ts:204

const getResponsesDir = () => path.join(process.env.INSOMNIA_DATA_PATH || app.getPath('userData'), 'responses');

const responsesDirCreated = new Set<string>();

const getTimelinePath = (_: unknown, responseId: string) => {
  const base = path.resolve(getResponsesDir());
  const target = path.resolve(base, responseId + '.timeline');
  const relative = path.relative(base, target);
  if (relative.startsWith('..') || path.isAbsolute(relative)) {
    throw new Error('Invalid response ID');
  }
  return target;
};

const appendToTimeline = async (_: unknown, options: { timelinePath: string; data: string }) => {
  const allowedResponsesDir = getResponsesDir();
  const resolvedPath = path.resolve(options.timelinePath);
  if (!resolvedPath.startsWith(path.resolve(allowedResponsesDir) + path.sep) || !resolvedPath.endsWith('.timeline')) {
    throw new Error(
      'appendToTimeline: timelinePath is outside the allowed responses directory or does not end in .timeline',
    );
  }
  const dir = path.dirname(resolvedPath);
  if (!responsesDirCreated.has(dir)) {
    await fs.promises.mkdir(dir, { recursive: true });
    responsesDirCreated.add(dir);
  }
  await fs.promises.appendFile(resolvedPath, options.data);
};

export interface RendererToMainBridgeAPI {
  runTests: (src: string) => Promise<TestResults>;
  loginStateChange: (isLoggedIn: boolean) => void;
  openInBrowser: (url: string) => void;
  restart: () => void;
  halfSecondAfterAppStart: () => void;
  openDeepLink: (url: string) => void;

View on GitHub (pinned to d9bb2b0142)