Skip to content

Forbid non-trivial paths in NotBefore #197

@robin-nitrokey

Description

@robin-nitrokey

NotBefore::Filename and NotBefore::FilenamePart store a PathBuf but the read_dir_first implementation only considers the file_name of this path. This can be confusing and lead to subtle bugs. I would suggest to either ensure that path.file_name() == path in the NotBefore constructors or to just use a raw string or byte array.

.find(|(_, entry)| match not_before {
NotBefore::None => true,
NotBefore::Filename(path) => entry.file_name() == &**path,
NotBefore::FilenamePart(path) => match entry.file_name().cmp_str(path) {
Ordering::Less => false,
Ordering::Equal | Ordering::Greater => true,
},
})

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions