JuliusBrussee/caveman · error

fixture path escapes root

Error message

fixture path escapes root: %q

What it means

Raised by the fixture reader closure in RunDir: after resolving symlinks, the referenced file lands outside the fixture root (Rel produced '..' or a non-subtree path). This confines fixture access to root even through symlinks — a security guard, not a mere typo check.

Solutions

  1. Remove symlink entries that point outside the fixture root
  2. Copy the referenced file inside root and update the manifest
  3. Repoint the manifest path to a file that lives under root
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at engine/evals/harness.go:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of JuliusBrussee/caveman@766dce6b13 (2026-08-18). Data as JSON: /api/errors/de6332407e9420f1. Report an issue: GitHub.

Appendix: source

Thrown at engine/evals/harness.go:140

	}
	var m Manifest
	if err := yaml.Unmarshal(manifestRaw, &m); err != nil {
		return Report{}, fmt.Errorf("parse manifest: %w", err)
	}
	if len(m.Fixtures) == 0 {
		return Report{}, fmt.Errorf("manifest has no fixtures")
	}
	read := func(name string) ([]byte, error) {
		if !fs.ValidPath(name) || name == "." {
			return nil, fmt.Errorf("invalid fixture path %q", name)
		}
		candidate, err := filepath.EvalSymlinks(filepath.Join(resolvedRoot, filepath.FromSlash(name)))
		if err != nil {
			return nil, err
		}
		rel, err := filepath.Rel(resolvedRoot, candidate)
		if err != nil || rel == ".." || strings.HasPrefix(rel, ".."+string(filepath.Separator)) {
			return nil, fmt.Errorf("fixture path escapes root: %q", name)
		}
		return os.ReadFile(candidate)
	}
	return RunManifest(m, read)
}

// RunWithQuality replays the embedded fixture set and also sends baseline and
// compressed prompts through a model runner before grading the answers.
func RunWithQuality(ctx context.Context, opts QualityOptions) (Report, error) {
	m, err := EmbeddedManifest()
	if err != nil {
		return Report{}, err
	}
	read := func(name string) ([]byte, error) {
		return fixturesFS.ReadFile("fixtures/" + name)
	}
	return RunManifestWithQuality(ctx, m, read, opts)
}

View on GitHub (pinned to 766dce6b13)