pub struct SecretContext { /* private fields */ }Expand description
Context containing resolved secret values for dynamic redaction.
This struct collects actual secret values from environment variables
referenced by x-aperture-secret extensions and config-based secrets,
allowing them to be redacted from logs wherever they appear.
Implementations§
Source§impl SecretContext
impl SecretContext
Sourcepub fn from_spec_and_config(
spec: &CachedSpec,
api_name: &str,
global_config: Option<&GlobalConfig>,
) -> Self
pub fn from_spec_and_config( spec: &CachedSpec, api_name: &str, global_config: Option<&GlobalConfig>, ) -> Self
Creates a SecretContext by collecting secrets from the spec and config.
This resolves environment variables referenced by:
x-aperture-secretextensions in theOpenAPIspec’s security schemes- Config-based secrets in the global configuration
§Arguments
spec- The cached API specification containing security schemesapi_name- The name of the API (used to look up config-based secrets)global_config- Optional global configuration with config-based secrets
Sourcepub fn is_secret(&self, value: &str) -> bool
pub fn is_secret(&self, value: &str) -> bool
Checks if a value exactly matches any of the secrets.
Sourcepub fn redact_secrets_in_text(&self, text: &str) -> String
pub fn redact_secrets_in_text(&self, text: &str) -> String
Redacts all occurrences of secrets in the given text.
Only redacts secrets that are at least MIN_SECRET_LENGTH_FOR_BODY_REDACTION
characters long to avoid false positives with short values.
Sourcepub const fn has_secrets(&self) -> bool
pub const fn has_secrets(&self) -> bool
Returns true if this context has any secrets to redact.
Trait Implementations§
Source§impl Clone for SecretContext
impl Clone for SecretContext
Source§fn clone(&self) -> SecretContext
fn clone(&self) -> SecretContext
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SecretContext
impl Debug for SecretContext
Source§impl Default for SecretContext
impl Default for SecretContext
Source§fn default() -> SecretContext
fn default() -> SecretContext
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SecretContext
impl RefUnwindSafe for SecretContext
impl Send for SecretContext
impl Sync for SecretContext
impl Unpin for SecretContext
impl UnsafeUnpin for SecretContext
impl UnwindSafe for SecretContext
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
Mutably borrows from an owned value. Read more