contractconfig

package
v0.8.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package contractconfig validates that the schema and fixtures paths configured in aiwf.yaml resolve to locations inside the consumer repo. Both `..` traversal and out-of-repo symlinks are rejected before any path is stat'd or passed to a validator.

The package is the single point of truth for path containment across contractcheck (which reports the finding) and contractverify (which refuses to invoke a validator on an escaped path).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Resolved

type Resolved struct {
	Entry        aiwfyaml.Entry
	SchemaPath   string
	FixturesPath string
	Skip         bool
}

Resolved is the post-validation view of one contracts.entries[] entry. SchemaPath and FixturesPath are absolute paths with symlinks evaluated, suitable for direct use by callers.

Skip is true when at least one path-escape finding was raised for this entry; callers must treat Skip == true as "do not stat, do not invoke the validator, do not proceed."

func Resolve

func Resolve(repoRoot string, entries []aiwfyaml.Entry) ([]Resolved, []check.Finding)

Resolve validates every entry's configured paths, returns the safe-to-use resolved forms, and emits one or two `contract-config` findings (subcode `path-escape`) per entry whose paths escape the repo root. repoRoot must be absolute.

A nil contracts argument yields nil resolved and nil findings.

The returned Resolved slice is in the same order as contracts.Entries. Entries whose paths are clean have Skip == false and absolute resolved paths populated; entries with any escape have Skip == true and the escaping path field empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL