Skip to content

Commit ce96634

Browse files
authored
Mask Service Principal credential in agent logs (#4891)
* Add SP creds to masker dictionary * Fix remove command
1 parent 17e66c2 commit ce96634

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

src/Agent.Listener/CommandSettings.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,18 @@ public CommandSettings(IHostContext context, string[] args, IScopedEnvironment e
7272
context.SecretMasker.AddValue(Configure.SslClientCert, WellKnownSecretAliases.ConfigureSslClientCert);
7373
context.SecretMasker.AddValue(Configure.Token, WellKnownSecretAliases.ConfigureToken);
7474
context.SecretMasker.AddValue(Configure.WindowsLogonPassword, WellKnownSecretAliases.ConfigureWindowsLogonPassword);
75+
context.SecretMasker.AddValue(Configure.TenantId, WellKnownSecretAliases.ConfigureTenantId);
76+
context.SecretMasker.AddValue(Configure.ClientId, WellKnownSecretAliases.ConfigureClientId);
77+
context.SecretMasker.AddValue(Configure.ClientSecret, WellKnownSecretAliases.ConfigureClientSecret);
7578
}
7679

7780
if (Remove != null)
7881
{
7982
context.SecretMasker.AddValue(Remove.Password, WellKnownSecretAliases.RemovePassword);
8083
context.SecretMasker.AddValue(Remove.Token, WellKnownSecretAliases.RemoveToken);
84+
context.SecretMasker.AddValue(Remove.TenantId, WellKnownSecretAliases.RemoveTenantId);
85+
context.SecretMasker.AddValue(Remove.ClientId, WellKnownSecretAliases.RemoveClientId);
86+
context.SecretMasker.AddValue(Remove.ClientSecret, WellKnownSecretAliases.RemoveClientSecret);
8187
}
8288

8389
PrintArguments();

src/Agent.Sdk/Util/WellKnownSecretAliases.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,14 @@ public static class WellKnownSecretAliases
1111
public static readonly string ConfigureSslClientCert = "Configure.SslClientCert";
1212
public static readonly string ConfigureToken = "Configure.Token";
1313
public static readonly string ConfigureWindowsLogonPassword = "Configure.WindowsLogonPassword";
14+
public static readonly string ConfigureClientId = "Configure.ClientId";
15+
public static readonly string ConfigureClientSecret = "Configure.ClientSecret";
16+
public static readonly string ConfigureTenantId = "Configure.TenantId";
1417
public static readonly string RemovePassword = "Remove.Password";
1518
public static readonly string RemoveToken = "Remove.Token";
19+
public static readonly string RemoveClientId = "Remove.ClientId";
20+
public static readonly string RemoveClientSecret = "Remove.ClientSecret";
21+
public static readonly string RemoveTenantId = "Remove.TenantId";
1622

1723
// Other known origins for secrets
1824
public static readonly string GitSourceProviderAuthHeader = "GitSourceProvider.AuthHeader";

0 commit comments

Comments
 (0)