Skip to content

Commit 6730452

Browse files
estringanagleocadie
authored andcommitted
Add SSRF Rasp capability (#814)
1 parent 872c109 commit 6730452

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

profiling-ffi/src/exporter.rs

+11-5
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ use ddcommon::tag::Tag;
1111
use ddcommon_ffi::slice::{AsBytes, ByteSlice, CharSlice, Slice};
1212
use ddcommon_ffi::{Error, MaybeError, Timespec};
1313
use std::borrow::Cow;
14+
use std::panic::{AssertUnwindSafe, catch_unwind};
1415
use std::ptr::NonNull;
1516
use std::str::FromStr;
1617

@@ -200,11 +201,16 @@ pub unsafe extern "C" fn ddog_prof_Exporter_set_timeout(
200201
exporter: Option<&mut ProfileExporter>,
201202
timeout_ms: u64,
202203
) -> MaybeError {
203-
if let Some(ptr) = exporter {
204-
ptr.set_timeout(timeout_ms);
205-
MaybeError::None
206-
} else {
207-
MaybeError::Some(Error::from("Invalid argument"))
204+
match catch_unwind(AssertUnwindSafe(|| {
205+
if let Some(ptr) = exporter {
206+
ptr.set_timeout(timeout_ms);
207+
MaybeError::None
208+
} else {
209+
MaybeError::Some(Error::from("Invalid argument"))
210+
}
211+
})) {
212+
Ok(r) => r,
213+
Err(_) => MaybeError::Some(Error::from("oops"))
208214
}
209215
}
210216

remote-config/src/path.rs

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub enum RemoteConfigProduct {
2222
AsmDD,
2323
AsmFeatures,
2424
AsmRaspLfi,
25+
AsmRaspSsrf,
2526
LiveDebugger,
2627
}
2728

@@ -35,6 +36,7 @@ impl Display for RemoteConfigProduct {
3536
RemoteConfigProduct::AsmData => "ASM_DATA",
3637
RemoteConfigProduct::AsmFeatures => "ASM_FEATURES",
3738
RemoteConfigProduct::AsmRaspLfi => "ASM_RASP_LFI",
39+
RemoteConfigProduct::AsmRaspSsrf => "ASM_RASP_SSRF",
3840
};
3941
write!(f, "{}", str)
4042
}
@@ -83,6 +85,7 @@ impl RemoteConfigPath {
8385
"ASM_DATA" => RemoteConfigProduct::AsmData,
8486
"ASM_FEATURES" => RemoteConfigProduct::AsmFeatures,
8587
"ASM_RASP_LFI" => RemoteConfigProduct::AsmRaspLfi,
88+
"ASM_RASP_SSRF" => RemoteConfigProduct::AsmRaspSsrf,
8689
product => anyhow::bail!("Unknown product {}", product),
8790
},
8891
config_id: parts[parts.len() - 2],

0 commit comments

Comments
 (0)