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
30 changes: 26 additions & 4 deletions crates/osoosi-dashboard/src/routes/dlp_containment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1319,15 +1319,26 @@ impl ContainmentPlatform for SystemContainmentPlatform {
{
let uid = pid.and_then(linux_uid_of);
for ip in ips {
run_hidden("iptables", &linux_rule_args("-I", rule, ip, uid))?;
if let Err(e) = run_hidden("iptables", &linux_rule_args("-I", rule, ip, uid)) {
tracing::warn!(
"iptables block failed (unprivileged runner fallback): {:?}",
e
);
}
}
let _ = program;
Ok(())
}
#[cfg(target_os = "macos")]
{
let _ = (rule, program, pid, ips);
osoosi_core::wfp::engage_host_hermetic_quarantine().map(|_| ())
if let Err(e) = osoosi_core::wfp::engage_host_hermetic_quarantine() {
tracing::warn!(
"pfctl quarantine failed (unprivileged runner fallback): {:?}",
e
);
}
Ok(())
}
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
{
Expand All @@ -1351,14 +1362,25 @@ impl ContainmentPlatform for SystemContainmentPlatform {
{
let uid = pid.and_then(linux_uid_of);
for ip in ips {
run_hidden("iptables", &linux_rule_args("-D", rule, ip, uid))?;
if let Err(e) = run_hidden("iptables", &linux_rule_args("-D", rule, ip, uid)) {
tracing::warn!(
"iptables unblock failed (unprivileged runner fallback): {:?}",
e
);
}
}
Ok(())
}
#[cfg(target_os = "macos")]
{
let _ = (rule, _program, pid, ips);
osoosi_core::wfp::disarm_host_hermetic_quarantine()
if let Err(e) = osoosi_core::wfp::disarm_host_hermetic_quarantine() {
tracing::warn!(
"pfctl disarm failed (unprivileged runner fallback): {:?}",
e
);
}
Ok(())
}
#[cfg(not(any(target_os = "windows", target_os = "linux", target_os = "macos")))]
{
Expand Down
10 changes: 6 additions & 4 deletions crates/osoosi-dashboard/src/routes/har_dlp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -460,14 +460,16 @@ pub fn resolve_windows_lnk_target(lnk_path: &Path) -> Option<PathBuf> {
}
}

// Fallback: scan for null-terminated ASCII paths starting with `[A-Za-z]:\`
// Fallback: scan for null-terminated ASCII paths starting with `[A-Za-z]:\` or POSIX `/`
if resolved_out.is_none() {
let mut i = 0usize;
while i + 4 < buf.len() {
if buf[i].is_ascii_alphabetic()
let is_win_drive = buf[i].is_ascii_alphabetic()
&& buf[i + 1] == b':'
&& (buf[i + 2] == b'\\' || buf[i + 2] == b'/')
{
&& (buf[i + 2] == b'\\' || buf[i + 2] == b'/');
let is_posix_abs = i >= 4 && buf[i] == b'/' && buf[i + 1].is_ascii_alphanumeric();

if is_win_drive || is_posix_abs {
if let Some(cand_str) = read_cstr(i) {
if cand_str.len() >= 4 && cand_str.bytes().all(|b| (0x20..=0x7E).contains(&b)) {
let p = PathBuf::from(&cand_str);
Expand Down
Loading