Immutable, append-only audit logging for compliance and security
| Tier | foundation |
| Role | unclassified (baselined) |
| Path | crates/foundation/audit-log |
| Edition | 2021 |
| Targets | audit-attest, fleet-inventory-gen, foundation_audit_log, attest_cluster, attest_inventory, attest_pure, pg_attest, pg_consumer_convergence, pg_starter_seed, pg_worm_enforcement |
| Public items | 213 across 21 modules |
| Tests | 236 |
What it is for
# foundation-audit-log
Immutable, append-only audit logging for compliance and security.
Answers "Who did what, when, and where?" with permanent records.
Core Principle
Audit logs are NEVER updated or deleted. Once created, a log entry is permanent.
Example
use foundation_audit_log::{AuditLog, Sensitivity, actions};
use uuid::Uuid;
// Log a model operation
let log = AuditLog::builder()
.action(actions::UPDATE)
.actor(Uuid::new_v4(), "john@example.com")
.target("posts.Post", "123", "Post: Hello World")
.sensitivity(Sensitivity::Normal)
.build();
// Log a non-model event
let event = AuditLog::event(actions::LOGIN_FAILED)
.actor_display("unknown@example.com")
.sensitivity(Sensitivity::High)
.build();
Capabilities
actions (other)
Standard audit log action constants.
| Item |
|---|
pub const CREATE: & str |
pub const UPDATE: & str |
pub const DELETE: & str |
pub const VIEW: & str |
pub const LOGIN: & str |
pub const LOGOUT: & str |
pub const LOGIN_FAILED: & str |
pub const PASSWORD_CHANGED: & str |
pub const SESSION_REVOKED: & str |
pub const PASSWORD_RESET_REQUESTED: & str |
pub const PERMISSION_DENIED: & str |
pub const EXPORT: & str |
pub const IMPORT: & str |
pub const CORRECTION: & str |
pub const ARCHIVE: & str |
pub const RESTORE: & str |
pub const APPROVE: & str |
pub const REJECT: & str |
pub const SUBMIT: & str |
attest::auth (other)
Authentication enforcement (Sprint 3.1, US-3.1.4).
| Item |
|---|
pub const INVALID_PASSWORD_SQLSTATE: & str |
pub const INVALID_AUTHORIZATION_SQLSTATE: & str |
pub const INVALID_CATALOG_SQLSTATE: & str |
pub const SENTINEL_PASSWORD: & str |
fn auth_probe_dsn(dsn : & str) -> Option <String> |
fn classify_audit_grants(role : & str, can_select : bool, can_insert : bool, can_update : bool, can_delete : bool,) -> CheckOutcome |
fn classify_backup_currency(database : & str, age_hours : Option <u64>, window_hours : u64,) -> CheckOutcome |
AuthProbeError
Authentication enforcement (Sprint 3.1, US-3.1.4).
| Item |
|---|
pub struct AuthProbeError |
fn classify_auth_probe(result : Result <(), AuthProbeError>) -> CheckOutcome |
attest::cluster (other)
Cluster-level authentication posture (Sprint 3.1, US-3.1.1).
| Item |
|---|
fn ipv4_mask_to_prefix(mask : & str) -> String |
fn check_hba_auth_methods(rules : & HbaRule) -> ClusterOutcome |
fn check_hba_exposure(rules : & HbaRule) -> ClusterOutcome |
fn check_login_passwords(roles : & LoginRole) -> ClusterOutcome |
ClusterCheckId
Cluster-level authentication posture (Sprint 3.1, US-3.1.1).
| Item |
|---|
pub enum ClusterCheckId |
ClusterCheckId :: fn as_str(self) -> & 'static str |
ClusterCheckId :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
ClusterOutcome
Cluster-level authentication posture (Sprint 3.1, US-3.1.1).
| Item |
|---|
pub struct ClusterOutcome |
fn check_transport_encryption(ssl_enabled : bool) -> ClusterOutcome |
HbaRule
Cluster-level authentication posture (Sprint 3.1, US-3.1.1).
| Item |
|---|
pub struct HbaRule |
LoginRole
Cluster-level authentication posture (Sprint 3.1, US-3.1.1).
| Item |
|---|
pub struct LoginRole |
attest::db (other)
The SQL shell: catalog inspection + the destructive-probe harness.
| Item |
|---|
async fn attest_cluster(admin_url : & str,) -> Result <Vec <super::cluster::ClusterOutcome>, sqlx::Error> |
async fn check_endpoint(c : & mut PgConnection) -> CheckOutcome |
async fn check_topology(c : & mut PgConnection) -> CheckOutcome |
async fn check_no_rules(c : & mut PgConnection) -> CheckOutcome |
async fn check_triggers(c : & mut PgConnection) -> CheckOutcome |
async fn check_truncate_guard_catalog(c : & mut PgConnection) -> CheckOutcome |
async fn check_event_guards(c : & mut PgConnection) -> CheckOutcome |
async fn check_ownership(c : & mut PgConnection, runtime_role : & str) -> CheckOutcome |
async fn check_force_rls(c : & mut PgConnection) -> CheckOutcome |
async fn check_row_hash(c : & mut PgConnection, statement_timeout_ms : u32) -> Vec <CheckOutcome> |
async fn observe_invariant(c : & mut PgConnection) -> Result <InvariantRecord, sqlx::Error> |
async fn check_fingerprint(c : & mut PgConnection, expected : Option <& str>) -> CheckOutcome |
AttestConfig
The SQL shell: catalog inspection + the destructive-probe harness.
| Item |
|---|
pub struct AttestConfig |
AttestConfig :: fn new(inspect_url : impl Into <String>, runtime_role : impl Into <String>) -> Self |
async fn probe_once(rt : & mut PgConnection, cfg : & AttestConfig, kind : ProbeKind, sql : & str,) -> CheckOutcome |
async fn attest(cfg : & AttestConfig) -> Result <Evidence, sqlx::Error> |
attest::evidence (other)
The per-database evidence record, and DSN redaction.
| Item |
|---|
fn redact_dsn(dsn : & str) -> String |
fn dsn_identity(dsn : & str) -> String |
Evidence
The per-database evidence record, and DSN redaction.
| Item |
|---|
pub struct Evidence |
Evidence :: fn new(dsn : & str, runtime_role : & str, checks : Vec <CheckOutcome>) -> Self |
Evidence :: fn with_fingerprints(mut self, expected : String, observed : String) -> Self |
attest::fingerprint (other)
Deployed-invariant fingerprinting.
| Item |
|---|
fn normalize_definition(src : & str) -> String |
fn is_definition_key(key : & str) -> bool |
pub const CANONICAL_FINGERPRINT: & str |
InvariantRecord
Deployed-invariant fingerprinting.
| Item |
|---|
pub struct InvariantRecord |
InvariantRecord :: fn new() -> Self |
InvariantRecord :: fn put(& mut self, key : impl Into <String>, value : impl AsRef <str>) |
InvariantRecord :: fn get(& self, key : & str) -> Option <& str> |
InvariantRecord :: fn len(& self) -> usize |
InvariantRecord :: fn is_empty(& self) -> bool |
InvariantRecord :: fn iter(& self) -> impl Iterator <Item =(& str, & str)> |
InvariantRecord :: fn drifted_keys(& self, other : & Self) -> Vec <String> |
InvariantRecord :: fn definitions(& self) -> Self |
fn fingerprint(record : & InvariantRecord) -> String |
EphemeralRule
The fleet inventory — the scope declaration for an attestation run.
| Item |
|---|
pub struct EphemeralRule |
Inventory
The fleet inventory — the scope declaration for an attestation run.
| Item |
|---|
pub struct Inventory |
Inventory :: fn len(& self) -> usize |
Inventory :: fn is_empty(& self) -> bool |
Inventory :: fn get(& self, name : & str) -> Option <& InventoryEntry> |
Inventory :: fn names(& self) -> impl Iterator <Item = & str> |
Inventory :: fn entries(& self) -> impl Iterator <Item = & InventoryEntry> |
Inventory :: fn is_ephemeral(& self, name : & str) -> bool |
Inventory :: fn undeclared <'a>(& self, live : & 'a String) -> Vec <& 'a String> |
fn parse_inventory(src : & str) -> Result <Inventory, InventoryError> |
InventoryEntry
The fleet inventory — the scope declaration for an attestation run.
| Item |
|---|
pub struct InventoryEntry |
InventoryEntry :: fn scope_state(& self) -> ScopeState |
InventoryError
The fleet inventory — the scope declaration for an attestation run.
| Item |
|---|
pub enum InventoryError |
InventoryError :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
attest::probe (other)
Destructive-probe classification — the attestor's sharpest edge.
| Item |
|---|
pub const WORM_SQLSTATE: & str |
fn classify_probe(kind : ProbeKind, result : Result <(), ProbeError>) -> CheckOutcome |
ProbeError
Destructive-probe classification — the attestor's sharpest edge.
| Item |
|---|
pub struct ProbeError |
ProbeKind
Destructive-probe classification — the attestor's sharpest edge.
| Item |
|---|
pub enum ProbeKind |
ProbeKind :: fn check_id(self) -> CheckId |
ProbeKind :: fn as_str(self) -> & 'static str |
FleetReport
Fleet roll-up: SOURCE COMPLETE is not DEPLOYED COMPLETE.
| Item |
|---|
pub struct FleetReport |
FleetReport :: fn new() -> Self |
FleetReport :: fn record(& mut self, database : impl Into <String>, state : ScopeState) |
FleetReport :: fn passing(& self) -> usize |
FleetReport :: fn failing(& self) -> usize |
FleetReport :: fn not_certified(& self) -> usize |
FleetReport :: fn len(& self) -> usize |
FleetReport :: fn is_empty(& self) -> bool |
FleetReport :: fn verdict(& self) -> CheckStatus |
FleetReport :: fn render_markdown(& self) -> String |
ScopeState
Fleet roll-up: SOURCE COMPLETE is not DEPLOYED COMPLETE.
| Item |
|---|
pub enum ScopeState |
ScopeState :: fn status(self) -> Option <CheckStatus> |
ScopeState :: fn label(self) -> String |
attest::status (other)
Check identity, evidence status, and the fail-closed roll-up.
| Item |
|---|
fn roll_up(checks : & CheckOutcome) -> CheckStatus |
CheckId
Check identity, evidence status, and the fail-closed roll-up.
| Item |
|---|
pub enum CheckId |
CheckId :: fn as_str(self) -> & 'static str |
CheckId :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
CheckOutcome
Check identity, evidence status, and the fail-closed roll-up.
| Item |
|---|
pub struct CheckOutcome |
CheckOutcome :: fn new(id : CheckId, status : CheckStatus, detail : impl Into <String>) -> Self |
CheckStatus
Check identity, evidence status, and the fail-closed roll-up.
| Item |
|---|
pub enum CheckStatus |
CheckStatus :: fn is_passing(self) -> bool |
CheckStatus :: fn as_str(self) -> & 'static str |
CheckStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
fn exit_code(verdict : CheckStatus) -> i32 |
AuditEventBuilder:AuditEventBuilder
Builder patterns for audit log entries.
| Item |
|---|
pub struct AuditEventBuilder |
AuditEventBuilder:actor
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn actor(mut self, id : Uuid, display : impl Into <String>) -> Self |
AuditEventBuilder :: fn actor_display(mut self, display : impl Into <String>) -> Self |
AuditEventBuilder:build
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn build(self) -> AuditLog |
AuditEventBuilder:ip
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn ip(mut self, ip : impl Into <String>) -> Self |
AuditEventBuilder:metadata
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn metadata(mut self, metadata : JsonValue) -> Self |
AuditEventBuilder:new
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn new(action : impl Into <String>) -> Self |
AuditEventBuilder:outcome
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn outcome(mut self, outcome : AuditOutcome) -> Self |
AuditEventBuilder:request
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn request_context(mut self, ctx : RequestContext) -> Self |
AuditEventBuilder:sensitivity
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn sensitivity(mut self, level : Sensitivity) -> Self |
AuditEventBuilder:source
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn source(mut self, source : AuditSource) -> Self |
AuditEventBuilder:system
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn system(mut self) -> Self |
AuditEventBuilder:tenant
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn tenant(mut self, tenant_id : Uuid) -> Self |
AuditEventBuilder:user
Builder patterns for audit log entries.
| Item |
|---|
AuditEventBuilder :: fn user_agent(mut self, ua : impl Into <String>) -> Self |
AuditLogBuilder:AuditLogBuilder
Builder patterns for audit log entries.
| Item |
|---|
pub struct AuditLogBuilder |
AuditLogBuilder:action
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn action(mut self, action : impl Into <String>) -> Self |
AuditLogBuilder:actor
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn actor(mut self, id : Uuid, display : impl Into <String>) -> Self |
AuditLogBuilder :: fn actor_display(mut self, display : impl Into <String>) -> Self |
AuditLogBuilder:build
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn build(self) -> AuditLog |
AuditLogBuilder:changes
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn changes(mut self, changes : JsonValue) -> Self |
AuditLogBuilder:ip
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn ip(mut self, ip : impl Into <String>) -> Self |
AuditLogBuilder:metadata
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn metadata(mut self, metadata : JsonValue) -> Self |
AuditLogBuilder:new
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn new() -> Self |
AuditLogBuilder:outcome
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn outcome(mut self, outcome : AuditOutcome) -> Self |
AuditLogBuilder:request
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn request_context(mut self, ctx : RequestContext) -> Self |
AuditLogBuilder :: fn request_id(mut self, id : impl Into <String>) -> Self |
AuditLogBuilder:sensitivity
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn sensitivity(mut self, level : Sensitivity) -> Self |
AuditLogBuilder:source
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn source(mut self, source : AuditSource) -> Self |
AuditLogBuilder:system
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn system(mut self) -> Self |
AuditLogBuilder:target
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn target(mut self, model_label : impl Into <String>, object_id : impl Into <String>, object_repr : impl Into <String>,) -> Self |
AuditLogBuilder:tenant
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn tenant(mut self, tenant_id : Uuid) -> Self |
AuditLogBuilder:trace
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn trace_id(mut self, id : impl Into <String>) -> Self |
AuditLogBuilder:user
Builder patterns for audit log entries.
| Item |
|---|
AuditLogBuilder :: fn user_agent(mut self, ua : impl Into <String>) -> Self |
Checkpoint
Signed Merkle checkpoints (Sprint 3.23A).
| Item |
|---|
pub struct Checkpoint |
Checkpoint :: fn signing_bytes(& self) -> Vec <u8> |
Checkpoint :: fn sign(& self, signing_key : & SigningKey) -> SignedCheckpoint |
SignedCheckpoint
Signed Merkle checkpoints (Sprint 3.23A).
| Item |
|---|
pub struct SignedCheckpoint |
SignedCheckpoint :: fn verify(& self, verifying_key : & VerifyingKey,) -> Result <(), foundation_crypto_sign::Error> |
RequestContext
Request context for audit logging.
| Item |
|---|
pub struct RequestContext |
RequestContext :: fn new() -> Self |
RequestContext :: fn with_ip(mut self, ip : impl Into <String>) -> Self |
RequestContext :: fn with_user_agent(mut self, ua : impl Into <String>) -> Self |
RequestContext :: fn with_request_id(mut self, id : impl Into <String>) -> Self |
RequestContext :: fn with_trace_id(mut self, id : impl Into <String>) -> Self |
RequestContext :: fn extract_ip_from_forwarded(forwarded : Option <& str>, direct : Option <& str>,) -> Option <String> |
RequestContext :: fn extract_client_ip(forwarded : Option <& str>, direct : Option <& str>, trusted_proxy_count : usize,) -> Option <String> |
InMemorySubjectKeyStore
De-identification model (Sprint 0.55, T4).
| Item |
|---|
pub struct InMemorySubjectKeyStore |
InMemorySubjectKeyStore :: fn new() -> Self |
InMemorySubjectKeyStore :: fn ensure(& mut self, subject_id : Uuid, key_material : Vec <u8>) -> Pseudonym |
InMemorySubjectKeyStore :: fn get(& self, subject_id : Uuid) -> Option <& u8> |
InMemorySubjectKeyStore :: fn pseudonym_of(& self, subject_id : Uuid) -> Option <Pseudonym> |
InMemorySubjectKeyStore :: fn shred(& mut self, subject_id : Uuid) -> Option <Pseudonym> |
InMemorySubjectKeyStore :: fn is_erased(& self, subject_id : Uuid) -> bool |
Pseudonym
De-identification model (Sprint 0.55, T4).
| Item |
|---|
pub struct Pseudonym |
Pseudonym :: fn random() -> Self |
Pseudonym :: fn from_uuid(id : Uuid) -> Self |
Pseudonym :: fn as_uuid(& self) -> Uuid |
fn row_affected_by(actor : Option <Pseudonym>, target : Option <Pseudonym>, subject : Pseudonym,) -> bool |
SubjectKeyStore
De-identification model (Sprint 0.55, T4).
| Item |
|---|
pub trait SubjectKeyStore |
AuditError
Error types for audit logging.
| Item |
|---|
pub enum AuditError |
hash (other)
Tamper-evidence library crates (Sprint 0.55, T3).
| Item |
|---|
fn canonicalize(value : & Value) -> Vec <u8> |
fn sha256_hex(bytes : & u8) -> String |
fn hmac_hex(key : & u8, data : & u8) -> String |
fn row_hash(key : & u8, payload : & Value) -> String |
fn merkle_root(leaf_hashes : & String) -> Option <String> |
Sha256Stream
Tamper-evidence library crates (Sprint 0.55, T3).
| Item |
|---|
pub struct Sha256Stream |
Sha256Stream :: fn new() -> Self |
Sha256Stream :: fn update(& mut self, chunk : & u8) |
Sha256Stream :: fn finalize_hex(self) -> String |
AuditLog
Audit log model.
| Item |
|---|
pub struct AuditLog |
AuditLog :: fn builder() -> AuditLogBuilder |
AuditLog :: fn event(action : impl Into <String>) -> AuditEventBuilder |
AuditLog :: fn login(actor_id : Uuid, display : impl Into <String>) -> AuditEventBuilder |
AuditLog :: fn logout(actor_id : Uuid, display : impl Into <String>) -> AuditEventBuilder |
AuditLog :: fn login_failed(attempted_identity : impl Into <String>) -> AuditEventBuilder |
AuditLog :: fn module(& self) -> Option <& str> |
AuditLog :: fn model_name(& self) -> Option <& str> |
AuditLog :: fn id(& self) -> Uuid |
AuditOutcome
Provenance for an audit entry: which surface it came from (source) and how
| Item |
|---|
pub enum AuditOutcome |
AuditOutcome :: fn as_str(& self) -> & 'static str |
AuditOutcome :: fn parse(s : & str) -> Option <Self> |
AuditOutcome :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
AuditSource
Provenance for an audit entry: which surface it came from (source) and how
| Item |
|---|
pub enum AuditSource |
AuditSource :: fn as_str(& self) -> & 'static str |
AuditSource :: fn parse(s : & str) -> Option <Self> |
AuditSource :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
redact (other)
Centralized, enforced redaction for audit changes / metadata payloads
| Item |
|---|
pub const REDACTED: & str |
pub const DEFAULT_MAX_STRING_LEN: usize |
pub const SECRET_KEY_DENYLIST: & & str |
fn is_secret_key(key : & str) -> bool |
fn redact(value : & Value) -> Value |
fn redact_with_limit(value : & Value, max_string_len : usize) -> Value |
Sensitivity
Sensitivity levels for audit log classification.
| Item |
|---|
pub enum Sensitivity |
Sensitivity :: fn as_str(& self) -> & 'static str |
Sensitivity :: fn parse(s : & str) -> Option <Self> |
Sensitivity :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result |
How to use it
From this crate's own rustdoc:
use foundation_audit_log::{AuditLog, Sensitivity, actions};
use uuid::Uuid;
// Log a model operation
let log = AuditLog::builder()
.action(actions::UPDATE)
.actor(Uuid::new_v4(), "john@example.com")
.target("posts.Post", "123", "Post: Hello World")
.sensitivity(Sensitivity::Normal)
.build();
// Log a non-model event
let event = AuditLog::event(actions::LOGIN_FAILED)
.actor_display("unknown@example.com")
.sensitivity(Sensitivity::High)
.build();
Module structure
foundation_audit_log
actionsattestattest::authattest::clusterattest::dbattest::evidenceattest::fingerprintattest::inventoryattest::probeattest::reportattest::statusbuildercheckpointcontextdeiderrorhashmodelprovenanceredactsensitivity
flowchart TD n_foundation_audit_log["foundation_audit_log"] n_foundation_audit_log --> n_actions["actions"] n_foundation_audit_log --> n_attest["attest"] n_attest --> n_attest__auth["auth"] n_attest --> n_attest__cluster["cluster"] n_attest --> n_attest__db["db"] n_attest --> n_attest__evidence["evidence"] n_attest --> n_attest__fingerprint["fingerprint"] n_attest --> n_attest__inventory["inventory"] n_attest --> n_attest__probe["probe"] n_attest --> n_attest__report["report"] n_attest --> n_attest__status["status"] n_foundation_audit_log --> n_builder["builder"] n_foundation_audit_log --> n_checkpoint["checkpoint"] n_foundation_audit_log --> n_context["context"] n_foundation_audit_log --> n_deid["deid"] n_foundation_audit_log --> n_error["error"] n_foundation_audit_log --> n_hash["hash"] n_foundation_audit_log --> n_model["model"] n_foundation_audit_log --> n_provenance["provenance"] n_foundation_audit_log --> n_redact["redact"] n_foundation_audit_log --> n_sensitivity["sensitivity"]
Public surface
`actions`
| Item | What it is |
|---|---|
pub const CREATE: & str | Create a new record. |
pub const UPDATE: & str | Update an existing record. |
pub const DELETE: & str | Delete a record (soft or hard). |
pub const VIEW: & str | View/read a record. |
pub const LOGIN: & str | Successful login. |
pub const LOGOUT: & str | Logout. |
pub const LOGIN_FAILED: & str | Failed login attempt. |
pub const PASSWORD_CHANGED: & str | Password changed. |
pub const SESSION_REVOKED: & str | Session revoked (forced logout). |
pub const PASSWORD_RESET_REQUESTED: & str | Password reset requested. |
pub const PERMISSION_DENIED: & str | Permission denied. |
pub const EXPORT: & str | Export data. |
pub const IMPORT: & str | Import data. |
pub const CORRECTION: & str | Correction to a previous audit entry. |
pub const ARCHIVE: & str | Archive a record. |
pub const RESTORE: & str | Restore a record. |
pub const APPROVE: & str | Approve something (workflow). |
pub const REJECT: & str | Reject something (workflow). |
pub const SUBMIT: & str | Submit something (workflow). |
`attest::auth`
| Item | What it is |
|---|---|
pub const INVALID_PASSWORD_SQLSTATE: & str | invalid_password — the server read the credential and rejected it |
pub const INVALID_AUTHORIZATION_SQLSTATE: & str | invalid_authorization_specification — covers a pg_hba reject rule and "no pg_hba.conf entry" |
pub const INVALID_CATALOG_SQLSTATE: & str | invalid_catalog_name — the database does not exist |
pub const SENTINEL_PASSWORD: & str | The deliberately-wrong password used by the probe |
pub struct AuthProbeError | A connection failure reduced to the two fields classification depends on |
fn auth_probe_dsn(dsn : & str) -> Option <String> | Rewrite a runtime DSN into a negative-authentication probe DSN |
fn classify_auth_probe(result : Result <(), AuthProbeError>) -> CheckOutcome | Classify one negative-authentication probe into evidence |
fn classify_audit_grants(role : & str, can_select : bool, can_insert : bool, can_update : bool, can_delete : bool,) -> CheckOutcome | C18 — classify the runtime role's grants on audit_logs |
fn classify_backup_currency(database : & str, age_hours : Option <u64>, window_hours : u64,) -> CheckOutcome | C19 — is there a current, verified backup for this database? age_hours = None means no backup has ever been recorded, which is the worst case and must never read softer than a stale one |
`attest::cluster`
| Item | What it is |
|---|---|
pub enum ClusterCheckId | A cluster-scope finding |
ClusterCheckId :: fn as_str(self) -> & 'static str | Stable snake_case identifier for evidence records. |
ClusterCheckId :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub struct ClusterOutcome | The evidence one cluster-scope check produced. |
pub struct HbaRule | One row of pg_hba_file_rules, reduced to the fields posture depends on. |
pub struct LoginRole | A role that can log in, and whether it has a password verifier. |
fn ipv4_mask_to_prefix(mask : & str) -> String | Convert a dotted-quad netmask to a CIDR prefix length |
fn check_hba_auth_methods(rules : & HbaRule) -> ClusterOutcome | Do any rules authenticate nothing, or authenticate weakly? trust is a Fail: some route accepts any credential |
fn check_hba_exposure(rules : & HbaRule) -> ClusterOutcome | Is any rule reachable from an arbitrary source address? This is about reachability, not credentials, so an authenticated wildcard still fails: it exposes the port to the internet and reduces the boundary to one password. |
fn check_login_passwords(roles : & LoginRole) -> ClusterOutcome | Does every login role have a password? This is the ordering hazard made measurable |
fn check_transport_encryption(ssl_enabled : bool) -> ClusterOutcome | Is traffic encrypted in transit? Partial rather than Fail when off, and the distinction is deliberate |
`attest::db`
| Item | What it is |
|---|---|
pub struct AttestConfig | How to attest one database. |
AttestConfig :: fn new(inspect_url : impl Into <String>, runtime_role : impl Into <String>) -> Self | Config with the documented safe defaults. |
async fn attest_cluster(admin_url : & str,) -> Result <Vec <super::cluster::ClusterOutcome>, sqlx::Error> | Read cluster-wide authentication posture |
async fn check_endpoint(c : & mut PgConnection) -> CheckOutcome | C1 — endpoint identity |
async fn check_topology(c : & mut PgConnection) -> CheckOutcome | C3 — topology |
async fn check_no_rules(c : & mut PgConnection) -> CheckOutcome | C4 — the landmine |
async fn check_triggers(c : & mut PgConnection) -> CheckOutcome | C5 — exact trigger inventory |
async fn check_truncate_guard_catalog(c : & mut PgConnection) -> CheckOutcome | C13c — the TRUNCATE axis, carried by catalog evidence |
async fn check_event_guards(c : & mut PgConnection) -> CheckOutcome | C6 — the superuser event-trigger guards must exist, be enabled, and no maintenance window may be open (an open window means they are bypassed). |
async fn check_ownership(c : & mut PgConnection, runtime_role : & str) -> CheckOutcome | C7 — the primary invariant (consensus #24) |
async fn check_force_rls(c : & mut PgConnection) -> CheckOutcome | C9 — RLS must be ENABLED and FORCED; without FORCE the owner bypasses every policy and tenant isolation is a no-op. |
async fn check_row_hash(c : & mut PgConnection, statement_timeout_ms : u32) -> Vec <CheckOutcome> | C10/C11 — consensus #15 |
async fn observe_invariant(c : & mut PgConnection) -> Result <InvariantRecord, sqlx::Error> | Gather the structural record of the deployed invariant (consensus #25). |
async fn check_fingerprint(c : & mut PgConnection, expected : Option <& str>) -> CheckOutcome | C8 — compare the observed invariant against the canonical fingerprint. |
async fn probe_once(rt : & mut PgConnection, cfg : & AttestConfig, kind : ProbeKind, sql : & str,) -> CheckOutcome | Run one destructive statement inside an always-rolled-back transaction |
async fn attest(cfg : & AttestConfig) -> Result <Evidence, sqlx::Error> | Attest one database |
`attest::evidence`
| Item | What it is |
|---|---|
fn redact_dsn(dsn : & str) -> String | Strip the password from a Postgres connection URL, preserving everything else |
fn dsn_identity(dsn : & str) -> String | Extract a human-readable database identity (host:port/dbname) from a DSN, for report tables |
pub struct Evidence | One database's attestation result. |
Evidence :: fn new(dsn : & str, runtime_role : & str, checks : Vec <CheckOutcome>) -> Self | Build an evidence record, redacting the DSN and rolling up the verdict |
Evidence :: fn with_fingerprints(mut self, expected : String, observed : String) -> Self | Attach the canonical/observed fingerprint pair. |
`attest::fingerprint`
| Item | What it is |
|---|---|
fn normalize_definition(src : & str) -> String | Normalize a catalog-sourced definition for hashing |
pub struct InvariantRecord | A structural record of the deployed invariant: sorted key -> value facts |
InvariantRecord :: fn new() -> Self | An empty record. |
InvariantRecord :: fn put(& mut self, key : impl Into <String>, value : impl AsRef <str>) | Record one fact |
InvariantRecord :: fn get(& self, key : & str) -> Option <& str> | Read a recorded fact. |
InvariantRecord :: fn len(& self) -> usize | Number of recorded facts. |
InvariantRecord :: fn is_empty(& self) -> bool | Whether nothing has been recorded. |
InvariantRecord :: fn iter(& self) -> impl Iterator <Item =(& str, & str)> | Iterate the facts in stable key order. |
InvariantRecord :: fn drifted_keys(& self, other : & Self) -> Vec <String> | The keys whose values differ from other (either side missing counts) |
fn is_definition_key(key : & str) -> bool | Keys whose values are definition facts — identical on every correctly migrated database — as opposed to deployment facts that legitimately differ per install |
InvariantRecord :: fn definitions(& self) -> Self | The definition-only subset, which is what fingerprint is compared against CANONICAL_FINGERPRINT for. |
pub const CANONICAL_FINGERPRINT: & str | The fingerprint of the definition subset produced by migrations 001–005 on PostgreSQL 16 |
fn fingerprint(record : & InvariantRecord) -> String | SHA-256 over the record, in stable key order, as lowercase hex |
`attest::inventory`
| Item | What it is |
|---|---|
pub enum InventoryError | Why an inventory could not be used |
InventoryError :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub struct EphemeralRule | A declared rule for recognising per-run test residue |
pub struct InventoryEntry | One declared database. |
InventoryEntry :: fn scope_state(& self) -> ScopeState | The scope state implied by the declaration alone, before any attestation. |
pub struct Inventory | A validated scope declaration. |
Inventory :: fn len(& self) -> usize | Number of declared databases. |
Inventory :: fn is_empty(& self) -> bool | Whether nothing is declared (never true for a parsed inventory). |
Inventory :: fn get(& self, name : & str) -> Option <& InventoryEntry> | Look a database up by name. |
Inventory :: fn names(& self) -> impl Iterator <Item = & str> | Declared names, in stable order. |
Inventory :: fn entries(& self) -> impl Iterator <Item = & InventoryEntry> | Every declared entry, in stable order. |
Inventory :: fn is_ephemeral(& self, name : & str) -> bool | Does name match a declared ephemeral rule (i.e |
Inventory :: fn undeclared <'a>(& self, live : & 'a String) -> Vec <& 'a String> | Live databases that are neither declared nor recognised as ephemeral |
fn parse_inventory(src : & str) -> Result <Inventory, InventoryError> | — |
`attest::probe`
| Item | What it is |
|---|---|
pub const WORM_SQLSTATE: & str | SQLSTATE the canonical guards raise (insufficient_privilege). |
pub enum ProbeKind | The destructive operations the attestor probes. |
ProbeKind :: fn check_id(self) -> CheckId | The check this probe reports under. |
ProbeKind :: fn as_str(self) -> & 'static str | SQL-ish name for messages. |
pub struct ProbeError | A database error reduced to the two fields classification depends on |
fn classify_probe(kind : ProbeKind, result : Result <(), ProbeError>) -> CheckOutcome | Classify one destructive probe into evidence |
`attest::report`
| Item | What it is |
|---|---|
pub enum ScopeState | What the attestor could establish about one in-scope database. |
ScopeState :: fn status(self) -> Option <CheckStatus> | The status this state contributes to the fleet verdict. |
ScopeState :: fn label(self) -> String | Report label. |
pub struct FleetReport | The fleet-wide roll-up. |
FleetReport :: fn new() -> Self | An empty report |
FleetReport :: fn record(& mut self, database : impl Into <String>, state : ScopeState) | Record one database's outcome. |
FleetReport :: fn passing(& self) -> usize | Databases with a proven-good verdict. |
FleetReport :: fn failing(& self) -> usize | Databases with a proven violation. |
FleetReport :: fn not_certified(& self) -> usize | Everything that is not a proven PASS, excluding rows declared out of scope |
FleetReport :: fn len(& self) -> usize | Total in-scope rows recorded. |
FleetReport :: fn is_empty(& self) -> bool | Whether nothing was recorded. |
FleetReport :: fn verdict(& self) -> CheckStatus | The worst status across the fleet |
FleetReport :: fn render_markdown(& self) -> String | Markdown table for the sprint doc / runbook. |
`attest::status`
| Item | What it is |
|---|---|
pub enum CheckStatus | The evidence a single check produced |
CheckStatus :: fn is_passing(self) -> bool | Only Pass certifies |
CheckStatus :: fn as_str(self) -> & 'static str | Stable lowercase name for reports and evidence records. |
CheckStatus :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub enum CheckId | The check catalog (US-3.0.5 C1–C16) |
CheckId :: fn as_str(self) -> & 'static str | Stable snake_case identifier used in evidence records. |
CheckId :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub struct CheckOutcome | One check's result plus the human-readable evidence for it. |
CheckOutcome :: fn new(id : CheckId, status : CheckStatus, detail : impl Into <String>) -> Self | Build an outcome with an owned detail string. |
fn roll_up(checks : & CheckOutcome) -> CheckStatus | Roll a check set up to a single verdict: the worst status observed |
fn exit_code(verdict : CheckStatus) -> i32 | CI exit-code contract (consensus #14) |
`builder`
| Item | What it is |
|---|---|
pub struct AuditLogBuilder | Builder for audit log entries with model targets. |
AuditLogBuilder :: fn new() -> Self | Create a new builder. |
AuditLogBuilder :: fn action(mut self, action : impl Into <String>) -> Self | Set the action (required). |
AuditLogBuilder :: fn tenant(mut self, tenant_id : Uuid) -> Self | Set the tenant ID (for multi-tenant applications). |
AuditLogBuilder :: fn actor(mut self, id : Uuid, display : impl Into <String>) -> Self | Set the actor (user who performed the action). |
AuditLogBuilder :: fn system(mut self) -> Self | Mark as a system action (no human actor). |
AuditLogBuilder :: fn actor_display(mut self, display : impl Into <String>) -> Self | Set the actor display without a DB user id — e.g |
AuditLogBuilder :: fn target(mut self, model_label : impl Into <String>, object_id : impl Into <String>, object_repr : impl Into <String>,) -> Self | Set the target object. |
AuditLogBuilder :: fn changes(mut self, changes : JsonValue) -> Self | Set the changes diff. |
AuditLogBuilder :: fn request_context(mut self, ctx : RequestContext) -> Self | Set request context (IP, user agent, etc.). |
AuditLogBuilder :: fn sensitivity(mut self, level : Sensitivity) -> Self | Set sensitivity level. |
AuditLogBuilder :: fn metadata(mut self, metadata : JsonValue) -> Self | Set additional metadata. |
AuditLogBuilder :: fn source(mut self, source : AuditSource) -> Self | Set the origin surface (Sprint 0.55 T11; default AuditSource::Web). |
AuditLogBuilder :: fn outcome(mut self, outcome : AuditOutcome) -> Self | Set the outcome (Sprint 0.55 T11; default AuditOutcome::Success). |
AuditLogBuilder :: fn ip(mut self, ip : impl Into <String>) -> Self | Set IP address directly. |
AuditLogBuilder :: fn user_agent(mut self, ua : impl Into <String>) -> Self | Set user agent directly. |
AuditLogBuilder :: fn request_id(mut self, id : impl Into <String>) -> Self | Set request ID directly. |
AuditLogBuilder :: fn trace_id(mut self, id : impl Into <String>) -> Self | Set trace ID directly. |
AuditLogBuilder :: fn build(self) -> AuditLog | Build the audit log entry. |
pub struct AuditEventBuilder | Builder for audit event entries (no model target). |
AuditEventBuilder :: fn new(action : impl Into <String>) -> Self | Create a new event builder with the given action. |
AuditEventBuilder :: fn tenant(mut self, tenant_id : Uuid) -> Self | Set the tenant ID (for multi-tenant applications). |
AuditEventBuilder :: fn actor(mut self, id : Uuid, display : impl Into <String>) -> Self | Set the actor. |
AuditEventBuilder :: fn actor_display(mut self, display : impl Into <String>) -> Self | Set actor display name without ID (for failed logins, etc.). |
AuditEventBuilder :: fn system(mut self) -> Self | Mark as a system action. |
AuditEventBuilder :: fn sensitivity(mut self, level : Sensitivity) -> Self | Set sensitivity level. |
AuditEventBuilder :: fn metadata(mut self, metadata : JsonValue) -> Self | Set additional metadata. |
AuditEventBuilder :: fn source(mut self, source : AuditSource) -> Self | Set the origin surface (Sprint 0.55 T11; default AuditSource::Web). |
AuditEventBuilder :: fn outcome(mut self, outcome : AuditOutcome) -> Self | Set the outcome (Sprint 0.55 T11; default AuditOutcome::Success). |
AuditEventBuilder :: fn request_context(mut self, ctx : RequestContext) -> Self | Set request context. |
AuditEventBuilder :: fn ip(mut self, ip : impl Into <String>) -> Self | Set IP address directly. |
AuditEventBuilder :: fn user_agent(mut self, ua : impl Into <String>) -> Self | Set user agent directly. |
AuditEventBuilder :: fn build(self) -> AuditLog | Build the audit log entry. |
`checkpoint`
| Item | What it is |
|---|---|
pub struct Checkpoint | A tamper-evidence checkpoint over a contiguous seq range of audit rows |
Checkpoint :: fn signing_bytes(& self) -> Vec <u8> | The deterministic, domain-separated byte preimage this checkpoint is signed over |
Checkpoint :: fn sign(& self, signing_key : & SigningKey) -> SignedCheckpoint | Signs this checkpoint with signing_key, producing a SignedCheckpoint carrying the alg-tagged signature |
pub struct SignedCheckpoint | A Checkpoint paired with its signature. |
SignedCheckpoint :: fn verify(& self, verifying_key : & VerifyingKey,) -> Result <(), foundation_crypto_sign::Error> | Verifies this checkpoint's signature against verifying_key |
`context`
| Item | What it is |
|---|---|
pub struct RequestContext | Request context information for audit entries. |
RequestContext :: fn new() -> Self | Create a new empty request context. |
RequestContext :: fn with_ip(mut self, ip : impl Into <String>) -> Self | Builder: set IP address. |
RequestContext :: fn with_user_agent(mut self, ua : impl Into <String>) -> Self | Builder: set user agent. |
RequestContext :: fn with_request_id(mut self, id : impl Into <String>) -> Self | Builder: set request ID. |
RequestContext :: fn with_trace_id(mut self, id : impl Into <String>) -> Self | Builder: set trace ID. |
RequestContext :: fn extract_ip_from_forwarded(forwarded : Option <& str>, direct : Option <& str>,) -> Option <String> | Extract client IP from X-Forwarded-For header or direct connection |
RequestContext :: fn extract_client_ip(forwarded : Option <& str>, direct : Option <& str>, trusted_proxy_count : usize,) -> Option <String> | Extract the trustworthy client IP given the number of trusted reverse proxies in front of the application (Sprint 0.55, T7) |
`deid`
| Item | What it is |
|---|---|
pub struct Pseudonym | A random, opaque per-subject token stored in audit rows |
Pseudonym :: fn random() -> Self | Mint a fresh random pseudonym (UUIDv4 — not derived from the subject id). |
Pseudonym :: fn from_uuid(id : Uuid) -> Self | Reconstruct from a stored UUID. |
Pseudonym :: fn as_uuid(& self) -> Uuid | The underlying UUID (what gets stored in the audit row). |
fn row_affected_by(actor : Option <Pseudonym>, target : Option <Pseudonym>, subject : Pseudonym,) -> bool | Does a shred of subject touch this row? A row is affected if the subject appears as the actor OR as the target — the latter captures PII about the subject written by someone else's action |
pub trait SubjectKeyStore | Per-subject key lifecycle for crypto-shred erasure |
pub struct InMemorySubjectKeyStore | In-memory SubjectKeyStore for tests and the decidable-logic layer |
InMemorySubjectKeyStore :: fn new() -> Self | — |
InMemorySubjectKeyStore :: fn ensure(& mut self, subject_id : Uuid, key_material : Vec <u8>) -> Pseudonym | — |
InMemorySubjectKeyStore :: fn get(& self, subject_id : Uuid) -> Option <& u8> | — |
InMemorySubjectKeyStore :: fn pseudonym_of(& self, subject_id : Uuid) -> Option <Pseudonym> | — |
InMemorySubjectKeyStore :: fn shred(& mut self, subject_id : Uuid) -> Option <Pseudonym> | — |
InMemorySubjectKeyStore :: fn is_erased(& self, subject_id : Uuid) -> bool | — |
`error`
| Item | What it is |
|---|---|
pub enum AuditError | Errors that can occur in audit logging operations. |
`hash`
| Item | What it is |
|---|---|
fn canonicalize(value : & Value) -> Vec <u8> | Deterministic canonical byte encoding of a JSON value |
fn sha256_hex(bytes : & u8) -> String | SHA-256(bytes) rendered as lowercase hex |
fn hmac_hex(key : & u8, data : & u8) -> String | HMAC-SHA256(key, data) rendered as lowercase hex. |
pub struct Sha256Stream | Incremental SHA-256, for a caller that streams bytes (e.g |
Sha256Stream :: fn new() -> Self | — |
Sha256Stream :: fn update(& mut self, chunk : & u8) | — |
Sha256Stream :: fn finalize_hex(self) -> String | — |
fn row_hash(key : & u8, payload : & Value) -> String | Compute the row_hash for an audit row from its canonical payload value |
fn merkle_root(leaf_hashes : & String) -> Option <String> | Compute a Merkle root over an ordered list of leaf hashes (lowercase hex row_hash strings, in seq order) |
`model`
| Item | What it is |
|---|---|
pub struct AuditLog | An immutable audit log entry |
AuditLog :: fn builder() -> AuditLogBuilder | Create a builder for logging model operations. |
AuditLog :: fn event(action : impl Into <String>) -> AuditEventBuilder | Create a builder for logging events (no model target). |
AuditLog :: fn login(actor_id : Uuid, display : impl Into <String>) -> AuditEventBuilder | Create a login success audit entry |
AuditLog :: fn logout(actor_id : Uuid, display : impl Into <String>) -> AuditEventBuilder | Create a logout audit entry |
AuditLog :: fn login_failed(attempted_identity : impl Into <String>) -> AuditEventBuilder | Create a failed login audit entry |
AuditLog :: fn module(& self) -> Option <& str> | Get the module part of the model label. |
AuditLog :: fn model_name(& self) -> Option <& str> | Get the model name part of the model label. |
AuditLog :: fn id(& self) -> Uuid | — |
`provenance`
| Item | What it is |
|---|---|
pub enum AuditSource | The origin surface of an audit entry. |
AuditSource :: fn as_str(& self) -> & 'static str | String form, matching the DB CHECK constraint. |
AuditSource :: fn parse(s : & str) -> Option <Self> | Parse from string (case-insensitive); None if not a known source. |
AuditSource :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
pub enum AuditOutcome | How an audited action resolved. |
AuditOutcome :: fn as_str(& self) -> & 'static str | String form, matching the DB CHECK constraint. |
AuditOutcome :: fn parse(s : & str) -> Option <Self> | Parse from string (case-insensitive); None if not a known outcome. |
AuditOutcome :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
`redact`
| Item | What it is |
|---|---|
pub const REDACTED: & str | Marker substituted for a redacted value. |
pub const DEFAULT_MAX_STRING_LEN: usize | Default maximum length (bytes) for any single string value before it is truncated |
pub const SECRET_KEY_DENYLIST: & & str | Case-insensitive substrings that mark a JSON key as carrying a secret or direct credential |
fn is_secret_key(key : & str) -> bool | Returns true if the key name indicates a secret value that must be redacted. |
fn redact(value : & Value) -> Value | Redact a JSON value with the default string-length cap. |
fn redact_with_limit(value : & Value, max_string_len : usize) -> Value | Redact a JSON value, capping string length at max_string_len |
`sensitivity`
| Item | What it is |
|---|---|
pub enum Sensitivity | Classification level for audit log entries |
Sensitivity :: fn as_str(& self) -> & 'static str | Get the string representation. |
Sensitivity :: fn parse(s : & str) -> Option <Self> | Parse from string. |
Sensitivity :: fn fmt(& self, f : & mut std::fmt::Formatter <'_>) -> std::fmt::Result | — |
Re-exports. Exported here, defined elsewhere.
| Export | Defined in |
|---|---|
AuditError | error::AuditError |
AuditLog | model::AuditLog |
HasId | foundation_basemodels::HasId |
RequestContext | context::RequestContext |
Sensitivity | sensitivity::Sensitivity |
{AuditEventBuilder,AuditLogBuilder} | builder::{AuditEventBuilder,AuditLogBuilder} |
{AuditOutcome,AuditSource} | provenance::{AuditOutcome,AuditSource} |
{Checkpoint,SignedCheckpoint} | checkpoint::{Checkpoint,SignedCheckpoint} |
{FleetReport,ScopeState} | report::{FleetReport,ScopeState} |
{attest,attest_cluster,check_endpoint,check_event_guards,check_fingerprint,check_force_rls,check_no_rules,check_ownership,check_row_hash,check_topology,check_triggers,check_truncate_guard_catalog,observe_invariant,probe_once,AttestConfig,} | db::{attest,attest_cluster,check_endpoint,check_event_guards,check_fingerprint,check_force_rls,check_no_rules,check_ownership,check_row_hash,check_topology,check_triggers,check_truncate_guard_catalog,observe_invariant,probe_once,AttestConfig,} |
{auth_probe_dsn,classify_audit_grants,classify_auth_probe,classify_backup_currency,AuthProbeError,INVALID_AUTHORIZATION_SQLSTATE,INVALID_CATALOG_SQLSTATE,INVALID_PASSWORD_SQLSTATE,SENTINEL_PASSWORD,} | auth::{auth_probe_dsn,classify_audit_grants,classify_auth_probe,classify_backup_currency,AuthProbeError,INVALID_AUTHORIZATION_SQLSTATE,INVALID_CATALOG_SQLSTATE,INVALID_PASSWORD_SQLSTATE,SENTINEL_PASSWORD,} |
{check_hba_auth_methods,check_hba_exposure,check_login_passwords,check_transport_encryption,ipv4_mask_to_prefix,ClusterCheckId,ClusterOutcome,HbaRule,LoginRole,} | cluster::{check_hba_auth_methods,check_hba_exposure,check_login_passwords,check_transport_encryption,ipv4_mask_to_prefix,ClusterCheckId,ClusterOutcome,HbaRule,LoginRole,} |
{classify_probe,ProbeError,ProbeKind,WORM_SQLSTATE} | probe::{classify_probe,ProbeError,ProbeKind,WORM_SQLSTATE} |
{dsn_identity,redact_dsn,Evidence} | evidence::{dsn_identity,redact_dsn,Evidence} |
{exit_code,roll_up,CheckId,CheckOutcome,CheckStatus} | status::{exit_code,roll_up,CheckId,CheckOutcome,CheckStatus} |
{fingerprint,is_definition_key,normalize_definition,InvariantRecord,CANONICAL_FINGERPRINT,} | fingerprint::{fingerprint,is_definition_key,normalize_definition,InvariantRecord,CANONICAL_FINGERPRINT,} |
{parse_inventory,EphemeralRule,Inventory,InventoryEntry,InventoryError} | inventory::{parse_inventory,EphemeralRule,Inventory,InventoryEntry,InventoryError} |
Boundary
Depends on no other workspace tier.
Shares tier foundation with 27 other crates: foundation-basemodels, foundation-bounded-io, foundation-conversation-closure, foundation-crypto-sign, foundation-decisioning, foundation-encounter-vocabulary, foundation-fs-metadata, foundation-i18n, … (27 total).
_What this crate deliberately does NOT own is a judgment. No committed registry records one for it, so none is stated here._
Where it sits
| Tier (ontology) | foundation |
| Architectural role (taxonomy) | unclassified (baselined) |
| Location | crates/foundation/audit-log |
| Vocabulary in force (lexicon) | current |
Dependencies
Runtime, in this workspace.
| Crate | Tier | Optional | Only on |
|---|---|---|---|
| `foundation-basemodels` | foundation | no | always |
| `foundation-crypto-sign` | foundation | no | always |
Runtime, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
chrono | ^0.4 | serde | no | always |
clap | ^4 | derive, env | yes | always |
hex | ^0.4 | — | no | always |
hmac | ^0.12 | — | no | always |
serde | ^1 | derive | no | always |
serde_json | ^1 | — | no | always |
sha2 | ^0.10 | — | no | always |
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
thiserror | ^2 | — | no | always |
tokio | ^1 | full | no | always |
uuid | ^1 | v4, v7, serde, js | no | always |
Development, from outside the workspace.
| Crate | Requirement | Features | Optional | Only on |
|---|---|---|---|---|
sqlx | ^0.8 | runtime-tokio, postgres, chrono, uuid, json | no | always |
tokio | ^1 | full, macros, rt-multi-thread | no | always |
tokio-test | ^0.4 | — | no | always |
Build. None.
Depended on by. 25 workspace crates.
Signal flow — what reaches this crate, and what it reaches.
flowchart LR consumers["25 consumer crates"] -->|uses| SELF SELF["foundation-audit-log"] SELF -->|runtime| runtime_deps["2 workspace crates"] classDef self fill:#1f883d,stroke:#1f883d,color:#fff; class SELF self;
Feature flags
| Feature | Enables | On by default |
|---|---|---|
attest-cli | dep:clap | no |
default | — | yes |
flowchart LR n_attest_cli["attest-cli"] --> n_dep_clap["dep:clap"] n_default["default"]
Targets
| Kind | Name | Source |
|---|---|---|
| bin | audit-attest | `src/bin/audit-attest.rs` |
| bin | fleet-inventory-gen | `src/bin/fleet-inventory-gen.rs` |
| lib | foundation_audit_log | `src/lib.rs` |
| test | attest_cluster | `tests/attest_cluster.rs` |
| test | attest_inventory | `tests/attest_inventory.rs` |
| test | attest_pure | `tests/attest_pure.rs` |
| test | pg_attest | `tests/pg_attest.rs` |
| test | pg_consumer_convergence | `tests/pg_consumer_convergence.rs` |
| test | pg_starter_seed | `tests/pg_starter_seed.rs` |
| test | pg_worm_enforcement | `tests/pg_worm_enforcement.rs` |
Error model
| Error type | Named by |
|---|---|
AuditError | declared, no public signature returns it |
AuthProbeError | classify_auth_probe |
InventoryError | parse_inventory |
ProbeError | AuthProbeError, classify_auth_probe, classify_probe |
Operational characteristics
| Property | Evidence |
|---|---|
| async public surface | yes |
| async runtime | yes |
| database access | yes |
| network I/O | none detected |
| unsafe code | none detected |
| environment variables | yes |
No unsafe block, unsafe fn, unsafe impl or unsafe trait was found by the parser anywhere in this crate's source.
Configuration
| Variable | Read in |
|---|---|
CARGO_PKG_VERSION | src/attest/evidence.rs |
Related capabilities
25 workspace crates depend on this one: application-audit-log, application-core, application-rbac, application-wiki, domain-domain-survey, domain-legal-evidence, identity-impersonation, infrastructure-adapters-google-gmail, infrastructure-tenant-pool, infrastructure-waf, observability-analytics, operations-approval-workflow, … (25 total).
Verification
| Kind | Count |
|---|---|
| Unit tests | 121 |
| Integration tests | 115 |
| Examples | 0 |
| Doctests | 1 |
Evidence by module. How often each public module is named by something executable.
| Module | Tests | Examples | Consumers |
|---|---|---|---|
actions | 19 | 0 | 33 |
attest::auth | 9 | 0 | 0 |
attest::cluster | 9 | 0 | 0 |
attest::db | 15 | 0 | 1 |
attest::evidence | 3 | 0 | 6 |
attest::fingerprint | 5 | 0 | 4 |
attest::inventory | 5 | 0 | 2 |
attest::probe | 4 | 0 | 0 |
attest::report | 2 | 0 | 0 |
attest::status | 5 | 0 | 5 |
builder | 2 | 0 | 0 |
checkpoint | 2 | 0 | 0 |
context | 1 | 0 | 1 |
deid | 4 | 0 | 0 |
error | 1 | 0 | 1 |
hash | 6 | 0 | 27 |
model | 1 | 0 | 6 |
provenance | 2 | 0 | 2 |
redact | 6 | 0 | 8 |
sensitivity | 1 | 0 | 4 |
What the tests establish, by name:
a_dotted_quad_mask_becomes_a_prefix_length—tests/attest_cluster.rsa_local_socket_trust_rule_also_fails—tests/attest_cluster.rsa_login_role_with_no_password_fails_and_is_named—tests/attest_cluster.rsa_non_contiguous_mask_is_reported_verbatim—tests/attest_cluster.rsa_non_dotted_quad_mask_passes_through—tests/attest_cluster.rsa_wildcard_with_authentication_still_fails_exposure—tests/attest_cluster.rsall_scram_passes—tests/attest_cluster.rsan_all_zeros_mask_is_prefix_zero_in_any_notation—tests/attest_cluster.rsan_empty_role_set_is_unverified—tests/attest_cluster.rsan_internet_wide_rule_fails—tests/attest_cluster.rsan_ipv6_wildcard_rule_also_fails—tests/attest_cluster.rsany_trust_rule_fails_the_cluster—tests/attest_cluster.rsevery_login_role_having_a_password_passes—tests/attest_cluster.rsmd5_is_partial_not_pass_and_not_fail—tests/attest_cluster.rsno_rules_is_unverified_never_pass—tests/attest_cluster.rspeer_is_partial_because_one_unix_user_runs_everything—tests/attest_cluster.rsprivate_ranges_and_local_sockets_pass—tests/attest_cluster.rsreject_rules_are_not_scored_as_authentication—tests/attest_cluster.rsssl_off_is_partial_with_the_reason_stated—tests/attest_cluster.rsssl_on_passes—tests/attest_cluster.rsthe_all_keyword_is_a_wildcard—tests/attest_cluster.rsa_database_declared_not_required_is_explicitly_out_of_scope—tests/attest_inventory.rsa_declared_database_carries_its_requirement_and_role—tests/attest_inventory.rsa_live_database_absent_from_the_inventory_is_undeclared_not_ignored—tests/attest_inventory.rsa_missing_audit_required_is_rejected_not_defaulted—tests/attest_inventory.rsa_password_in_a_runtime_dsn_is_a_hard_error—tests/attest_inventory.rsa_password_in_an_inspect_dsn_is_also_rejected—tests/attest_inventory.rsa_port_colon_is_not_a_password—tests/attest_inventory.rsan_empty_inventory_is_rejected—tests/attest_inventory.rsan_entry_records_owner_and_runtime_as_separate_declarations—tests/attest_inventory.rs- _… 206 more_
Documentation coverage
| Measure | Documented | Total |
|---|---|---|
| Public items with rustdoc | 195 | 213 |
Public modules with a //! block | 21 | 21 |
pie showData
title Public items with rustdoc
"Documented" : 195
"No rustdoc detected" : 18
Metrics
| Metric | Value |
|---|---|
| Rust source files | 24 |
| Source lines | 7030 |
| Code lines | 4738 |
| Public API items | 213 |
| Public modules | 21 |
| Tests | 236 |
| Examples | 0 |
| Cargo features | 2 |
| Direct runtime dependencies | 13 |
| Workspace reverse dependencies | 25 |
pie showData
title Public API by kind
"constant" : 28
"enum" : 10
"function" : 41
"method" : 111
"struct" : 22
"trait" : 1
pie showData
title Rust source composition
"Code" : 4738
"Blank or comment" : 2292
Generation
Rendered by tools-corpus corpus readme from repository evidence alone, renderer schema 2, lexicon current. No model, network service or database was consulted. Regenerate with tools-corpus corpus readme --write; verify with --check.