fix(audit): M5.3 review I-1 — use the request-start options snapshot for header redaction (no mid-request reload split)
This commit is contained in:
@@ -234,6 +234,7 @@ public sealed class AuditWriteMiddleware
|
|||||||
|
|
||||||
EmitInboundAudit(
|
EmitInboundAudit(
|
||||||
ctx,
|
ctx,
|
||||||
|
opts,
|
||||||
sw.ElapsedMilliseconds,
|
sw.ElapsedMilliseconds,
|
||||||
thrown,
|
thrown,
|
||||||
requestBody,
|
requestBody,
|
||||||
@@ -251,6 +252,7 @@ public sealed class AuditWriteMiddleware
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private void EmitInboundAudit(
|
private void EmitInboundAudit(
|
||||||
HttpContext ctx,
|
HttpContext ctx,
|
||||||
|
AuditLogOptions opts,
|
||||||
long durationMs,
|
long durationMs,
|
||||||
Exception? thrown,
|
Exception? thrown,
|
||||||
string? requestBody,
|
string? requestBody,
|
||||||
@@ -289,10 +291,13 @@ public sealed class AuditWriteMiddleware
|
|||||||
// collection is run through the SAME header-redaction list
|
// collection is run through the SAME header-redaction list
|
||||||
// (AuditLogOptions.HeaderRedactList) that the ScadaBridgeAuditRedactor
|
// (AuditLogOptions.HeaderRedactList) that the ScadaBridgeAuditRedactor
|
||||||
// applies to RequestSummary / ResponseSummary — auth/sensitive
|
// applies to RequestSummary / ResponseSummary — auth/sensitive
|
||||||
// headers are redacted before they land in the row.
|
// headers are redacted before they land in the row. Uses the SAME
|
||||||
var currentOpts = _options.CurrentValue;
|
// options snapshot captured at request start (passed in as opts) as
|
||||||
|
// the SkipBodyCapture / PerTargetOverrides decisions, so a mid-request
|
||||||
|
// live-reload can't split the body-capture and header-redaction
|
||||||
|
// verdicts across two different snapshots.
|
||||||
var redactSet = new HashSet<string>(
|
var redactSet = new HashSet<string>(
|
||||||
currentOpts.HeaderRedactList,
|
opts.HeaderRedactList,
|
||||||
StringComparer.OrdinalIgnoreCase);
|
StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
var headerDict = new Dictionary<string, string>(StringComparer.Ordinal);
|
var headerDict = new Dictionary<string, string>(StringComparer.Ordinal);
|
||||||
|
|||||||
Reference in New Issue
Block a user