mirror of
https://github.com/usestrix/firewall.git
synced 2026-11-09 05:19:35 -10:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8bb60c1214 |
No files matched your search
+7
-1
@@ -25,6 +25,10 @@ pub struct BlockedPackage {
|
||||
pub version: Option<String>,
|
||||
pub filter: &'static str,
|
||||
pub reason: String,
|
||||
/// Flagged as malware, not just held back for being new.
|
||||
pub malicious: bool,
|
||||
/// Malware is never allowed, and a new package only by version. Saves each app the rule.
|
||||
pub trustable: bool,
|
||||
}
|
||||
|
||||
struct Blocks {
|
||||
@@ -96,9 +100,11 @@ fn record(
|
||||
version: pkg.version.clone(),
|
||||
filter,
|
||||
reason: reason.to_owned(),
|
||||
malicious: filter != "age",
|
||||
trustable: filter == "age" && pkg.version.is_some(),
|
||||
};
|
||||
push(&mut blocks.unsent, block.clone());
|
||||
if filter != "age" {
|
||||
if block.malicious {
|
||||
return None;
|
||||
}
|
||||
let (wake, allowed) = watch::channel(false);
|
||||
|
||||
@@ -16,6 +16,8 @@ async fn allowing_once_releases_the_held_download() {
|
||||
let id = loop {
|
||||
let blocks: serde_json::Value = serde_json::from_str(&answer(&firewall, config, "blocks")).unwrap();
|
||||
if let Some(id) = blocks[0]["id"].as_u64() {
|
||||
assert_eq!(blocks[0]["malicious"], false);
|
||||
assert_eq!(blocks[0]["trustable"], true);
|
||||
break id;
|
||||
}
|
||||
tokio::time::sleep(Duration::from_millis(10)).await;
|
||||
|
||||
Reference in new issue
Block a user