pub struct CredentialShape {
pub exact_length: Option<usize>,
pub prefix: Option<String>,
pub body_min_length: Option<usize>,
pub body_max_length: Option<usize>,
}Expand description
Per-detector credential SHAPE constraint ([detector.credential_shape]),
OWNED HERE per the architecture law (was a centralized
rules/detector-credential-shapes.toml [[shape]] list keyed by detector
id, a per-detector property in a second file). A candidate whose byte length
/ prefix / post-prefix body length does not fit the declared shape is
suppressed by the scanner’s shape gate (CredentialShapeRule::allows). Only a
couple of fixed-format vendor detectors declare it: aws-access-key is
exactly 20 bytes; anthropic-api-key is sk-ant-api03- + an 80..=120 body.
Fields§
§exact_length: Option<usize>Exact total credential byte length, for a fixed-length format.
prefix: Option<String>Literal prefix. The body-length bounds below apply ONLY to a candidate that starts with this prefix (a differently-shaped credential is not owned by this rule and passes untouched).
body_min_length: Option<usize>Minimum body byte length AFTER prefix (requires prefix).
body_max_length: Option<usize>Maximum body byte length AFTER prefix (requires prefix).
Implementations§
Source§impl CredentialShape
impl CredentialShape
Sourcepub fn validate(&self, detector_id: &str) -> Result<(), String>
pub fn validate(&self, detector_id: &str) -> Result<(), String>
Validate the internal consistency of a declared shape (the single owner of
these rules, was credential_shapes::validate_shape_entries). detector_id
is only used to build a precise error message. Fails closed so a malformed
per-detector shape is caught at load/build, never silently ignored.
Trait Implementations§
Source§impl Clone for CredentialShape
impl Clone for CredentialShape
Source§fn clone(&self) -> CredentialShape
fn clone(&self) -> CredentialShape
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 CredentialShape
impl Debug for CredentialShape
Source§impl Default for CredentialShape
impl Default for CredentialShape
Source§fn default() -> CredentialShape
fn default() -> CredentialShape
Source§impl<'de> Deserialize<'de> for CredentialShape
impl<'de> Deserialize<'de> for CredentialShape
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for CredentialShape
Source§impl PartialEq for CredentialShape
impl PartialEq for CredentialShape
Source§impl Serialize for CredentialShape
impl Serialize for CredentialShape
impl StructuralPartialEq for CredentialShape
Auto Trait Implementations§
impl Freeze for CredentialShape
impl RefUnwindSafe for CredentialShape
impl Send for CredentialShape
impl Sync for CredentialShape
impl Unpin for CredentialShape
impl UnsafeUnpin for CredentialShape
impl UnwindSafe for CredentialShape
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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