Skip to main content

allow_core/
lib.rs

1//! Core data model for cargo-allow source-tree exception governance.
2//!
3//! This crate defines the shared finding, policy-entry, selector, lifecycle,
4//! match-outcome, path-normalization, and stable fingerprint primitives used by
5//! the cargo-allow crate family. It does not scan source files, invoke Cargo,
6//! compile code, or execute repository artifacts.
7
8mod actionable_diagnostic;
9mod capped_read;
10mod companion_family;
11mod date;
12mod error;
13mod finding;
14mod fingerprint;
15mod json;
16mod lane_posture;
17mod ledger_posture;
18mod ledger_provenance;
19mod policy;
20mod source_tree_path;
21pub use actionable_diagnostic::{
22    ActionApplicability, ActionKind, CargoAllowActionV1, CargoAllowDiagnosticBatchV1,
23    CargoAllowDiagnosticV1, DIAGNOSTIC_KERNEL_SCHEMA, DiagnosticConfidence, DiagnosticResultClass,
24    DiagnosticSeverity, MissingObligation, PartialDataBoundary, PositionBase, RelatedLocation,
25    RelatedRole, RequiredProof, RulePosture, SourceEncoding, SourcePosition, SourceProvenance,
26    SourceRange,
27};
28pub use capped_read::{
29    CappedReadError, SOURCE_FILE_READ_MAX_BYTES, read_file_capped, read_file_capped_with_limit,
30    read_text_file_capped, read_text_file_capped_with_limit,
31};
32pub use companion_family::{REPOSITORY_WIDE_FAMILIES, is_repository_wide_family};
33pub use date::SimpleDate;
34pub use error::{
35    CargoAllowDiagnostic, CargoAllowDiagnosticSeverity, CargoAllowError, CargoAllowErrorKind,
36    CargoAllowErrorLocation, CargoAllowResult,
37};
38pub use finding::{
39    Finding, FindingKind, MAX_IDENTITY_FIELD_LEN, STRUCTURAL_IDENTITY_SCHEMA_ID, Span,
40    StructuralIdentity, finding_identity_key,
41};
42pub use fingerprint::{
43    allow_entry_content_fingerprint, normalize_snippet, sha256_v1_bytes, stable_hash_hex,
44};
45pub use json::json_escape;
46pub use lane_posture::{
47    LaneConfig, LaneEnforcementMode, effective_lane_posture_for_findings,
48    lane_enforcement_mode_for_kind,
49};
50pub use ledger_posture::{LedgerPosture, NetPosture, PostureDelta, PresenceMovement};
51pub use ledger_provenance::LedgerProvenance;
52pub use policy::{
53    AllowConfig, AllowEntry, BUILTIN_FILE_FAMILY_CODES, FileFamilyRule, LastSeen, Lifecycle,
54    MatchOutcome, MatchStatus, POLICY_NAME, Requirements, SUPPORTED_SCHEMA_VERSION,
55    SUPPORTED_SCHEMA_VERSION_ALIAS, Selector, WorkspaceConfig, WorkspaceMode,
56};
57pub use source_tree_path::{
58    GLOB_MATCH_MAX_STEPS, allow_entry_broad_scope, glob_matches, glob_matches_str, normalize_path,
59    source_tree_path_is_ignored, source_tree_path_matches_filter, source_tree_scope_has_wildcard,
60    strip_win32_verbatim_prefix,
61};
62
63#[cfg(test)]
64mod tests;