From 4a9fd5badab79d149419a449f2f31fd08153b698 Mon Sep 17 00:00:00 2001 From: David Gershony <14833917+DavidGershony@users.noreply.github.com> Date: Fri, 3 Jul 2026 11:22:44 +0100 Subject: [PATCH] C1: Demote sensitive data logs from Information to Debug Prevent sensitive data (private keys, public keys, transaction hex, WitScript content, recovery keys) from appearing in production logs. All LogInformation calls that included cryptographic material or transaction data are demoted to LogDebug with structured message templates that exclude sensitive values. Files: FounderTransactionActions, InvestorTransactionActions, SeederTransactionActions, DerivationOperations --- src/shared/Angor.Shared/DerivationOperations.cs | 6 +++--- .../Angor.Shared/Protocol/FounderTransactionActions.cs | 8 ++++---- .../Angor.Shared/Protocol/InvestorTransactionActions.cs | 4 ++-- .../Angor.Shared/Protocol/SeederTransactionActions.cs | 2 +- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/shared/Angor.Shared/DerivationOperations.cs b/src/shared/Angor.Shared/DerivationOperations.cs index c03fcb572..873ed558f 100644 --- a/src/shared/Angor.Shared/DerivationOperations.cs +++ b/src/shared/Angor.Shared/DerivationOperations.cs @@ -222,7 +222,7 @@ public uint DeriveUniqueProjectIdentifier(string founderKey) var upi = (uint)(hashOfid.GetLow64() & int.MaxValue); - _logger.LogInformation($"Unique Project Identifier - founderKey = {founderKey}, hashOfFounderKey = {hashOfid}, hashOfFounderKeyCastToInt = {upi}"); + _logger.LogDebug("UPI derived: {Upi} for founderKey={FounderKey}", upi, founderKey); if (upi >= 2_147_483_648) throw new Exception(); @@ -307,7 +307,7 @@ public string DeriveAngorKey(string angorRootKey, string founderKey) var address = encoder.Encode(0, angorKey.WitHash.ToBytes()); - _logger.LogInformation($"DeriveAngorKey - angorRootKey = {angorRootKey}, founderKey = {founderKey}, upi = {upi}, angorKey = {angorKey}, angorKeyWitHash = {angorKey.WitHash}, address = {address}"); + _logger.LogDebug("DeriveAngorKey - founderKey={FounderKey}, upi={Upi}, address={Address}", founderKey, upi, address); return address; } @@ -335,7 +335,7 @@ public string ConvertAngorKeyToBitcoinAddress(string projectId) var networkEncoder = network.Bech32Encoders[(int)Bech32Type.WITNESS_PUBKEY_ADDRESS]; var bitcoinAddress = networkEncoder.Encode(witnessVersion, data); - _logger.LogInformation($"ConvertAngorKeyToBitcoinAddress - projectId = {projectId}, witnessVersion = {witnessVersion}, bitcoinAddress = {bitcoinAddress}"); + _logger.LogDebug("ConvertAngorKeyToBitcoinAddress - projectId={ProjectId}, address={Address}", projectId, bitcoinAddress); return bitcoinAddress; } diff --git a/src/shared/Angor.Shared/Protocol/FounderTransactionActions.cs b/src/shared/Angor.Shared/Protocol/FounderTransactionActions.cs index 0f37c6226..42c100a4a 100644 --- a/src/shared/Angor.Shared/Protocol/FounderTransactionActions.cs +++ b/src/shared/Angor.Shared/Protocol/FounderTransactionActions.cs @@ -70,7 +70,7 @@ public SignatureInfo SignInvestorRecoveryTransactions(ProjectInfo projectInfo, s var hashHex = Encoders.Hex.EncodeData(hash.ToBytes()); - _logger.LogInformation($"creating sig for project={projectInfo.ProjectIdentifier}; founder-recovery-pubkey={key.PubKey.ToHex()}; stage={stageIndex}"); + _logger.LogDebug("Creating recovery signature for project={ProjectId}, stage={Stage}", projectInfo.ProjectIdentifier, stageIndex); var result = new TaprootPubKey( Angor.Shared.Protocol.Scripts.TaprootKeyHelper.GetTaprootOutputKeyBytes(key.PubKey)) @@ -156,7 +156,7 @@ public TransactionInfo SpendFounderStage(ProjectInfo projectInfo, IEnumerable _.TxOut).ToArray()); @@ -183,12 +183,12 @@ public TransactionInfo SpendFounderStage(ProjectInfo projectInfo, IEnumerable