pub struct RunHookPayload(/* private fields */);Expand description
A runHookPayload that is known to fit the service ceiling.
The type is the guard: there is no way to build one over 4096 bytes, so no call site has to remember to check. See the module docs for the measurement and for why the service model’s own documentation string disagrees with its shape.
Implementations§
Source§impl RunHookPayload
impl RunHookPayload
Sourcepub fn for_agent_token(agent_token: &str) -> Result<RunHookPayload, Error>
pub fn for_agent_token(agent_token: &str) -> Result<RunHookPayload, Error>
The payload carrying an agent token, as the daemon expects to find it.
{"agent_token": "<token>"} — and the platform wraps this whole string as the
value of runHookPayload, which is the extra parse the daemon does.
Checked even though this function builds the JSON itself, because the token is caller-supplied: someone passing a JWT or a signed blob rather than a bearer token is exactly who this catches.
Sourcepub fn for_launch(
agent_token: &str,
env: &HashMap<String, String>,
) -> Result<RunHookPayload, Error>
pub fn for_launch( agent_token: &str, env: &HashMap<String, String>, ) -> Result<RunHookPayload, Error>
The payload carrying an agent token and a launch environment.
{"agent_token": "<token>", "env": {...}}, and the platform wraps that whole
string as the value of runHookPayload — the extra parse the daemon does.
The daemon applies env as the base environment of every subsequent exec,
under the per-request env.
This is where the 4096-byte refusal fires for a launch env. The check is
on the serialized payload rather than on the map, because the ceiling is on
the string: JSON escaping, the key names, and the punctuation all count, so a
caller who measured their own values would measure the wrong thing. And it is
local rather than left to the service for the same reason
super::super::control::image’s require_workdir and
require_matching_from are local: the service’s answer arrives as a
ValidationException on a member the caller did not know they were filling,
after the call, and botocore does not enforce it client-side at all (measured;
docs/PLATFORM.md). env is what makes this reachable in practice — one
bearer token has always fit with room to spare, and a map of credentials does
not.
The env is omitted from the JSON entirely when it is empty, so a caller who
passes no launch env produces byte-for-byte the payload
RunHookPayload::for_agent_token always produced. A pinned daemon that has
never heard of env therefore sees no change, and the two constructors do not
have two different budgets.
Sourcepub fn for_launch_with_identity(
agent_token: &str,
env: &HashMap<String, String>,
identity: Option<&LaunchIdentity>,
) -> Result<RunHookPayload, Error>
pub fn for_launch_with_identity( agent_token: &str, env: &HashMap<String, String>, identity: Option<&LaunchIdentity>, ) -> Result<RunHookPayload, Error>
RunHookPayload::for_launch, optionally carrying the tunnel identity material.
The two identity fields are the VM’s own seed and the launching host’s public key,
under the keys protocol::identity declares — the daemon pins one and derives from
the other, which lets microvm tunnel --verify-identity prove possession of the
launch-pinned key under protocol::identity’s trust assumptions. None produces byte-for-byte the
payload the other constructors always built, so a caller who never asks for identity
cannot be affected by the field existing (the same compatibility rule env follows).
The material costs protocol::identity::IDENTITY_PAYLOAD_BYTES of the shared
4096-byte budget — two 44-character base64 values plus JSON framing — and the ceiling
check below covers it like everything else in the payload.
Trait Implementations§
Source§impl Clone for RunHookPayload
impl Clone for RunHookPayload
Source§fn clone(&self) -> RunHookPayload
fn clone(&self) -> RunHookPayload
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RunHookPayload
Prints the size and nothing else.
impl Debug for RunHookPayload
Prints the size and nothing else.
The payload is the platform’s only per-VM secret channel — its whole purpose is to carry
the agent token — so a derived Debug would print that token into every log line that
formats one, and into every line that formats the RunMicrovmRequest holding it.
RunMicrovmRequest keeps its derive: with this impl in place, the derived one prints
RunHookPayload(<N bytes>) for that field, so the safety is inherited rather than
restated. The length is kept because it is the number every TRAP-5 diagnosis needs.
impl Eq for RunHookPayload
Source§impl PartialEq for RunHookPayload
impl PartialEq for RunHookPayload
impl StructuralPartialEq for RunHookPayload
Auto Trait Implementations§
impl Freeze for RunHookPayload
impl RefUnwindSafe for RunHookPayload
impl Send for RunHookPayload
impl Sync for RunHookPayload
impl Unpin for RunHookPayload
impl UnsafeUnpin for RunHookPayload
impl UnwindSafe for RunHookPayload
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more