Skip to content

fix: pfx provider testability#6770

Merged
vitormattos merged 3 commits intomainfrom
fix/pfx-provider-testability
Feb 8, 2026
Merged

fix: pfx provider testability#6770
vitormattos merged 3 commits intomainfrom
fix/pfx-provider-testability

Conversation

@vitormattos
Copy link
Member

No description provided.

Set the effective password on the engine before calling getPfxOfCurrentSigner() to ensure proper password handling. This fix addresses a critical bug where the password was not being properly configured when retrieving the PFX content.

- Add setPassword() call before getPfxOfCurrentSigner()
- Extract and pass UID to getPfxOfCurrentSigner for proper file handling
- Strip 'account:' prefix from userUniqueIdentifier as expected by the handler

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Create a minimal test double (fake) of SignEngineHandler that:
- Requires no infrastructure dependencies (filesystem, DI container, logging)
- Tracks all method calls for assertion and verification
- Enables testing PfxProvider business rules in isolation
- Provides clean setup for certificate provisioning logic tests

This test double is designed to be simple and maintainable, avoiding the complexity of mocking frameworks while still capturing essential behavior.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
Add comprehensive test suite for PfxProvider focusing on business rules rather than coverage:

Business Rules Tested:
- Reuse existing certificates without regeneration
- Generate short-lived (1-day) certificates for click-to-sign
- Handle password-based signing without certificate generation
- Properly strip/preserve user ID prefixes
- Return null for empty passwords in result
- Use event-generated passwords, fallback to ISecureRandom
- Properly set and cleanup leaf expiry overrides
- Pass correct user data to certificate generation
- Set password on engine before retrieving PFX content

These tests validate core certificate provisioning logic without excessive mocks or focusing on code coverage metrics.

Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
@vitormattos vitormattos added this to the Next Major (34) milestone Feb 8, 2026
@vitormattos vitormattos self-assigned this Feb 8, 2026
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Feb 8, 2026
@vitormattos
Copy link
Member Author

/backport to stable33

@vitormattos
Copy link
Member Author

/backport to stable32

@vitormattos vitormattos merged commit 45bfb8f into main Feb 8, 2026
70 checks passed
@vitormattos vitormattos deleted the fix/pfx-provider-testability branch February 8, 2026 16:02
@github-project-automation github-project-automation bot moved this from 0. Needs triage to 4. to release in Roadmap Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant

Comments