feat: allow redaction of secrets in commands, rather than filtering them #2933
+124
−4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This attempts to resolve #2769 by adding a new
secrets_redactoption. When enabled this option will change howsecrets_filterworks:secrets_filter = falsethen no change is made, secrets will appear in the users' history, regardless ofsecrets_redact.secrets_filter = trueandsecrets_redactisfalse, then the "old" behaviour will occur: any detected secret will exclude that whole command from the users' history.secrets_filter = trueandsecrets_redact = truethen this new mode will engage: commands with secrets will be edited before they're saved into history and the secret content will be replaced with the string"[REDACTED]".This could probably do with more testing. I think I've got it largely correct but given how sensitive the topic is I'd prefer some extra scrutiny on this one.
Checks