Two handlers log the actual phone verification code (a short-lived 6-digit OTP) into the structured log stream (Seq) at Information level:
VerifyPhoneNumberCommandHandler.cs:17 — LogInformation("Verifying phone number for user {UserId} with code {Code}", request.UserId, request.VerificationCode)
Twilio/Commands/ProcessTwilioWebhook/ProcessTwilioWebhookCommandHandler.cs:305 — LogInformation("Processing phone verification for {PhoneNumber} with code {Code}", phoneNumber, verificationCode)
Anyone with log/Seq access (or anyone downstream of log shipping/retention/backup) can read active OTP codes and, within the code's validity window, complete a phone verification they should not control. OTP/credentials do not belong in application logs (OWASP logging guidance).
Fix (this PR)
Drop the {Code} argument from both log messages — keep the user/phone context for correlation, remove the credential. No logic/behaviour change. (The pre-registration email handler already logs only validity/attempts, not the code — good; these two were the exceptions.)
## Finding (sensitive data in logs)
Two handlers log the actual phone verification code (a short-lived 6-digit OTP) into the structured log stream (Seq) at Information level:
- `VerifyPhoneNumberCommandHandler.cs:17` — `LogInformation("Verifying phone number for user {UserId} with code {Code}", request.UserId, request.VerificationCode)`
- `Twilio/Commands/ProcessTwilioWebhook/ProcessTwilioWebhookCommandHandler.cs:305` — `LogInformation("Processing phone verification for {PhoneNumber} with code {Code}", phoneNumber, verificationCode)`
Anyone with log/Seq access (or anyone downstream of log shipping/retention/backup) can read active OTP codes and, within the code's validity window, complete a phone verification they should not control. OTP/credentials do not belong in application logs (OWASP logging guidance).
## Fix (this PR)
Drop the `{Code}` argument from both log messages — keep the user/phone context for correlation, remove the credential. No logic/behaviour change. (The pre-registration email handler already logs only validity/attempts, not the code — good; these two were the exceptions.)
Resolved in spikersoft-backend PR #388 (merged to master). Removed the 6-digit OTP from both handlers' logs, including the webhook entry-point log (redacted via Is6DigitCode when an inbound SMS body is a code). Active verification codes no longer reach Seq. Closing.
Resolved in spikersoft-backend PR #388 (merged to `master`). Removed the 6-digit OTP from both handlers' logs, including the webhook entry-point log (redacted via Is6DigitCode when an inbound SMS body is a code). Active verification codes no longer reach Seq. Closing.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Finding (sensitive data in logs)
Two handlers log the actual phone verification code (a short-lived 6-digit OTP) into the structured log stream (Seq) at Information level:
VerifyPhoneNumberCommandHandler.cs:17—LogInformation("Verifying phone number for user {UserId} with code {Code}", request.UserId, request.VerificationCode)Twilio/Commands/ProcessTwilioWebhook/ProcessTwilioWebhookCommandHandler.cs:305—LogInformation("Processing phone verification for {PhoneNumber} with code {Code}", phoneNumber, verificationCode)Anyone with log/Seq access (or anyone downstream of log shipping/retention/backup) can read active OTP codes and, within the code's validity window, complete a phone verification they should not control. OTP/credentials do not belong in application logs (OWASP logging guidance).
Fix (this PR)
Drop the
{Code}argument from both log messages — keep the user/phone context for correlation, remove the credential. No logic/behaviour change. (The pre-registration email handler already logs only validity/attempts, not the code — good; these two were the exceptions.)Resolved in spikersoft-backend PR #388 (merged to
master). Removed the 6-digit OTP from both handlers' logs, including the webhook entry-point log (redacted via Is6DigitCode when an inbound SMS body is a code). Active verification codes no longer reach Seq. Closing.