diff --git a/components-rs/sidecar.rs b/components-rs/sidecar.rs index 7835fdb3bb..e96cdc80e2 100644 --- a/components-rs/sidecar.rs +++ b/components-rs/sidecar.rs @@ -55,7 +55,19 @@ lazy_static! { static ref APPSEC_CONFIG: Mutex> = Mutex::new(None); } +// Records the appsec helper configuration to be handed to the sidecar. +// // must be called prior to ddog_sidecar_connect +// +// Note: `shared_lib_path`, `socket_file_path` and `lock_file_path` are currently +// ignored. libdatadog dropped them from `AppSecConfig` when the sidecar stopped +// launching the helper itself (injecting the helper shared object into the +// daemon and calling `appsec_helper_main` through `dlsym`). The helper is now +// expected to be linked into whoever embeds the sidecar and to register itself +// with `datadog_sidecar::appsec::register_backend_factory`, with the extension +// talking to it over the sidecar transport instead of its own unix socket. The +// C parameters are kept because that migration needs them; see +// `tmp/REPORT.md`. #[no_mangle] pub extern "C" fn ddog_sidecar_enable_appsec( shared_lib_path: CharSlice, @@ -65,31 +77,27 @@ pub extern "C" fn ddog_sidecar_enable_appsec( log_level: CharSlice, ) -> () { let mut appsec_config_guard = APPSEC_CONFIG.lock().unwrap(); - let shared_lib_path_os: std::ffi::OsString; - let socket_file_path_os: std::ffi::OsString; - let lock_file_path_os: std::ffi::OsString; let log_file_path_os: std::ffi::OsString; #[cfg(unix)] { - shared_lib_path_os = OsStr::from_bytes(shared_lib_path.as_bytes()).to_owned(); - socket_file_path_os = OsStr::from_bytes(socket_file_path.as_bytes()).to_owned(); - lock_file_path_os = OsStr::from_bytes(lock_file_path.as_bytes()).to_owned(); log_file_path_os = OsStr::from_bytes(log_file_path.as_bytes()).to_owned(); } #[cfg(windows)] { - shared_lib_path_os = OsStr::new(&*shared_lib_path.to_utf8_lossy()).to_owned(); - socket_file_path_os = OsStr::new(&*socket_file_path.to_utf8_lossy()).to_owned(); - lock_file_path_os = OsStr::new(&*lock_file_path.to_utf8_lossy()).to_owned(); log_file_path_os = OsStr::new(&*log_file_path.to_utf8_lossy()).to_owned(); } + warn!( + "The sidecar no longer starts the appsec helper: helper {} will not be loaded and no one \ + will be listening on {}", + shared_lib_path.to_utf8_lossy(), + socket_file_path.to_utf8_lossy(), + ); + let _ = lock_file_path; + appsec_config_guard.deref_mut().replace(AppSecConfig { - shared_lib_path: shared_lib_path_os, - socket_file_path: socket_file_path_os, - lock_file_path: lock_file_path_os, log_file_path: log_file_path_os, log_level: log_level.to_utf8_lossy().to_string(), }); diff --git a/libdatadog b/libdatadog index 0c0c60b968..7327f3049c 160000 --- a/libdatadog +++ b/libdatadog @@ -1 +1 @@ -Subproject commit 0c0c60b968e7f4f2f6e43fffc3f7a1710c1eade5 +Subproject commit 7327f3049c281090f7cce7830b9430206fba11cf