Issue #21: implement worker bootstrap and options

This commit is contained in:
Joseph Doherty
2026-04-26 16:53:06 -04:00
parent e2b4dfcb32
commit 0af1427859
19 changed files with 736 additions and 2 deletions
@@ -0,0 +1,50 @@
using System;
using System.Collections.Generic;
namespace MxGateway.Worker.Bootstrap;
public static class WorkerLogRedactor
{
public const string RedactedValue = "[redacted]";
private static readonly string[] SensitiveFieldNameParts =
[
"nonce",
"secret",
"password",
"token",
"credential",
"apikey",
"api_key",
];
public static Dictionary<string, object?> RedactFields(IReadOnlyDictionary<string, object?> fields)
{
Dictionary<string, object?> redactedFields = [];
foreach (KeyValuePair<string, object?> field in fields)
{
redactedFields[field.Key] = RedactValue(field.Key, field.Value);
}
return redactedFields;
}
public static object? RedactValue(string fieldName, object? value)
{
if (value is null)
{
return null;
}
foreach (string sensitiveFieldNamePart in SensitiveFieldNameParts)
{
if (fieldName.IndexOf(sensitiveFieldNamePart, StringComparison.OrdinalIgnoreCase) >= 0)
{
return RedactedValue;
}
}
return value;
}
}