mirror of
https://github.com/block/goose.git
synced 2026-06-02 06:19:33 +02:00
chore: replace lazy_static with std::sync::LazyLock (#8815)
Signed-off-by: Rodolfo Olivieri <rolivier@redhat.com>
This commit is contained in:
Generated
-1
@@ -4412,7 +4412,6 @@ dependencies = [
|
|||||||
"jsonschema",
|
"jsonschema",
|
||||||
"jsonwebtoken",
|
"jsonwebtoken",
|
||||||
"keyring",
|
"keyring",
|
||||||
"lazy_static",
|
|
||||||
"libc",
|
"libc",
|
||||||
"llama-cpp-2",
|
"llama-cpp-2",
|
||||||
"lru",
|
"lru",
|
||||||
|
|||||||
@@ -99,7 +99,6 @@ base64 = { workspace = true }
|
|||||||
url = { workspace = true }
|
url = { workspace = true }
|
||||||
axum = { workspace = true, features = ["ws"] }
|
axum = { workspace = true, features = ["ws"] }
|
||||||
webbrowser = { workspace = true }
|
webbrowser = { workspace = true }
|
||||||
lazy_static = "1.5.0"
|
|
||||||
tracing = { workspace = true }
|
tracing = { workspace = true }
|
||||||
tracing-subscriber = { workspace = true }
|
tracing-subscriber = { workspace = true }
|
||||||
tracing-futures = { workspace = true }
|
tracing-futures = { workspace = true }
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
use lazy_static::lazy_static;
|
|
||||||
use regex::Regex;
|
use regex::Regex;
|
||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
|
use std::sync::LazyLock;
|
||||||
|
|
||||||
/// Security threat patterns for command injection detection
|
/// Security threat patterns for command injection detection
|
||||||
/// These patterns detect dangerous shell commands and injection attempts
|
/// These patterns detect dangerous shell commands and injection attempts
|
||||||
@@ -315,17 +315,15 @@ pub const THREAT_PATTERNS: &[ThreatPattern] = &[
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
lazy_static! {
|
static COMPILED_PATTERNS: LazyLock<HashMap<&'static str, Regex>> = LazyLock::new(|| {
|
||||||
static ref COMPILED_PATTERNS: HashMap<&'static str, Regex> = {
|
let mut patterns = HashMap::new();
|
||||||
let mut patterns = HashMap::new();
|
for threat in THREAT_PATTERNS {
|
||||||
for threat in THREAT_PATTERNS {
|
if let Ok(regex) = Regex::new(&format!("(?i){}", threat.pattern)) {
|
||||||
if let Ok(regex) = Regex::new(&format!("(?i){}", threat.pattern)) {
|
patterns.insert(threat.name, regex);
|
||||||
patterns.insert(threat.name, regex);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
patterns
|
}
|
||||||
};
|
patterns
|
||||||
}
|
});
|
||||||
|
|
||||||
/// Pattern matcher for detecting security threats
|
/// Pattern matcher for detecting security threats
|
||||||
pub struct PatternMatcher {
|
pub struct PatternMatcher {
|
||||||
|
|||||||
@@ -90,10 +90,9 @@ impl TestReport {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
lazy_static::lazy_static! {
|
static TEST_REPORT: std::sync::LazyLock<Arc<TestReport>> =
|
||||||
static ref TEST_REPORT: Arc<TestReport> = TestReport::new();
|
std::sync::LazyLock::new(TestReport::new);
|
||||||
static ref ENV_LOCK: Mutex<()> = Mutex::new(());
|
static ENV_LOCK: std::sync::LazyLock<Mutex<()>> = std::sync::LazyLock::new(|| Mutex::new(()));
|
||||||
}
|
|
||||||
|
|
||||||
struct ProviderFixture {
|
struct ProviderFixture {
|
||||||
name: String,
|
name: String,
|
||||||
|
|||||||
Reference in New Issue
Block a user