Expand description
Structured security warning API for extensions.
Extensions that access external resources (network, files, credentials) should
emit structured warnings when potentially unsafe operations occur. This module
provides ExtensionWarning, WarningSeverity, and a thread-safe
WarningCollector that extensions can use to accumulate warnings during
execution and surface them through a consistent interface (e.g., a DuckDB
table function like __extension_warnings()).
§Example
use quack_rs::warning::{ExtensionWarning, WarningSeverity, WarningCollector};
let collector = WarningCollector::new();
collector.emit(ExtensionWarning {
code: "TLS_NO_VERIFY",
severity: WarningSeverity::High,
message: "TLS certificate verification is disabled".into(),
cwe: Some(295),
});
let warnings = collector.drain();
assert_eq!(warnings.len(), 1);
assert_eq!(warnings[0].code, "TLS_NO_VERIFY");Structs§
- Extension
Warning - A structured warning emitted by an extension.
- Warning
Collector - A thread-safe collector for
ExtensionWarnings.
Enums§
- Warning
Severity - Severity level for extension warnings.
Constants§
- DEFAULT_
MAX_ WARNINGS - How many warnings a
WarningCollector::newcollector keeps before it starts counting instead of storing.