capsule_core/validation/mod.rs
1//! Refuse-by-default validation invariants — the operational core of the threat model
2//! (SSoT: [Threat Model — Validation Invariants]).
3//!
4//! These are **pure, key-less** structural checks: the protocol/capability handshake
5//! (`protocol`) and the server-side manifest envelope (`structural`). They mirror the
6//! client-side checks in [`verify_asset`](crate::crypto::verify_asset::verify_asset), and the server
7//! write paths consume them today — the envelope gate, the ops surface, the feed,
8//! federation pull, and the drop routes all validate through here. This module used to describe those consumers as
9//! deferred; they are six live call sites, and the checks are the only thing standing
10//! between a key-free server and a malformed write.
11//!
12//! Upload-transport-specific invariants (chunk offset/4 KiB alignment, cumulative size)
13//! live with the deferred upload protocol.
14//!
15//! [Threat Model — Validation Invariants]: https://docs/design/threat-model/validation/
16
17mod protocol;
18mod structural;
19
20// Every public item of both modules, because this barrel is the module's only public path
21// (#480) and a predicate that exists but cannot be named is not a contract. The server's
22// envelope gate and its protocol negotiator between them reach eight of these.
23pub use protocol::{HandshakeReject, check_sidecar_schema, check_suite, protocol_gate};
24pub use structural::{
25 EnvelopeContext, EnvelopeReject, album_pin_matches, amk_version_monotonic,
26 check_manifest_envelope, check_metadata_blob_envelope, content_type_allowed,
27 device_added_before, hash_length_ok, metadata_blob_hash_matches, prior_hash_matches,
28 size_in_bounds, timestamp_within_drift,
29};