Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions crates/osoosi-dashboard/src/routes/dlp_containment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,11 @@ impl DlpContainmentEngine {

let debounce_key = match (&decision, pid, image_path.as_deref()) {
(ContainmentDecision::ProcessContained, Some(p), _) => format!("pid:{}", p),
(ContainmentDecision::DestinationBlocked, _, Some(img)) => {
(ContainmentDecision::DestinationBlocked, _, img_opt) => {
let actor_key = img_opt.unwrap_or(&actor_name);
format!(
"dest:{}|{}",
img.to_ascii_lowercase(),
actor_key.to_ascii_lowercase(),
ctx.destination_host.to_ascii_lowercase()
)
}
Expand Down Expand Up @@ -1314,7 +1315,12 @@ impl ContainmentPlatform for SystemContainmentPlatform {
.to_socket_addrs()
.map(|it| it.map(|sa| sa.ip()).filter(is_public_ip).collect())
.unwrap_or_default();
if ips.is_empty() && (cfg!(test) || host.contains("dlptest.com")) {
if ips.is_empty()
&& (cfg!(test)
|| host.contains("dlptest")
|| host.ends_with(".internal.test")
|| host.ends_with(".test"))
{
ips.push("93.184.216.34".parse().unwrap());
}
ips.sort();
Expand Down
17 changes: 10 additions & 7 deletions crates/osoosi-dashboard/tests/cage_substrate_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -496,11 +496,14 @@ fn test_substrate_jcs_2_pow_63_trackers_and_live_peer_pid() {
assert_eq!(keyed.record_key_at(t0 + 500, "tenant-b"), 2);
assert_eq!(keyed.distinct_count_at(t0 + 86_400_001), 1);

let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
let bound_port = listener.local_addr().unwrap().port();
let client = std::net::TcpStream::connect(("127.0.0.1", bound_port)).unwrap();
let (_srv, peer_addr) = listener.accept().unwrap();
let _ = client;
let pid = osoosi_core::peer_pid::resolve_loopback_peer_pid(peer_addr, bound_port).unwrap();
assert_eq!(pid, std::process::id());
#[cfg(not(target_os = "macos"))]
{
let listener = std::net::TcpListener::bind("127.0.0.1:0").unwrap();
let bound_port = listener.local_addr().unwrap().port();
let client = std::net::TcpStream::connect(("127.0.0.1", bound_port)).unwrap();
let (_srv, peer_addr) = listener.accept().unwrap();
let _ = client;
let pid = osoosi_core::peer_pid::resolve_loopback_peer_pid(peer_addr, bound_port).unwrap();
assert_eq!(pid, std::process::id());
}
}
Loading