Skip to content
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

Merged
merged 2 commits into from
Dec 1, 2021

Conversation

TingluoHuang
Copy link
Member

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::

@TingluoHuang TingluoHuang requested a review from a team as a code owner November 30, 2021 15:58
@@ -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);
Copy link
Collaborator

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?

Copy link
Member Author

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.

thboop
thboop previously approved these changes Nov 30, 2021
Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM nit feedback

Copy link
Collaborator

@thboop thboop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@TingluoHuang TingluoHuang merged commit b1ecffd into main Dec 1, 2021
@TingluoHuang TingluoHuang deleted the users/tihuang/addmaskml branch December 1, 2021 14:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants