Skip to content

Commit 0542166

Browse files
committed
Issue 573 Write the results of GET command calls to the log
Use the WriteDictionarySecrets() method to safely log the dictionary of data that will be written back to the calling Git process When it is necessary to follow the processing in GCM during a call from Git the GCM_TRACE environment variable can be used to print trace information to standard error, however the ultimate output of GET commands would not be included in this trace information This lack of visibility is especially problematic during multi-stage authentication such as OAuth, adding safe logging of the final output makes it possible to follow the GCM process in realtime from inputs to outputs during Git GET requests
1 parent 9b3bf45 commit 0542166

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/shared/Core/Commands/GetCommand.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Collections.Generic;
23
using System.Threading.Tasks;
34

@@ -35,6 +36,9 @@ protected override async Task ExecuteInternalAsync(InputArguments input, IHostPr
3536
output["username"] = credential.Account;
3637
output["password"] = credential.Password;
3738

39+
Context.Trace.WriteLine("Writing credentials to output:");
40+
Context.Trace.WriteDictionarySecrets(output, new []{ "password" }, StringComparer.OrdinalIgnoreCase);
41+
3842
// Write the values to standard out
3943
Context.Streams.Out.WriteDictionary(output);
4044
}

0 commit comments

Comments
 (0)