Skip to main content

verify_path_component

Function verify_path_component 

Source
pub fn verify_path_component(
    name: &[u8],
    prot: PathProtection,
    is_symlink: bool,
) -> Result<(), Error>
Expand description

Check whether a single path component (file or directory name) is forbidden.

Mirrors Git’s verify_path() / verify_dotfile(): ., .., and .git (plus its HFS/NTFS folds) are always rejected; an HFS/NTFS-folded .gitmodules is rejected only when the entry is a symlink (CVE-2018-11235). Regular files named .gitignore, .gitmodules, .mailmap, etc. are allowed — Git does not reject them in verify_path.

§Errors

Returns Error::InvalidPath when the name is rejected.