Skip to main content

redacted_body

Function redacted_body 

Source
pub fn redacted_body(body: &[u8], bearer: &str) -> String
Expand description

A body as a log field’s suffix (": ...", capped at 200 chars), with the request’s credential masked.

Every endpoint here is reached with a token and several sit on base urls the user configures, so a host that echoes the request - or a payload carrying its own copy of the key, as /v1/key does - would put key material in a warn (#2268). Three masks cover the shapes a copy arrives in: the token itself wherever it appears, any quoted run containing its opening characters, and any bare word containing them (a payload’s copy is truncated, so it is a leading piece of the token rather than the whole of it).