Compare commits

..

3 commits

Author SHA1 Message Date
984724a465 test(fs): add tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
2024-04-28 15:21:50 +01:00
4ad6f45379 refactor(fs/tests): group into modules 2024-04-28 15:01:29 +01:00
607d58df84 feat(fs): properly validates paths are within base directory 2024-04-28 14:58:55 +01:00

View file

@ -57,11 +57,11 @@ impl super::FileSystemLike for RealFileSystem {
impl RealFileSystem {
fn validate(&self, path: &Path) -> super::Result<()> {
let path = self.clean_path(path)?;
if !path.starts_with(&self.base) {
let canon = self.clean_path(path)?;
if !canon.starts_with(&self.base) {
return Err(super::Error::PathTraversal {
base: self.base.clone(),
path,
path: canon.to_path_buf(),
});
}
Ok(())