Warp
Warp copied to clipboard
PCRE support (lookaround assertions) in secret redaction
Dupe Check
- [X] I have searched Warp feature requests and there are no duplicates
Describe the solution you'd like?
The secret redaction feature should support PCRE-style expressions (i.e. widely supported Perl-Compatible Regular Expressions), particularly lookaround assertions, in order to support cases where secret output is only identifiable by surrounding context. As a simple example, one might frequently have JSON output with a password key, like:
...
"password": "RaNdOM*ChaRaCtErS",
...
PCRE support would allow us to use a pattern with lookbehind and lookahead assertions like this (an admittedly very strict approach to keep the example simple):
(?<="password": ")[^"]*(?=")
...which would produce the following output, which is ideal IMO:
...
"password": "*****************",
...
Is your feature request related to a problem? Please describe.
Right now, the closest we can get to that ideal output is with a pattern like this:
"password": "[^"]*"
However, the much less ideal result of this is that the entire match gets hidden like
...
*********** *******************,
...
Additional context
There's a similar, but narrower, feature request in #3636. I believe the PCRE support I'm describing has several advantages:
- It does address #3636 as well.
- It's more flexible, able to address more complex use cases we can't even exhaustively think of. Besides lookaround assertions, PCRE would bring a host of other capabilities.
- I'm guessing it's much easier to implement, as it probably simply involves using a different regex library than the one in Rust's standard library (I'm not a Rust person, so I won't make any specific suggestions, but some googling does turn up multiple options).
How important is this feature to you?
4
Warp Internal (ignore) - linear-label:39cc6478-1249-4ee7-950b-c428edfeecd1
None
Thanks for this feature request!
To anyone else interested in this feature, please add a 👍 to the original post at the top to signal that you want this feature, and subscribe if you'd like to be notified.