diff --git a/Web2Gateway/G2To3Service.cs b/Web2Gateway/G2To3Service.cs index 6141119..5085bf3 100644 --- a/Web2Gateway/G2To3Service.cs +++ b/Web2Gateway/G2To3Service.cs @@ -37,7 +37,7 @@ public WellKnown GetWellKnown() var keys = await _memoryCache.GetOrCreateAsync($"{storeId}", async entry => { entry.SlidingExpiration = TimeSpan.FromMinutes(15); - _logger.LogInformation("Getting keys for {StoreId}", storeId); + _logger.LogInformation("Getting keys for {StoreId}", storeId.SanitizeForLog()); return await _dataLayer.GetKeys(storeId, null, cancellationToken); }); @@ -56,7 +56,7 @@ public WellKnown GetWellKnown() var value = await _memoryCache.GetOrCreateAsync($"{storeId}-{key}", async entry => { entry.SlidingExpiration = TimeSpan.FromMinutes(15); - _logger.LogInformation("Getting value for {StoreId} {Key}", storeId, key); + _logger.LogInformation("Getting value for {StoreId} {Key}", storeId.SanitizeForLog(), key.SanitizeForLog()); return await _dataLayer.GetValue(storeId, key, null, cancellationToken); }); diff --git a/Web2Gateway/Utils.cs b/Web2Gateway/Utils.cs index 54e57c2..8c561f9 100644 --- a/Web2Gateway/Utils.cs +++ b/Web2Gateway/Utils.cs @@ -1,9 +1,15 @@ using System.Text.Json; +using System.Text.RegularExpressions; namespace Web2Gateway; internal static class Utils { + public static string SanitizeForLog(this string input) + { + return Regex.Replace(input, @"\W", "_"); + } + public static bool IsBase64Image(string data) { return data.StartsWith("data:image", StringComparison.OrdinalIgnoreCase);