-
Notifications
You must be signed in to change notification settings - Fork 981
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add masks for multiline secrets from ::add-mask::
#1521
Conversation
@@ -381,6 +381,13 @@ public void ProcessCommand(IExecutionContext context, string line, ActionCommand | |||
|
|||
HostContext.SecretMasker.AddValue(command.Data); | |||
Trace.Info($"Add new secret mask with length of {command.Data.Length}"); | |||
|
|||
// Also add each individual line. Typically individual lines are processed from STDOUT of child processes. | |||
var split = command.Data.Split(new[] { '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we also do StringSplitOptions.TrimEntries
so we can avoid trimming each item?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TrimEntries
is new in dotnet 5+, i am going to merge the dotnet 6 PR and then add this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM nit feedback
19000da
to
14828bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When the runner gets a secret coming from the service as part of the job message, if the secret has multiline, the runner will break the multiline and add a secret masker to each line.
However, we don't have the same logic when an action or step tries to register a new secret masker with
::add-mask::
.We should copy the logic and do the same thing with
::add-mask::