Skip to main content

redact_host_managed_value

Function redact_host_managed_value 

Source
pub fn redact_host_managed_value(value: SchemaValue) -> SchemaValue
Expand description

Replace every host-managed capability value (see HostManagedKind) with a plain string placeholder, recursing through every container.

This is a lossy, deterministic transform used at untrusted export boundaries (the public oplog / oplog-processor plugin interface) where a capability must neither leak its trusted snapshot nor be lowered to a live owned handle. Quota tokens have no value representation in the WIT wire form other than an owned handle, so the only safe rendering is an ordinary string. Secrets carry an opaque snapshot (secret id, pinned version, and metadata) that is likewise capability-identifying authority data, so they are redacted the same way.

The result is a well-formed SchemaValue in which every capability leaf has become a SchemaValue::String. Pair it with redact_host_managed_type (via redact_host_managed_typed_value) to keep a typed value’s schema graph and value tree kind-consistent.