Skip to content

Add support for password-protected PDF invoice attachments#90

Merged
jldsilva merged 3 commits into
developmentfrom
Refactor_ScanEmailDefinition
May 6, 2026
Merged

Add support for password-protected PDF invoice attachments#90
jldsilva merged 3 commits into
developmentfrom
Refactor_ScanEmailDefinition

Conversation

@jldsilva
Copy link
Copy Markdown
Owner

@jldsilva jldsilva commented May 4, 2026

Introduces X.509 certificate-based encryption and decryption for FilePassword in ScanEmailDefinition. This allows the secure storage of passwords for PDF attachments, enabling the system to process password-protected invoice files during email scanning. The CertificateThumbprint is now configurable in application settings.

Summary by CodeRabbit

Notas de Lançamento

  • Novas Funcionalidades

    • Leitura de PDFs protegidos por senha em processamento de anexos.
    • Armazenamento e uso de senhas de arquivo criptografadas para definições de varredura de e-mail.
    • Melhorias na extração de emails e filtragem de anexos para detectar remetentes corretamente.
  • Testes

    • Cobertura ampliada para criptografia/descriptografia X509 e fluxos relacionados.
  • Chores

    • Atualizações do contêiner: suporte a locale (pt_BR) e inclusão de certificado na imagem.
    • Ajuste na configuração de túnel (ngrok) para uso de URL.

Introduces X.509 certificate-based encryption and decryption for `FilePassword` in `ScanEmailDefinition`. This allows the secure storage of passwords for PDF attachments, enabling the system to process password-protected invoice files during email scanning. The `CertificateThumbprint` is now configurable in application settings.
@jldsilva jldsilva self-assigned this May 4, 2026
@jldsilva jldsilva added the enhancement New feature or request label May 4, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 4, 2026

Warning

Rate limit exceeded

@jldsilva has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 42 minutes and 48 seconds before requesting another review.

To continue reviewing without waiting, purchase usage credits in the billing tab.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b3724afd-fc1a-4a94-9726-a605e0b5e887

📥 Commits

Reviewing files that changed from the base of the PR and between 4a1c7fc and d295dd6.

📒 Files selected for processing (15)
  • Directory.Packages.props
  • InvoiceReminder.API/Dockerfile
  • InvoiceReminder.API/appsettings.json
  • InvoiceReminder.Application/AppServices/ScanEmailDefinitionAppService.cs
  • InvoiceReminder.Authentication/Extensions/StringHashExtension.cs
  • InvoiceReminder.Data/Migrations/20260109013522_Initial_Create.cs
  • InvoiceReminder.Data/Migrations/CoreDbContextModelSnapshot.cs
  • InvoiceReminder.Data/Persistence/EntitiesConfig/ScanEmailDefinitionConfig.cs
  • InvoiceReminder.ExternalServices/BarcodeReader/BankInvoiceBarcodeHandler.cs
  • InvoiceReminder.ExternalServices/Gmail/GmailServiceWrapper.cs
  • InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
  • InvoiceReminder.UnitTests.Application/AppServices/ScanEmailDefinitionAppServiceTests.cs
  • InvoiceReminder.UnitTests.ExternalServices/SendMessage/SendMessageServiceTests.cs
  • InvoiceReminder.UnitTests.Infrastructure/Authentication/StringHashExtensionTests.cs
  • docker-compose.yml

Walkthrough

Adiciona suporte a senhas de arquivo para PDFs: propriedades de certificado em appsettings, armazenamento de senha de anexo (FilePassword) criptografada usando certificado em arquivo (X509) e descriptografia no processamento de anexos antes de chamar o leitor de PDF; ajusta leitura de PDFs para aceitar senha e atualiza testes e dependências.

Changes

Suporte a PDF Protegido por Senha e Criptografia X509 (arquivo)

Layer / File(s) Summary
Configuração
InvoiceReminder.API/appsettings.json
Adiciona Security:CertificateFileName, Security:CertificateFilePath, Security:CertificatePassword.
Dependência de Projeto
InvoiceReminder.ExternalServices/InvoiceReminder.ExternalServices.csproj
Adiciona ProjectReference para InvoiceReminder.Authentication.
Forma de Dados / Modelo
InvoiceReminder.Domain/Entities/ScanEmailDefinition.cs, InvoiceReminder.Application/ViewModels/ScanEmailDefinitionViewModel.cs
Adiciona propriedade FilePassword (ViewModel com JsonIgnore ao serializar).
Banco de Dados / Migrations
InvoiceReminder.Data/Migrations/20260109013522_Initial_Create.cs, InvoiceReminder.Data/Migrations/CoreDbContextModelSnapshot.cs, InvoiceReminder.Data/Persistence/EntitiesConfig/ScanEmailDefinitionConfig.cs
Adiciona coluna file_password (nullable, max length 1024) e mapeamento EF Core para ScanEmailDefinition.FilePassword.
Criptografia / Utilitários
InvoiceReminder.Authentication/Extensions/StringHashExtension.cs
Implementa X509_Encrypt e X509_Decrypt carregando certificado de arquivo (path + senha opcional) e usando RSA OAEP SHA256 com Base64.
Camada de Aplicação
InvoiceReminder.Application/AppServices/ScanEmailDefinitionAppService.cs
Recebe IConfigurationService, inicializa caminho/senha de certificado e sobrescreve AddAsync/UpdateAsync para criptografar viewModel.FilePassword via X509_Encrypt antes de persistir.
Processamento de Anexos / Leitura de PDF
InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs, InvoiceReminder.ExternalServices/BarcodeReader/IBarcodeReaderService.cs, InvoiceReminder.ExternalServices/BarcodeReader/BarcodeReaderService.cs, InvoiceReminder.ExternalServices/BarcodeReader/BankInvoiceBarcodeHandler.cs
SendMessageService injeta IConfigurationService, resolve/ descriptografa definitions.FilePassword via X509_Decrypt e passa senha para ReadTextContentFromPdf. Interface e implementação do leitor de PDF adicionam parâmetro password e usam ReaderProperties.SetPassword ao instanciar PdfReader. BankInvoiceBarcodeHandler.FilterContent refatorado para retornar (bankId, barcode) com dois regex independentes.
Gmail / Coleta de Anexos
InvoiceReminder.ExternalServices/Gmail/GmailServiceWrapper.cs
Ajusta extração de endereço remetente com regex, filtra mensagens do mês atual e passa anexos indexados por endereço de e-mail sanitizado (emailAddress).
Docker / Imagem
InvoiceReminder.API/Dockerfile, docker-compose.yml
Dockerfile: instala locales, gera pt_BR.UTF-8, copia certificado para /app/certs/certificate.pfx e define variáveis de ambiente de locale. docker-compose: substitui flag --domain por --url no ngrok.
Dependências
Directory.Packages.props
Atualiza Google.Apis.Gmail.v1 e Scalar.AspNetCore para novas versões.
Testes
InvoiceReminder.UnitTests.Application/..., InvoiceReminder.UnitTests.ExternalServices/..., InvoiceReminder.UnitTests.Infrastructure/Authentication/StringHashExtensionTests.cs
Atualiza testes para fornecer IConfigurationService, usa nova assinatura ReadTextContentFromPdf(..., password, ...), adiciona testes para X509_Encrypt/X509_Decrypt, e cobre cenários de senha vazia/nula e falha de descriptografia.

Sequence Diagram

sequenceDiagram
    participant User as Usuário
    participant AppSvc as ScanEmailDefinitionAppService
    participant DB as Banco de Dados
    participant SendMsg as SendMessageService
    participant AuthExt as StringHashExtension (cert file)
    participant Barcode as BarcodeReaderService
    participant PDF as PdfReader

    User->>AppSvc: Add/Update ScanEmailDefinition (FilePassword)
    AppSvc->>AuthExt: X509_Encrypt(FilePassword, certFilePath, certPassword)
    AuthExt-->>AppSvc: FilePassword_criptografada
    AppSvc->>DB: Persiste ScanEmailDefinition com FilePassword_criptografada

    Note over User,PDF: Processamento de e-mails / anexos

    SendMsg->>DB: Recupera ScanEmailDefinition
    DB-->>SendMsg: ScanEmailDefinition (FilePassword_criptografada)
    SendMsg->>AuthExt: X509_Decrypt(FilePassword_criptografada, certFilePath, certPassword)
    AuthExt-->>SendMsg: FilePassword_descriptografada
    SendMsg->>Barcode: ReadTextContentFromPdf(pdfBytes, beneficiary, FilePassword_descriptografada, invoiceType)
    Barcode->>PDF: Abrir PDF com senha e extrair texto
    PDF-->>Barcode: Conteúdo do PDF
    Barcode-->>SendMsg: Invoice extraído
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested labels

dependencies, .NET

Poem

🐰
Na toca do código eu pulo e cifro,
Um arquivo seguro, um segredo em siro.
Com X509 e cenoura eu guardo a senha,
O PDF se abre só quando a lua lhe envenha.
Hop! Um invoice salvo — que festa na cena!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 2.70% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed O título descreve com clareza a mudança principal: adicionar suporte para PDFs com proteção por senha, que é exatamente o objetivo central do PR.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch Refactor_ScanEmailDefinition

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 8

🧹 Nitpick comments (2)
InvoiceReminder.UnitTests.Application/AppServices/ScanEmailDefinitionAppServiceTests.cs (1)

33-45: 🏗️ Heavy lift

Falta cobertura de teste para o caminho de criptografia de FilePassword em AddAsync/UpdateAsync.

O Faker<ScanEmailDefinition> não inclui regra para FilePassword, e nenhum teste verifica o comportamento de AddAsync/UpdateAsync quando FilePassword é não-nulo. Toda a lógica nova desta PR — criptografar a senha com X509_Encrypt antes de persistir e descriptografar com X509_Decrypt no processamento — fica sem cobertura de teste unitário.

Ao menos um teste deveria:

  1. Configurar FilePassword com valor não-nulo no ViewModel.
  2. Mockar _configuration.GetValue(...) para retornar um thumbprint fictício.
  3. Verificar que o serviço tenta criptografar (e.g., via spy/mock no StringHashExtension, ou usando um certificado de teste) antes de chamar o repositório.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@InvoiceReminder.UnitTests.Application/AppServices/ScanEmailDefinitionAppServiceTests.cs`
around lines 33 - 45, Add a Faker rule for FilePassword in
CreateScanEmailDefinitionFaker and add unit tests that exercise the FilePassword
encryption/decryption path for AddAsync and UpdateAsync: update
CreateScanEmailDefinitionFaker to include .RuleFor(s => s.FilePassword, f =>
f.Internet.Password()) so generated entities may have non-null passwords; write
tests that set FilePassword on the ViewModel, mock _configuration.GetValue(...)
to return a fake thumbprint, and spy/mock StringHashExtension.X509_Encrypt (or
provide a test certificate) to assert the service calls X509_Encrypt before the
repository save and that X509_Decrypt is used when processing results; verify
the repository receives the encrypted password and that the final
returned/processed object is decrypted as expected.
InvoiceReminder.UnitTests.ExternalServices/SendMessage/SendMessageServiceTests.cs (1)

85-94: ⚡ Quick win

Caminho de descriptografia da senha não está coberto nos testes

O _scanEmailDefinitionFaker não configura FilePassword, portanto o branch definitions.FilePassword.X509_Decrypt(_thumbPrint) nunca é exercido. A cobertura atual valida apenas o fluxo sem senha.

Considere adicionar ao menos um cenário que configure FilePassword e verifique que _barcodeReader.ReadTextContentFromPdf é chamado com um string password não-nulo (usando Arg.Is<string>(p => p != null)), após fazer o mock de _configuration.GetAppSetting(...) para retornar um thumbprint válido para o ambiente de testes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@InvoiceReminder.UnitTests.ExternalServices/SendMessage/SendMessageServiceTests.cs`
around lines 85 - 94, The test faker _scanEmailDefinitionFaker never sets
FilePassword so the X509 decryption branch
(definitions.FilePassword.X509_Decrypt(_thumbPrint)) is never executed; add a
new unit test that uses the faker to create a ScanEmailDefinition with
FilePassword populated, mock _configuration.GetAppSetting(...) to return a valid
test thumbprint, arrange the mock for definitions.FilePassword.X509_Decrypt to
return a non-null password, invoke the SendMessage flow, and assert that
_barcodeReader.ReadTextContentFromPdf was called with a non-null password (use
Arg.Is<string>(p => p != null)) to validate the decrypt path is exercised.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@InvoiceReminder.Authentication/Extensions/StringHashExtension.cs`:
- Around line 58-73: X509_Encrypt currently does not validate inputString and
can throw a NullReferenceException; add the same explicit check used in
HashPassword/VerifyPassword by calling
ArgumentException.ThrowIfNullOrWhiteSpace(inputString) at the start of
X509_Encrypt to provide a clear, informative exception for null/empty/whitespace
input before any Encoding.UTF8.GetBytes or RSA operations occur.
- Around line 58-73: O método X509_Encrypt está usando GetRSAPrivateKey() e deve
usar GetRSAPublicKey() para fazer a criptografia; altere a chamada em
X509_Encrypt para obter a chave pública via certs[0].GetRSAPublicKey(), use-a
para rsa.Encrypt(...), e remova/atualize a InvalidDataException(INVALID_RSA_KEY)
para uma mensagem/exception que reflita ausência da chave pública (ou lance
FileNotFoundException/CERT_NOT_FOUND conforme apropriado) para evitar exigir a
chave privada e corrigir a mensagem de erro enganosa.

In `@InvoiceReminder.Data/Migrations/20260109013522_Initial_Create.cs`:
- Line 194: A entrada de migration para a coluna file_password está com
maxLength: 255 que diverge do tipo explicitado ("character varying(512)") e do
snapshot (HasMaxLength(512)); atualize o metadado na migration substituindo
maxLength: 255 por maxLength: 512 para a coluna file_password (procure a
referência a file_password no método Up/CreateTable) de modo que maxLength, type
e snapshot fiquem consistentes.

In
`@InvoiceReminder.Data/Persistence/EntitiesConfig/ScanEmailDefinitionConfig.cs`:
- Around line 54-56: A configuração atual em ScanEmailDefinitionConfig usa
builder.Property(x => x.FilePassword).HasMaxLength(512), que pode ser
insuficiente para chaves RSA ≥4096 bits; update a configuração de coluna para
suportar valores maiores (por exemplo usar HasMaxLength(2048) ou remover o
limite e mapear para um tipo de coluna de texto/longvarchar via
HasColumnType("text")/HasColumnType("nvarchar(max)") conforme o provedor)
garantindo que FilePassword aceite a saída Base64 completa sem truncamento.

In `@InvoiceReminder.Domain/Entities/ScanEmailDefinition.cs`:
- Line 13: Change the ScanEmailDefinition.FilePassword property to a nullable
reference (string?) to match the database migration and snapshot (file_password
nullable) and to avoid CS8618 when nullable reference types are enabled; update
any constructors, property initializations, or validation logic that assume
FilePassword is non-null (e.g., methods referencing FilePassword in
ScanEmailDefinition) to handle null values appropriately. Ensure the property
signature in ScanEmailDefinition is the only place requiring the ? and that any
mapping/profile or tests expecting a non-null value are adjusted to accept null.

In `@InvoiceReminder.ExternalServices/BarcodeReader/BankInvoiceBarcodeHandler.cs`:
- Around line 41-49: O método FilterContent faz dois matches independentes e
pode casar o bankId de uma linha com o barcode de outra; modifique FilterContent
para localizar primeiro a mesma linha/trecho que contenha ambos (por exemplo
usando um regex composto que inclua tanto bankIdPattern quanto barcodePattern,
ou buscando a linha que casa barcodePattern e então aplicando bankIdPattern
nessa mesma linha) e retornar os dois valores extraídos dessa mesma
correspondência; se algum dos dois não for encontrado lance aqui uma exceção com
mensagem explícita (por exemplo mencionando FilterContent, bankIdPattern e
barcodePattern) em vez de devolver string.Empty para que CreateInvoice não
receba erros tardios.
- Around line 29-37: O acesso direto knowBanks[int.Parse(bankId[..3])] pode
lançar KeyNotFoundException quando o banco não está mapeado; em Invoice creation
use uma tentativa segura: extrair o código do banco (bankId[..3]), tentar obter
o nome via knowBanks.TryGetValue(parsedKey, out var name) ou verificar
ContainsKey, e se não existir montar o fallback usando apenas o código (por
exemplo "Código X" ou o próprio bankId[..3]) ao setar a propriedade Bank
(localize a expressão em FilterContent/Bank assignment).

In `@InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs`:
- Around line 60-68: In SendMessageService (inside the attachment-processing
loop) you must null-check the result of
user.ScanEmailDefinitions?.FirstOrDefault(...) (the local variable definitions)
before accessing definitions.FilePassword or definitions.InvoiceType; if
definitions is null, either log a clear warning and continue to the next
attachment or throw a specific exception that names the missing
ScanEmailDefinition, but do not call
definitions.FilePassword.X509_Decrypt(_thumbPrint) or
_barcodeService.ReadTextContentFromPdf(...) with a null definitions object;
adjust control flow so one missing definition does not produce a misleading
InvalidOperationException for the whole send operation.

---

Nitpick comments:
In
`@InvoiceReminder.UnitTests.Application/AppServices/ScanEmailDefinitionAppServiceTests.cs`:
- Around line 33-45: Add a Faker rule for FilePassword in
CreateScanEmailDefinitionFaker and add unit tests that exercise the FilePassword
encryption/decryption path for AddAsync and UpdateAsync: update
CreateScanEmailDefinitionFaker to include .RuleFor(s => s.FilePassword, f =>
f.Internet.Password()) so generated entities may have non-null passwords; write
tests that set FilePassword on the ViewModel, mock _configuration.GetValue(...)
to return a fake thumbprint, and spy/mock StringHashExtension.X509_Encrypt (or
provide a test certificate) to assert the service calls X509_Encrypt before the
repository save and that X509_Decrypt is used when processing results; verify
the repository receives the encrypted password and that the final
returned/processed object is decrypted as expected.

In
`@InvoiceReminder.UnitTests.ExternalServices/SendMessage/SendMessageServiceTests.cs`:
- Around line 85-94: The test faker _scanEmailDefinitionFaker never sets
FilePassword so the X509 decryption branch
(definitions.FilePassword.X509_Decrypt(_thumbPrint)) is never executed; add a
new unit test that uses the faker to create a ScanEmailDefinition with
FilePassword populated, mock _configuration.GetAppSetting(...) to return a valid
test thumbprint, arrange the mock for definitions.FilePassword.X509_Decrypt to
return a non-null password, invoke the SendMessage flow, and assert that
_barcodeReader.ReadTextContentFromPdf was called with a non-null password (use
Arg.Is<string>(p => p != null)) to validate the decrypt path is exercised.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 0b1a5321-1959-4ffb-9a4d-f7015c7075f1

📥 Commits

Reviewing files that changed from the base of the PR and between 498a153 and 4a1c7fc.

📒 Files selected for processing (17)
  • InvoiceReminder.API/appsettings.json
  • InvoiceReminder.Application/AppServices/ScanEmailDefinitionAppService.cs
  • InvoiceReminder.Application/ViewModels/ScanEmailDefinitionViewModel.cs
  • InvoiceReminder.Authentication/Extensions/StringHashExtension.cs
  • InvoiceReminder.Data/Migrations/20260109013522_Initial_Create.cs
  • InvoiceReminder.Data/Migrations/CoreDbContextModelSnapshot.cs
  • InvoiceReminder.Data/Persistence/EntitiesConfig/ScanEmailDefinitionConfig.cs
  • InvoiceReminder.Domain/Entities/ScanEmailDefinition.cs
  • InvoiceReminder.ExternalServices/BarcodeReader/BankInvoiceBarcodeHandler.cs
  • InvoiceReminder.ExternalServices/BarcodeReader/BarcodeReaderService.cs
  • InvoiceReminder.ExternalServices/BarcodeReader/IBarcodeReaderService.cs
  • InvoiceReminder.ExternalServices/InvoiceReminder.ExternalServices.csproj
  • InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
  • InvoiceReminder.UnitTests.Application/AppServices/ScanEmailDefinitionAppServiceTests.cs
  • InvoiceReminder.UnitTests.ExternalServices/BarcodeReader/BarcodeReaderServiceTests.cs
  • InvoiceReminder.UnitTests.ExternalServices/SendMessage/SendMessageServiceTests.cs
  • InvoiceReminder.UnitTests.Infrastructure/Authentication/StringHashExtensionTests.cs

Comment thread InvoiceReminder.Authentication/Extensions/StringHashExtension.cs Outdated
Comment thread InvoiceReminder.Data/Migrations/20260109013522_Initial_Create.cs Outdated
Comment thread InvoiceReminder.Data/Persistence/EntitiesConfig/ScanEmailDefinitionConfig.cs Outdated
Comment thread InvoiceReminder.Domain/Entities/ScanEmailDefinition.cs
Comment thread InvoiceReminder.ExternalServices/BarcodeReader/BankInvoiceBarcodeHandler.cs Outdated
Comment thread InvoiceReminder.ExternalServices/SendMessage/SendMessageService.cs
jldsilva added 2 commits May 4, 2026 20:21
This improves flexibility and simplifies deployment by allowing the application to use certificates installed in the current user's store, reducing the need for administrator privileges often associated with LocalMachine store access.
This change fundamentally shifts X.509 certificate operations from relying on system certificate stores and thumbprints to using PFX files with passwords.

This improves:
*   **Deployment:** Simplifies certificate provisioning and management, particularly in containerized and cross-platform environments.
*   **Security:** Fixes a critical bug where X.509 encryption incorrectly used the private key instead of the public key, and adds robustness with file existence checks and cryptographic exception handling.

Additionally, this commit includes:
*   **Email Processing:** Refines Gmail attachment retrieval to filter emails by the current month and more accurately extract sender email addresses.
*   **Barcode Reading:** Enhances barcode and invoice data extraction with improved parsing logic, locale awareness, and error handling.
*   Increases the maximum length for encrypted file passwords in the database.
*   Updates minor NuGet package dependencies.
*   Adds Brazilian Portuguese locale to the Docker image.
@jldsilva
Copy link
Copy Markdown
Owner Author

jldsilva commented May 6, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 6, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jldsilva jldsilva merged commit 86dea51 into development May 6, 2026
5 checks passed
@jldsilva jldsilva deleted the Refactor_ScanEmailDefinition branch May 13, 2026 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant