Skip to content

Commit

Permalink
found better function
Browse files Browse the repository at this point in the history
  • Loading branch information
Buckram123 committed Feb 24, 2024
1 parent 42bb1fe commit 639ec4d
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,7 @@ fn dynamic(ident: &syn::Ident, folder_path: String, prefix: Option<&str>, includ
// Tried to request a path that is not in the embedded folder

// Should be allowed only if it was a symlink
// TODO: Currently it allows "path_traversal_attack" for the symlink files
// For it to be working properly we need to get absolute path first
// and check that instead if it starts with `canonical_folder_path`
// https://doc.rust-lang.org/std/path/fn.absolute.html (currently nightly)
let metadata = ::std::fs::metadata(file_path.as_path()).ok()?;
let metadata = ::std::fs::symlink_metadata(file_path.as_path()).ok()?;
if !metadata.is_symlink() {
return ::std::option::Option::None;
}
Expand Down

0 comments on commit 639ec4d

Please sign in to comment.