Skip to content

TheAlgorythm/path-ratchet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

135 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Path Ratchet

'LGPL 3.0 License' badge 'No AI' badge Crates.io Workflow Status 'Fuzzed & CI Proptests' badge crev reviews

Prevent path traversal attacks at the type level.

use std::path::PathBuf;
use path_ratchet::prelude::*;

let user_input = "/etc/shadow";
let mut filename = PathBuf::from("/tmp");
filename.push_component(SingleComponentPath::new(user_input).unwrap());

For security reasons, this crate follows the principle "Parse, don’t validate" , making it fairly simple yet effective. There are no undefined edge cases. Every case can be seen or deduced from the doctests. Fuzzing and property-based testing ensure these assumptions are met and guaranteeing the general security of the crate.

About

Prevent path traversal attacks at type level

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages