Expand description
Core data model for cargo-allow source-tree exception governance.
This crate defines the shared finding, policy-entry, selector, lifecycle, match-outcome, path-normalization, and stable fingerprint primitives used by the cargo-allow crate family. It does not scan source files, invoke Cargo, compile code, or execute repository artifacts.
Structs§
- Allow
Config - Allow
Entry - Cargo
Allow Diagnostic - Structured validation or execution detail.
- Cargo
Allow Error - The unified error type for the cargo-allow workspace.
- Cargo
Allow Error Location - One-based source location attached to a parse or validation diagnostic.
- Finding
- Lane
Config - Last
Seen - Ledger
Posture - Orthogonal movement and posture delta for a ledger-state projection.
- Ledger
Provenance - Lifecycle
- Match
Outcome - Requirements
- Per-ledger requirements toggles. Defaults are intentionally strict on
ownership/accountability (
owner/reason/classification/lifecycle required) and on unsafe findings (unsafe_evidence_required: true) while ordinary evidence is advisory by default (evidence_required: false). - Selector
- Simple
Date - Span
- Structural
Identity - Workspace
Config
Enums§
- Capped
Read Error - Why a capped text read failed.
- Cargo
Allow Diagnostic Severity - Severity for a machine-readable diagnostic carried by a command error.
- Cargo
Allow Error Kind - Structured kind for
CargoAllowError, enabling programmatic consumers (CI tooling, sibling tools) to branch on error class instead of string-matching the rendered message. - Finding
Kind - Lane
Enforcement Mode - Match
Status - NetPosture
- Aggregate PR diff net posture for summary surfaces (
diff.net_posture). - Posture
Delta - Canonical posture quality delta for a retained ledger entry or finding.
- Presence
Movement - Canonical presence movement for ledger entries and findings in a diff context.
- Workspace
Mode - The supported workspace default check modes, mirroring the CLI
--modeflag and the[workspace] default_modepolicy field. A typo’d or unsupported value (e.g."no_new") is rejected at validation time rather than silently treated as a string that never matches a real mode.
Constants§
- GLOB_
MATCH_ MAX_ STEPS - Maximum recursive match steps for one glob evaluation.
- MAX_
IDENTITY_ FIELD_ LEN - Maximum length (bytes) of any source-derived string field in a
StructuralIdentity. Caps the DoS / noisy-diff surface from a scanned file with a megabyte-long identifier (#1919). Generous enough for realistic Rust paths/identifiers (e.g. deeply-qualified module paths), small enough that an artifact cannot be inflated by a single field. - POLICY_
NAME - The only recognized policy name.
- SOURCE_
FILE_ READ_ MAX_ BYTES - Maximum bytes cargo-allow will load from one source-tree text file.
- STRUCTURAL_
IDENTITY_ SCHEMA_ ID - SUPPORTED_
SCHEMA_ VERSION - Supported policy schema versions.
"1"is accepted as a legacy alias. - SUPPORTED_
SCHEMA_ VERSION_ ALIAS
Functions§
- allow_
entry_ broad_ scope - allow_
entry_ content_ fingerprint - Deterministic content fingerprint of an allow entry’s full state, for
mutation-receipt provenance (CARGO-ALLOW-SPEC-0008 “Mutation Receipt
Envelope”). The
v1canonical serialization is length-prefixed and has a fixed field order, so it is independent of Rust’sDebugformatting and platform path separators —path,glob, andselector.globare all slash-normalized before hashing, so semantically identical entries authored on Windows and Unix fingerprint identically. The SHA-256 digest is provenance evidence, not an identity or matching key. - effective_
lane_ posture_ for_ findings - finding_
identity_ key - glob_
matches - glob_
matches_ str - json_
escape - lane_
enforcement_ mode_ for_ kind - normalize_
path - normalize_
snippet - read_
text_ file_ capped - Read a UTF-8 text file only when its size is within
SOURCE_FILE_READ_MAX_BYTES. - read_
text_ file_ capped_ with_ limit - Read a UTF-8 text file only when its size is within
limitbytes. - source_
tree_ path_ is_ ignored - source_
tree_ path_ matches_ filter - source_
tree_ scope_ has_ wildcard - stable_
hash_ hex