mirror of
https://github.com/actions/runner.git
synced 2025-12-10 04:06:57 +00:00
Remove unneeded base64 encoders (#128)
* Remove unneeded base64 encoders * update comment
This commit is contained in:
committed by
Tingluo Huang
parent
8777686c11
commit
c3b11b36e9
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user