pub enum Boundary {
HttpHeader,
GrpcMetadata,
LogField,
AuditField,
JsonValue,
}Expand description
Serialization boundaries supported by Tainted::escape_for.
Each variant names the exact escape contract the boundary expects.
The contract is implemented by Tainted::escape_for and
validated by the proptest corpus in this crate’s test suite, so
adding a variant requires extending both.
Variants§
HttpHeader
HTTP/1.1 + HTTP/2 header value (http::HeaderValue-safe).
Strips CR, LF, NUL, and tab — the four bytes that let an
attacker terminate the current header and inject a second one.
The output is guaranteed to be accepted by
[http::HeaderValue::from_str] (modulo bytes outside ASCII
0x20-0x7E which are passed through; the gRPC layer rejects
non-visible-ASCII separately).
GrpcMetadata
gRPC metadata value. gRPC metadata sits on HTTP/2 headers, so
the contract is identical to Boundary::HttpHeader.
LogField
Plain-text log line emitted via tracing or any other
line-oriented formatter. Strips CR / LF / NUL / control bytes
(0x00-0x1F + 0x7F) and percent-encodes them, so a smuggled
\nlevel=ERROR survives as %0Alevel=ERROR in the captured
line — visibly tampered, never authoritative.
AuditField
Structured audit field. Pass-through; the
AuditFieldEscaper (#177, slice AC) owns the on-disk encoder
and rejects control bytes at emit time. Exposing the typed
value here lets the audit lane consume Tainted<String>
without going through a string detour.
JsonValue
JSON value. Pass-through; the SerializedJsonField (#178,
slice AB) round-trips through serde_json::Value::String and
inherits serde’s escape contract. Exposing the typed value
here lets the JSON lane consume Tainted<String> without a
string detour.
Implementations§
Trait Implementations§
impl Copy for Boundary
impl Eq for Boundary
impl StructuralPartialEq for Boundary
Auto Trait Implementations§
impl Freeze for Boundary
impl RefUnwindSafe for Boundary
impl Send for Boundary
impl Sync for Boundary
impl Unpin for Boundary
impl UnsafeUnpin for Boundary
impl UnwindSafe for Boundary
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§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 moreSource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request