Skip to main content

Module warning

Module warning 

Source
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§

ExtensionWarning
A structured warning emitted by an extension.
WarningCollector
A thread-safe collector for ExtensionWarnings.

Enums§

WarningSeverity
Severity level for extension warnings.

Constants§

DEFAULT_MAX_WARNINGS
How many warnings a WarningCollector::new collector keeps before it starts counting instead of storing.