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

Notify on unsecure commands #731

Merged
merged 11 commits into from
Oct 2, 2020
Merged

Notify on unsecure commands #731

merged 11 commits into from
Oct 2, 2020

Conversation

thboop
Copy link
Collaborator

@thboop thboop commented Oct 1, 2020

The purpose of this PR is to add telemetry and notify PR's when they are using the unsecure commands in the runner. Eventually, we will need to disable these commands, but getting people to migrate off of them is the first step. This pr will create annotations on runs where these commands are used. For example:
image

Testing

  • MacOS
  • Ubuntu
  • Ubuntu Job container
  • Ubuntu container action
  • GHES (In progress)

Copy link
Contributor

@juliobbv juliobbv left a comment

Choose a reason for hiding this comment

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

Left you some comments. I'll take another look once they're addressed 👍

src/Runner.Worker/ActionCommandManager.cs Outdated Show resolved Hide resolved
@thboop
Copy link
Collaborator Author

thboop commented Oct 1, 2020

Should have responded to all your feedback @juliobbv

}

var allowUnsecureCommands = false;
bool.TryParse(Environment.GetEnvironmentVariable(Constants.Variables.Actions.AllowUnsupportedCommands), out allowUnsecureCommands);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@ericsciple this pulls from the .env file in the layout folder of the runner. Users won't be able to set it in their workflow job env.

@@ -282,6 +309,33 @@ public sealed class AddPathCommandExtension : RunnerService, IActionCommandExten

public void ProcessCommand(IExecutionContext context, string line, ActionCommand command, ContainerInfo container)
{
var serverUrl = context.GetGitHubContext("server_url");
Copy link
Collaborator

Choose a reason for hiding this comment

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

            var configurationStore = HostContext.GetService<IConfigurationStore>();
            var isHostedServer = configurationStore.GetSettings().IsHostedServer;

Copy link
Collaborator

@ericsciple ericsciple Oct 2, 2020

Choose a reason for hiding this comment

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

^ better for consistency with the other places in the runner

{
throw new Exception(String.Format(Constants.Runner.UnsupportedCommandMessageDisabled, this.Command));
}
else if(!allowUnsecureCommands)
Copy link
Collaborator

Choose a reason for hiding this comment

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

kind of weird that allow is false, and then we warn but allow anyway

wondering whether the default value of allow should be based on whether is hosted server. And then if the env var is specified, respect it.

@thboop thboop merged commit 6332a52 into main Oct 2, 2020
@thboop thboop deleted the NotifyOnUnsecureCommands branch October 2, 2020 15:34
AdamOlech pushed a commit to antmicro/runner that referenced this pull request Jan 28, 2021
* notify on unsecure commands
TingluoHuang pushed a commit that referenced this pull request Apr 21, 2021
* notify on unsecure commands
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.

3 participants