feat(shell): enhance regex validators to match on entire string (#1603)

This commit is contained in:
Lucas Fernandes Nogueira
2024-08-02 10:03:35 -03:00
committed by GitHub
parent b1e5cae5a0
commit 34df132fb1
8 changed files with 45 additions and 9 deletions
+12 -1
View File
@@ -103,7 +103,18 @@ pub enum ShellAllowedArg {
/// This will require the argument value passed to this variable to match the `validator` regex
/// before it will be executed.
///
/// [regex]: https://docs.rs/regex/latest/regex/#syntax
/// The regex string is by default surrounded by `^...$` to match the full string.
/// For example the `https?://\w+` regex would be registered as `^https?://\w+$`.
///
/// [regex]: <https://docs.rs/regex/latest/regex/#syntax>
validator: String,
/// Marks the validator as a raw regex, meaning the plugin should not make any modification at runtime.
///
/// This means the regex will not match on the entire string by default, which might
/// be exploited if your regex allow unexpected input to be considered valid.
/// When using this option, make sure your regex is correct.
#[serde(default)]
raw: bool,
},
}