mirror of
https://github.com/actions/runner.git
synced 2025-12-10 20:36:49 +00:00
Compare commits
3 Commits
thboop/fix
...
v2.296.1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
219852abcb | ||
|
|
8dc5ca2208 | ||
|
|
0f4622653b |
@@ -1,9 +1,6 @@
|
|||||||
## Bugs
|
## Bugs
|
||||||
- Avoid key based command injection via Docker command arguments (#2062)
|
- Fixed an issue where job and service container envs were corrupted (#2091)
|
||||||
## Misc
|
## Misc
|
||||||
- Added step context name and start/finish time in step telemetry (#2069)
|
|
||||||
- Improved error logs when there is a missing 'using' token configuration in the metadata file (#2052)
|
|
||||||
- Added full job name and nested workflow details in log (#2049)
|
|
||||||
|
|
||||||
## Windows x64
|
## Windows x64
|
||||||
We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows.
|
We recommend configuring the runner in a root folder of the Windows drive (e.g. "C:\actions-runner"). This will help avoid issues related to service identity folder permissions and long file path restrictions on Windows.
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<Update to ./src/runnerversion when creating release>
|
2.296.1
|
||||||
|
|||||||
@@ -585,8 +585,6 @@ namespace GitHub.Runner.Worker
|
|||||||
|
|
||||||
public void ProcessCommand(IExecutionContext context, string inputLine, ActionCommand command, ContainerInfo container)
|
public void ProcessCommand(IExecutionContext context, string inputLine, ActionCommand command, ContainerInfo container)
|
||||||
{
|
{
|
||||||
ValidateLinesAndColumns(command, context);
|
|
||||||
|
|
||||||
command.Properties.TryGetValue(IssueCommandProperties.File, out string file);
|
command.Properties.TryGetValue(IssueCommandProperties.File, out string file);
|
||||||
command.Properties.TryGetValue(IssueCommandProperties.Line, out string line);
|
command.Properties.TryGetValue(IssueCommandProperties.Line, out string line);
|
||||||
command.Properties.TryGetValue(IssueCommandProperties.Column, out string column);
|
command.Properties.TryGetValue(IssueCommandProperties.Column, out string column);
|
||||||
|
|||||||
@@ -107,6 +107,7 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
public async Task<string> DockerCreate(IExecutionContext context, ContainerInfo container)
|
public async Task<string> DockerCreate(IExecutionContext context, ContainerInfo container)
|
||||||
{
|
{
|
||||||
IList<string> dockerOptions = new List<string>();
|
IList<string> dockerOptions = new List<string>();
|
||||||
|
IDictionary<string, string> environment = new Dictionary<string, string>();
|
||||||
// OPTIONS
|
// OPTIONS
|
||||||
dockerOptions.Add($"--name {container.ContainerDisplayName}");
|
dockerOptions.Add($"--name {container.ContainerDisplayName}");
|
||||||
dockerOptions.Add($"--label {DockerInstanceLabel}");
|
dockerOptions.Add($"--label {DockerInstanceLabel}");
|
||||||
@@ -135,7 +136,8 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dockerOptions.Add(DockerUtil.CreateEscapedOption("-e", env.Key, env.Value));
|
environment.Add(env.Key, env.Value);
|
||||||
|
dockerOptions.Add(DockerUtil.CreateEscapedOption("-e", env.Key));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -183,7 +185,7 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
dockerOptions.Add($"{container.ContainerEntryPointArgs}");
|
dockerOptions.Add($"{container.ContainerEntryPointArgs}");
|
||||||
|
|
||||||
var optionsString = string.Join(" ", dockerOptions);
|
var optionsString = string.Join(" ", dockerOptions);
|
||||||
List<string> outputStrings = await ExecuteDockerCommandAsync(context, "create", optionsString);
|
List<string> outputStrings = await ExecuteDockerCommandAsync(context, "create", optionsString, environment);
|
||||||
|
|
||||||
return outputStrings.FirstOrDefault();
|
return outputStrings.FirstOrDefault();
|
||||||
}
|
}
|
||||||
@@ -443,6 +445,11 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<string>> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options)
|
private async Task<List<string>> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options)
|
||||||
|
{
|
||||||
|
return await ExecuteDockerCommandAsync(context, command, options, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
private async Task<List<string>> ExecuteDockerCommandAsync(IExecutionContext context, string command, string options, IDictionary<string, string> environment)
|
||||||
{
|
{
|
||||||
string arg = $"{command} {options}".Trim();
|
string arg = $"{command} {options}".Trim();
|
||||||
context.Command($"{DockerPath} {arg}");
|
context.Command($"{DockerPath} {arg}");
|
||||||
@@ -470,7 +477,7 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
workingDirectory: context.GetGitHubContext("workspace"),
|
workingDirectory: context.GetGitHubContext("workspace"),
|
||||||
fileName: DockerPath,
|
fileName: DockerPath,
|
||||||
arguments: arg,
|
arguments: arg,
|
||||||
environment: null,
|
environment: environment,
|
||||||
requireExitCodeZero: true,
|
requireExitCodeZero: true,
|
||||||
outputEncoding: null,
|
outputEncoding: null,
|
||||||
cancellationToken: CancellationToken.None);
|
cancellationToken: CancellationToken.None);
|
||||||
|
|||||||
@@ -71,15 +71,6 @@ namespace GitHub.Runner.Worker.Container
|
|||||||
return $"{flag} \"{EscapeString(key)}\"";
|
return $"{flag} \"{EscapeString(key)}\"";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string CreateEscapedOption(string flag, string key, string value)
|
|
||||||
{
|
|
||||||
if (String.IsNullOrEmpty(key))
|
|
||||||
{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
return $"{flag} \"{EscapeString(key)}={value.Replace("\"", "\\\"")}\"";
|
|
||||||
}
|
|
||||||
|
|
||||||
private static string EscapeString(string value)
|
private static string EscapeString(string value)
|
||||||
{
|
{
|
||||||
return value.Replace("\\", "\\\\").Replace("\"", "\\\"");
|
return value.Replace("\\", "\\\\").Replace("\"", "\\\"");
|
||||||
|
|||||||
@@ -171,32 +171,5 @@ namespace GitHub.Runner.Common.Tests.Worker.Container
|
|||||||
}
|
}
|
||||||
Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[Trait("Level", "L0")]
|
|
||||||
[Trait("Category", "Worker")]
|
|
||||||
[InlineData("HOME", "", "HOME", "")]
|
|
||||||
[InlineData("HOME alpine:3.8 sh -c id #", "HOME alpine:3.8 sh -c id #", "HOME alpine:3.8 sh -c id #", "HOME alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \"alpine:3.8 sh -c id #", "HOME \"alpine:3.8 sh -c id #", "HOME \\\"alpine:3.8 sh -c id #", "HOME \\\"alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \\\"alpine:3.8 sh -c id #", "HOME \\\"alpine:3.8 sh -c id #", "HOME \\\\\\\"alpine:3.8 sh -c id #", "HOME \\\\\"alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \\\\\"alpine:3.8 sh -c id #", "HOME \\\\\"alpine:3.8 sh -c id #", "HOME \\\\\\\\\\\"alpine:3.8 sh -c id #", "HOME \\\\\\\"alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \"\"alpine:3.8 sh -c id #", "HOME \"\"alpine:3.8 sh -c id #", "HOME \\\"\\\"alpine:3.8 sh -c id #", "HOME \\\"\\\"alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \\\"\"alpine:3.8 sh -c id #", "HOME \\\"\"alpine:3.8 sh -c id #", "HOME \\\\\\\"\\\"alpine:3.8 sh -c id #", "HOME \\\\\"\\\"alpine:3.8 sh -c id #")]
|
|
||||||
[InlineData("HOME \"\\\"alpine:3.8 sh -c id #", "HOME \"\\\"alpine:3.8 sh -c id #", "HOME \\\"\\\\\\\"alpine:3.8 sh -c id #", "HOME \\\"\\\\\"alpine:3.8 sh -c id #")]
|
|
||||||
public void CreateEscapedOption_keyValue(string keyInput, string valueInput, string escapedKey, string escapedValue)
|
|
||||||
{
|
|
||||||
var flag = "--example";
|
|
||||||
var actual = DockerUtil.CreateEscapedOption(flag, keyInput, valueInput);
|
|
||||||
string expected;
|
|
||||||
if (String.IsNullOrEmpty(keyInput))
|
|
||||||
{
|
|
||||||
expected = "";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
expected = $"{flag} \"{escapedKey}={escapedValue}\"";
|
|
||||||
}
|
|
||||||
Assert.Equal(expected, actual);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.296.0
|
2.296.1
|
||||||
|
|||||||
Reference in New Issue
Block a user