atlas_common/file/mod.rs
1//! Secure file operation utilities
2//!
3//! This module provides safe file operations that protect against common
4//! security issues like symlink attacks and hard link manipulation.
5//!
6//! # Security Features
7//!
8//! - Symlink attack prevention
9//! - Hard link detection
10//! - Path validation
11//! - Safe file creation and opening
12//!
13//! # Example
14//!
15//! ```rust,no_run
16//! use atlas_common::file::{safe_create_file, safe_open_file};
17//! use std::io::{Read, Write};
18//! use std::path::Path;
19//!
20//! // Safely create a file
21//! let mut file = safe_create_file(Path::new("output.txt"), false)?;
22//! file.write_all(b"secure data")?;
23//!
24//! // Safely read a file
25//! let mut file = safe_open_file(Path::new("input.txt"), false)?;
26//! let mut contents = String::new();
27//! file.read_to_string(&mut contents)?;
28//! # Ok::<(), atlas_common::Error>(())
29//! ```
30
31mod security;
32
33pub use security::{safe_create_file, safe_file_path, safe_open_file, safe_open_options};