Documentation
¶
Overview ¶
The S1 half of local/remote validation parity.
Without it, `agentry validate` would run only the manifest V-rules and the S3/S4 content scan. That leaves a real gap: a committed .dylib, a vendored tarball, or a Latin-1 README passes locally and is rejected by the server's S1 inventory at submit — the "works on my machine, fails at publish" round-trip that parity exists to prevent.
This file closes that gap by running the same three S1 checks the pipeline runs, over the resolved include set, with the same severities:
S1/binary-executable critical content-sniffed ELF/Mach-O/PE/class S1/nested-archive critical content-sniffed zip/gzip/zstd/bzip2/xz/tar S1/non-utf8 low text file that is not valid UTF-8
Detection is by MAGIC BYTES, never by extension: renaming evil.so to notes.md is the first thing anyone tries, and the server is not fooled by it either.
The fourth S1-adjacent check, oversized files against the archive quotas — is deliberately NOT repeated here: manifest rule V8 already enforces MaxFiles/MaxFileBytes/MaxImageFileBytes/MaxArchiveBytes over the same resolved include set, in the same command, and reporting one oversized file twice would make the output worse rather than safer.
Parity is by construction: the detection predicates are pkg/archive's, the ones the server's S1 stage classifies with (below).
Package validate is `agentry validate`'s workspace check: offline parity with the server's submit validation — every manifest rule pkg/manifest reports (ManifestRules), the S1 inventory subset (localscan.go), and the S3/S4 scan via pkg/rules, run over the files publish would actually ship. It lives outside the command's main package so that the Drafter's post-step (pkg/drafter) checks a draft with the same code in every client: `agentry validate`, `agentry draft` and the desktop's draft on this computer write one report, the `validate --json` shape.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Embedded ¶
Embedded is the S4 bundle embedded in this binary, the floor every client validates under.
func ManifestRules ¶
func ManifestRules() string
ManifestRules names the manifest rules a validation runs, in the form the report and the command's help print them ("V1-V5, V7-V11"). It is read from pkg/manifest's own rule list, so a rule the core adds is named here without a change in this repository.
Types ¶
type Finding ¶
type Finding struct {
RuleID string `json:"ruleId"`
Scanner string `json:"scanner"`
Severity string `json:"severity"`
Confidence string `json:"confidence"`
Title string `json:"title"`
FilePath string `json:"filePath"`
LineStart int `json:"lineStart,omitempty"`
LineEnd int `json:"lineEnd,omitempty"`
Excerpt string `json:"excerpt,omitempty"`
Detail map[string]string `json:"detail,omitempty"`
}
Finding is one S3/S4 scanner hit.
type InventoryFinding ¶
type InventoryFinding struct {
Scanner string `json:"scanner"`
Severity string `json:"severity"`
Title string `json:"title"`
FilePath string `json:"filePath"`
Detail string `json:"detail,omitempty"`
}
InventoryFinding is one S1-subset result.
type Issue ¶
type Issue struct {
Rule string `json:"rule"`
Severity string `json:"severity"`
Path string `json:"path,omitempty"`
Message string `json:"message"`
}
Issue is one manifest rule's result.
type Manifest ¶
type Manifest struct {
Namespace string `json:"namespace"`
Name string `json:"name"`
Version string `json:"version"`
SchemaVersion int `json:"schemaVersion"`
Modes []string `json:"modes"`
}
Manifest is the report's header: what agent.yaml said about itself.
type Options ¶
type Options struct {
// Strict treats manifest warnings as errors.
Strict bool
// Out is the narration, ErrOut its notes; nil discards them.
Out, ErrOut io.Writer
// Rules loads the S4 signature bundle and says where it came from; nil
// is the bundle embedded in this binary (Embedded). A loader that fails
// fails the check: it never passes content S4 did not examine.
Rules RulesLoader
}
Options are how a workspace is checked.
type Report ¶
type Report struct {
Passed bool `json:"passed"`
// Manifest is what agent.yaml said about itself.
Manifest Manifest `json:"manifest"`
// Issues are the manifest rules' results, errors and warnings.
Issues []Issue `json:"issues"`
// Inventory is the S1 subset over the resolved include set.
Inventory []InventoryFinding `json:"inventory"`
// Findings are the S3/S4 scanner hits.
Findings []Finding `json:"findings"`
// ReadErrors are include-set files that could not be read.
ReadErrors []string `json:"readErrors"`
FileCount int `json:"fileCount"`
Bundle struct {
Version string `json:"version"`
Source string `json:"source"`
} `json:"bundle"`
Counts struct {
Errors int `json:"errors"`
Warnings int `json:"warnings"`
InventoryFailing int `json:"inventoryFailing"`
Findings int `json:"findings"`
} `json:"counts"`
Strict bool `json:"strict"`
}
Report is the `validate --json` shape: the rules and scan findings as data, and the verdict `publish` would reach. A draft's draft.json carries it as its validation.