diff --git a/server_manager/src/core/atomic_io.rs b/server_manager/src/core/atomic_io.rs index 07e2030..a4c72da 100644 --- a/server_manager/src/core/atomic_io.rs +++ b/server_manager/src/core/atomic_io.rs @@ -15,6 +15,7 @@ use std::os::unix::fs::OpenOptionsExt; /// 4. Synchronizes to disk via `fsync` (`sync_all`). /// 5. Atomically renames the temporary file to the destination path. pub fn atomic_write>(path: P, content: &[u8], mode: u32) -> Result<()> { + crate::core::validate::validate_safe_path(path.as_ref())?; let dest = path.as_ref(); let parent = dest.parent().unwrap_or_else(|| Path::new(".")); if !parent.as_os_str().is_empty() { diff --git a/server_manager/src/core/journal.rs b/server_manager/src/core/journal.rs index e4adc45..9b8246e 100644 --- a/server_manager/src/core/journal.rs +++ b/server_manager/src/core/journal.rs @@ -66,6 +66,7 @@ impl Journal { /// Opens or creates the journal file with 0600 permissions. pub fn open_or_create>(path: P) -> Result { + crate::core::validate::validate_safe_path(path.as_ref())?; let target = path.as_ref(); let parent = target.parent().unwrap_or_else(|| Path::new(".")); if !parent.as_os_str().is_empty() { diff --git a/server_manager/src/core/lock.rs b/server_manager/src/core/lock.rs index fb3e8cd..b578d18 100644 --- a/server_manager/src/core/lock.rs +++ b/server_manager/src/core/lock.rs @@ -15,6 +15,7 @@ impl ProcessLock { /// Attempts to acquire an exclusive lock on the specified path. /// If `non_blocking` is true and the lock is already held, returns an error immediately. pub fn acquire>(path: P, non_blocking: bool) -> Result { + crate::core::validate::validate_safe_path(path.as_ref())?; let target = path.as_ref(); let parent = target.parent().unwrap_or_else(|| Path::new(".")); if !parent.as_os_str().is_empty() {