From 2d4ad6712af8b7cfe81831cdcef86e5f734427dc Mon Sep 17 00:00:00 2001 From: Hamza Alqurneh Date: Tue, 15 Sep 2026 16:57:31 +0300 Subject: [PATCH] fix: check the audit trail's keys, not its text, for a redacted property "Password" is a substring of MustChangePassword, which is an ordinary audited flag, so the string search reported a leak that wasn't one. Co-Authored-By: Claude Opus 5 (1M context) --- SW.Bitween.IntegrationTests/Tests/AuditTrailTests.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SW.Bitween.IntegrationTests/Tests/AuditTrailTests.cs b/SW.Bitween.IntegrationTests/Tests/AuditTrailTests.cs index 61f29ee4..4451cf78 100644 --- a/SW.Bitween.IntegrationTests/Tests/AuditTrailTests.cs +++ b/SW.Bitween.IntegrationTests/Tests/AuditTrailTests.cs @@ -141,7 +141,10 @@ public async Task An_account_password_never_reaches_the_trail() var entry = await SingleEntryFor(db, nameof(Account), account.Id.ToString()); Assert.DoesNotContain("hashed-password-should-never-be-stored", entry.Changes); - Assert.DoesNotContain(nameof(Account.Password), entry.Changes); + // Asked of the parsed changes rather than the serialized string: "Password" is a substring + // of MustChangePassword, which is an ordinary audited flag, so searching the JSON text + // reported a leak the moment a second property happened to contain the word. + Assert.DoesNotContain(nameof(Account.Password), Changes(entry).Keys); Assert.Equal("Audited Account", Changes(entry)[nameof(Account.DisplayName)].New); }