Skip to content

Forbid non-trivial paths in NotBefore #197

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,
},
})

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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