Added masking

This commit is contained in:
2024-08-15 21:48:41 +02:00
parent 7e41f8108d
commit 5f26cb9180
11 changed files with 344 additions and 32 deletions

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using EonaCat.Logger.EonaCatCoreLogger;
using EonaCat.Logger.EonaCatCoreLogger.Models;
using EonaCat.Logger.GrayLog;
@@ -167,6 +168,44 @@ public class LoggerSettings
/// </summary>
public string LogOrigin { get; set; }
/// <summary>
/// Determines if we need to mask certain keywords
/// </summary>
public bool UseMask { get; set; }
/// <summary>
/// Determines the keywords to mask
/// </summary>
public List<string> MaskedKeywords { get; set; } = new List<string>();
public string Mask { get; set; } = "***MASKED***";
/// <summary>
/// Determines that if masking is enabled we also need to use the default masking options:
/// IP addresses
/// MAC addresses
/// Emails
/// Passwords
/// Credit card numbers
/// Social security numbers (SSN) and BSN (Dutch Citizen Service Number)
/// API keys/tokens
/// Phone numbers (generic and Dutch specific)
/// Dates of birth (DOB) or other date formats
/// IBAN/Bank account numbers (generic and Dutch specific)
/// JWT tokens
/// URLs with sensitive query strings
/// License keys
/// Public and private keys (e.g., PEM format)
/// Dutch KVK number (8 or 12 digits)
/// Dutch BTW-nummer (VAT number)
/// Dutch driving license number (10-12 characters)
/// Dutch health insurance number (Zorgnummer)
/// Other Dutch Bank Account numbers (9-10 digits)
/// Dutch Passport Numbers (9 alphanumeric characters
/// Dutch Identification Document Numbers (varying formats)
/// Custom keywords specified in LoggerSettings
/// </summary>
public bool UseDefaultMasking { get; set; } = true;
public event LogDelegate OnLog;
private static FileLoggerOptions CreateDefaultFileLoggerOptions()