Skip to main content

EncodedJitConfig

Struct EncodedJitConfig 

Source
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:

  • Debug and Display redact. Both are hand-written. A #[derive(Debug)] added later to a struct with a plain String field is precisely how this control is lost, which is why lib.rs’s crate documentation states the rule and why tests/no_jit_config_reaches_the_logs.rs plants that exact mistake as a positive control.
  • It does not serialise. There is no serde::Serialize impl, so it cannot be written into a config file, a SQLite row, a status --json payload or a structured log field by any code that compiles. The doctest below is the executable form of that claim.
  • It zeroises on drop. Drop calls Self::scrub, which zeroes the buffer through zeroize. secrecy’s SecretString also 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

Source

pub fn new(raw: impl Into<String>) -> Self

Source

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.

Source

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.

Source

pub fn is_empty(&self) -> bool

Trait Implementations§

Source§

impl Debug for EncodedJitConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for EncodedJitConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Drop for EncodedJitConfig

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more