Skip to content

Add bracket expressions to wildcard_match #1136

@squell

Description

@squell

Describe the feature you'd like see implemented in sudo-rs
Add limited expression-style bracket expressions (e.g. "[a-z]") to https://github.com/trifectatechfoundation/sudo-rs/blob/main/src/sudo/env/wildcard_match.rs. This includes exclusion patterns such as [^a-z] and [!a-z].

What problem can be solved with this feature?
This function is used for environment filtering (env_keep). Right now this function only supports * wildcards, but I can see the use case for writing something like

Defaults env_keep += "PS[1234]"

instead of

Defaults env_keep += "PS*"

or

Defaults env_keep += "PS1 PS2 PS3 PS4"

Additional context
Having brackets here might also allow using this function for wildcard matching in the sudoers module as a replacement for our current dependency on glob crate. This crate seems to have maintenance issues (and might even panic in some circumstances if some options are enabled). Or to be blunt, is appears to be unmaintained. A PR fixing exclusion patterns we would like to see merged has been languishing there without any response from a maintainer for a long time.

Also having one less dependency would be cool.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions