diff --git a/src/Runner.Common/HostContext.cs b/src/Runner.Common/HostContext.cs index 8cb8d0103..1a30ac0bd 100644 --- a/src/Runner.Common/HostContext.cs +++ b/src/Runner.Common/HostContext.cs @@ -84,9 +84,6 @@ namespace GitHub.Runner.Common this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscape); this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift1); this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift2); - this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift3); - this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift4); - this.SecretMasker.AddValueEncoder(ValueEncoders.Base64StringEscapeShift5); this.SecretMasker.AddValueEncoder(ValueEncoders.ExpressionStringEscape); this.SecretMasker.AddValueEncoder(ValueEncoders.JsonStringEscape); this.SecretMasker.AddValueEncoder(ValueEncoders.UriDataEscape); diff --git a/src/Sdk/DTLogging/Logging/ValueEncoders.cs b/src/Sdk/DTLogging/Logging/ValueEncoders.cs index 2e9b04145..52aed6975 100644 --- a/src/Sdk/DTLogging/Logging/ValueEncoders.cs +++ b/src/Sdk/DTLogging/Logging/ValueEncoders.cs @@ -17,10 +17,16 @@ namespace GitHub.DistributedTask.Logging return Convert.ToBase64String(Encoding.UTF8.GetBytes(value)); } - // Base64 is 6 bytes -> char + // Base64 is 6 bits -> char + // A byte is 8 bits // When end user doing somthing like base64(user:password) // The length of the leading content will cause different base64 encoding result on the password - // So we add base64(value - 1/2/3/4/5 bytes) as secret as well. + // So we add base64(value shifted 1 and two bytes) as secret as well. + // B1 B2 B3 B4 B5 B6 B7 + // 000000|00 0000|0000 00|000000| 000000|00 0000|0000 00|000000| + // Char1 Char2 Char3 Char4 + // See the above, the first byte has a character beginning at index 0, the second byte has a character beginning at index 4, the third byte has a character beginning at index 2 and then the pattern repeats + // We register byte offsets for all these possible values public static String Base64StringEscapeShift1(String value) { return Base64StringEscapeShift(value, 1); @@ -31,21 +37,6 @@ namespace GitHub.DistributedTask.Logging return Base64StringEscapeShift(value, 2); } - public static String Base64StringEscapeShift3(String value) - { - return Base64StringEscapeShift(value, 3); - } - - public static String Base64StringEscapeShift4(String value) - { - return Base64StringEscapeShift(value, 4); - } - - public static String Base64StringEscapeShift5(String value) - { - return Base64StringEscapeShift(value, 5); - } - public static String ExpressionStringEscape(String value) { return Expressions.ExpressionUtil.StringEscape(value);