pub enum SqlGuardDenyReason {
OperationNotAllowed {
operation: String,
},
TableNotAllowed {
table: String,
},
ColumnNotAllowed {
table: String,
column: String,
},
PredicateDenylisted {
pattern: String,
},
MissingWhereClause {
operation: String,
},
ParseError {
error: String,
},
NoConfig,
SelectStarDenied {
table: String,
},
}Expand description
Structured reason for a SqlQueryGuard
denial.
Every denial path in the SQL guard produces one of these variants. The
guard logs the reason via tracing::warn! and returns
Ok(Verdict::Deny); callers that need the reason programmatically can use
SqlQueryGuard::analyze which
returns the reason alongside the verdict.
Variants§
OperationNotAllowed
The parsed operation class is not present in the guard’s
operation_allowlist (fail-closed default).
TableNotAllowed
A referenced table is not present in the guard’s table_allowlist.
ColumnNotAllowed
A projected column is not present in the guard’s column_allowlist
for the given table.
PredicateDenylisted
The canonicalized WHERE/predicate text matched a denylist regex.
MissingWhereClause
A mutation (UPDATE, DELETE) lacked a WHERE clause.
ParseError
sqlparser could not parse the query. Fail-closed.
NoConfig
The guard config has no allowlists at all and allow_all is false.
Fail-closed default: an unconfigured guard denies every query.
SelectStarDenied
SELECT * attempted while a column allowlist is active.
Implementations§
Trait Implementations§
Source§impl Clone for SqlGuardDenyReason
impl Clone for SqlGuardDenyReason
Source§fn clone(&self) -> SqlGuardDenyReason
fn clone(&self) -> SqlGuardDenyReason
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SqlGuardDenyReason
impl Debug for SqlGuardDenyReason
Source§impl Display for SqlGuardDenyReason
impl Display for SqlGuardDenyReason
Source§impl Error for SqlGuardDenyReason
impl Error for SqlGuardDenyReason
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl PartialEq for SqlGuardDenyReason
impl PartialEq for SqlGuardDenyReason
impl Eq for SqlGuardDenyReason
impl StructuralPartialEq for SqlGuardDenyReason
Auto Trait Implementations§
impl Freeze for SqlGuardDenyReason
impl RefUnwindSafe for SqlGuardDenyReason
impl Send for SqlGuardDenyReason
impl Sync for SqlGuardDenyReason
impl Unpin for SqlGuardDenyReason
impl UnsafeUnpin for SqlGuardDenyReason
impl UnwindSafe for SqlGuardDenyReason
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> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.