pub struct EncodedJitConfig(/* private fields */);Expand description
The encoded just-in-time configuration: a short-lived credential.
07-security.md, credential inventory: “Restrictive temporary handoff only.
Delete immediately after launch; never persist.” This type is what makes the
first half enforceable at the type level rather than by everyone remembering:
DebugandDisplayredact. Both are hand-written. A#[derive(Debug)]added later to a struct with a plainStringfield is precisely how this control is lost, which is whylib.rs’s crate documentation states the rule and whytests/no_jit_config_reaches_the_logs.rsplants that exact mistake as a positive control.- It does not serialise. There is no
serde::Serializeimpl, so it cannot be written into a config file, a SQLite row, astatus --jsonpayload or a structured log field by any code that compiles. The doctest below is the executable form of that claim. - It zeroises on drop.
DropcallsSelf::scrub, which zeroes the buffer throughzeroize.secrecy’sSecretStringalso zeroises on its own drop; the explicit scrub is what makes the property testable rather than a statement about a dependency. - It is not
Clone. A clone of a secret is a second copy with its own lifetime, and this value’s whole security property is a short one.
The error code is pinned, and that is the whole value of the doctest. A bare
compile_fail passes when the snippet fails to compile for any reason — a
typo, a renamed type, a missing import — so it would keep passing after
someone added a Serialize derive and broke something else in the same
edit. E0277 is “the trait bound is not satisfied”, which is the one reason
this claim is about.
fn is_serialisable<T: serde::Serialize>(_: &T) {}
let config = EncodedJitConfig::new("not-a-real-jit-configuration");
// The JIT configuration must never reach a config file, a database row, a
// `--json` payload or a structured log field. This must not compile.
is_serialisable(&config);Implementations§
Source§impl EncodedJitConfig
impl EncodedJitConfig
pub fn new(raw: impl Into<String>) -> Self
Sourcepub fn expose(&self) -> &str
pub fn expose(&self) -> &str
The configuration itself, for the one caller that hands it to a runner process.
Named expose rather than as_str so that every use site says out loud
what it is doing, and so that grep expose_jit finds all of them.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Length in bytes, which is safe to log and useful for diagnosing a
truncated handoff. v1 observed 4,088 characters at organization scope.