santifer/career-ops · error · Error

output escapes the tracker workspace

Error message

output escapes the tracker workspace: ${entryOutput}

What it means

In the batch PDF renderer, every entry's output path is checked with isWorkspaceOutputPath() against the tracker workspace root (realpath-based, symlink-aware). A manifest entry whose resolved output falls outside the workspace is treated as malformed or tampered and recorded as a per-entry failure instead of being written.

Solutions

  1. Change the entry's output to a path inside the tracker workspace (e.g. output/042.pdf).
  2. If the file legitimately belongs elsewhere, render inside the workspace and move/copy it afterwards.
  3. Verify where workspaceRoot resolves (realpath) — a symlinked launch directory can make relative outputs escape unintentionally.

Example fix

// before (manifest entry)
{ "input": "cv.html", "output": "../shared/cv.pdf" }
// after
{ "input": "cv.html", "output": "output/cv.pdf" }
Defensive patterns

Strategy: validation

Validate before calling

import { resolve } from 'node:path';
const out = resolve(workspaceRoot, spec.output);
if (!out.startsWith(workspaceRoot + '/')) {
  throw new Error(`output must stay inside workspace: ${spec.output}`);
}

Try / catch

try {
  await renderEntry(spec);
} catch (err) {
  if (err.message.startsWith('output escapes the tracker workspace')) {
    failures.push({ entry: spec, reason: err.message });
  } else throw err;
}

Prevention

When it happens

Trigger: A batch manifest entry with an output path that resolves outside the workspace root — e.g. '../leak.pdf', '/tmp/x.pdf', or a symlinked ancestor that retargets outside the tree.

Common situations: Reusing manifests across machines or launch directories where a relative output resolves differently; deliberate or accidental paths with ../ segments; workspace root moved or symlinked so previously-valid outputs now resolve outside.

Understand the failure class

Background: Path traversal blocked: "path escapes the workspace" and "outside site root" errors when a path will not stay inside its allowed directory — this error's family across 26 libraries.

Related errors


AI-assisted analysis of santifer/career-ops@aac998c7ed (2026-09-16). Data as JSON: /api/errors/87444413b91a3a81. Report an issue: GitHub.

Appendix: source

Thrown at generate-pdf.mjs:1484

      const entryReport = (spec.reportNum ?? '').toString().trim();
      if (entryReport && !/^\d+$/.test(entryReport)) {
        throw new Error(`invalid reportNum "${entryReport}" (use the numeric report number)`);
      }

      // Resolve manifest-supplied input/output relative to the manifest's own
      // directory, not process.cwd(), so a manifest renders identically wherever
      // the batch is launched from. Absolute paths in the manifest still win
      // (resolve() ignores the base when the tail is absolute).
      const entryInput = resolve(manifestDir, spec.input);
      const entryOutput = resolve(manifestDir, spec.output);

      // Path-containment guards (realpath-based): keep the read and write inside
      // the tracker workspace even through a symlinked ancestor. A batch
      // manifest that escapes the workspace is malformed/tampered and is
      // recorded as a per-entry failure rather than read or written.
      assertInsideWorkspace(entryInput, 'input');
      if (!isWorkspaceOutputPath(entryOutput, workspaceRoot)) {
        throw new Error(`output escapes the tracker workspace: ${entryOutput}`);
      }

      let html = await readFile(entryInput, 'utf-8');
      // Same order as the single render: reorder first so the guard judges the
      // document that will actually be printed. Without this the batch path
      // rendered N CVs with cv.sections silently inert.
      html = reorderCvSections(html, cvSectionOrder);
      validateCvSectionOrder(html, cvMarkdown, { allowReorder: globals.allowReorder });
      html = normalizeTextForATS(html).html;

      entries.push({
        _idx: i,
        html,
        outputPath: entryOutput,
        format: entryFormat,
        baseDir: dirname(entryInput),
        reportNum: entryReport,
        inputPath: entryInput,

View on GitHub (pinned to aac998c7ed)