Compare commits

...

1 Commits

Author SHA1 Message Date
eric sciple
fa07c78c0c . 2022-01-26 13:15:05 -06:00
2 changed files with 15 additions and 0 deletions

View File

@@ -84,6 +84,7 @@ namespace GitHub.Runner.Common
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscape);
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift1);
this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift2);
this.SecretMasker.AddValueEncoder(ValueEncoders.BashComparand);
this.SecretMasker.AddValueEncoder(ValueEncoders.CommandLineArgumentEscape);
this.SecretMasker.AddValueEncoder(ValueEncoders.ExpressionStringEscape);
this.SecretMasker.AddValueEncoder(ValueEncoders.JsonStringEscape);

View File

@@ -38,6 +38,20 @@ namespace GitHub.DistributedTask.Logging
return Base64StringEscapeShift(value, 2);
}
public static String BashComparand(String value)
{
var result = new StringBuilder();
foreach (var c in value)
{
if (!char.IsLowSurrogate(c))
{
result.Append('\\');
}
result.Append(c);
}
return result.ToString();
}
// Used when we pass environment variables to docker to escape " with \"
public static String CommandLineArgumentEscape(String value)
{