Compare commits

..

3 commits

Author SHA1 Message Date
d58e46d65e test(fs): add tests
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
ci/woodpecker/tag/woodpecker Pipeline was successful
2024-04-28 15:24:09 +01:00
b32c10f080 refactor(fs/tests): group into modules 2024-04-28 15:24:08 +01:00
a9057a8831 feat(fs): properly validates paths are within base directory 2024-04-28 15:24:06 +01:00

View file

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