mirror of
https://github.com/Sea-Haven-Industries/proposal-system.git
synced 2026-10-07 15:08:58 +00:00
Potential fix for pull request finding 'CodeQL / Exposure of private information'
Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
This commit is contained in:
parent
6655e57536
commit
216fcb2397
1 changed files with 18 additions and 1 deletions
|
|
@ -18,9 +18,26 @@ public class DevEmailService : IEmailService
|
||||||
string pdfUrl,
|
string pdfUrl,
|
||||||
CancellationToken ct = default)
|
CancellationToken ct = default)
|
||||||
{
|
{
|
||||||
|
var maskedRecipient = MaskEmail(toEmail);
|
||||||
_logger.LogInformation(
|
_logger.LogInformation(
|
||||||
"Dev mode - skipping email delivery: proposal {ProposalNumber} to {Recipient}, PDF link: {PdfUrl}",
|
"Dev mode - skipping email delivery: proposal {ProposalNumber} to {Recipient}, PDF link: {PdfUrl}",
|
||||||
proposalNumber, toEmail, pdfUrl);
|
proposalNumber, maskedRecipient, pdfUrl);
|
||||||
return Task.CompletedTask;
|
return Task.CompletedTask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static string MaskEmail(string email)
|
||||||
|
{
|
||||||
|
if (string.IsNullOrWhiteSpace(email))
|
||||||
|
{
|
||||||
|
return "[redacted]";
|
||||||
|
}
|
||||||
|
|
||||||
|
var atIndex = email.IndexOf('@');
|
||||||
|
if (atIndex <= 1)
|
||||||
|
{
|
||||||
|
return "[redacted]";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $"{email[0]}***{email.Substring(atIndex)}";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue