Skip to content

Commit

Permalink
match number of * characters with the length of password in the debug…
Browse files Browse the repository at this point in the history
… log
  • Loading branch information
Guiorgy committed Nov 25, 2021
1 parent f25de19 commit a6c27ec
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Service.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ private void ReadJsonConfig()
{
DebugLog($"Loading configuration \"{configPath}\":");
string json = File.ReadAllText(configPath);
DebugLog(new Regex("(\"password\":)(.*?)(,|\n|\r)").Replace(json, "$1\"********\"$3"));
DebugLog(Regex.Replace(json,
"(\"password\"\\s*:\\s*\")(.*?)(\")(,|\n|\r)",
m => m.Groups[1].Value + new string('*', m.Groups[2].Length) + '"' + m.Groups[4].Value));
configurations = JsonConvert.DeserializeObject<List<ServiceConfiguration>>(json);
DebugLog("Configuration loaded:");
foreach (var cfg in configurations)
Expand Down

0 comments on commit a6c27ec

Please sign in to comment.