[go: nahoru, domu]

Skip to content

Commit

Permalink
obfuscate pwd in sql and kql kernel display events
Browse files Browse the repository at this point in the history
  • Loading branch information
colombod committed Feb 29, 2024
1 parent f7dc954 commit b6defd4
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/Microsoft.DotNet.Interactive.SqlServer/ToolsServiceKernel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using System.Collections.Generic;
using System.CommandLine.Parsing;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
Expand Down Expand Up @@ -399,7 +400,15 @@ private string PrependVariableDeclarationsToCode(SubmitCode command, KernelInvoc
foreach (var variableNameAndValue in _variables)
{
var declareStatement = CreateVariableDeclaration(variableNameAndValue.Key, variableNameAndValue.Value);
context.Display($"Adding shared variable declaration statement : {declareStatement}");

var displayStatement = declareStatement;

if (variableNameAndValue.Value is PasswordString pwd)
{
displayStatement = displayStatement.Replace(pwd.GetClearTextPassword(), pwd.ToString());
}

context.Display($"Adding shared variable declaration statement : {displayStatement}");
sb.AppendLine(declareStatement);
}

Expand Down

0 comments on commit b6defd4

Please sign in to comment.