Skip to content

[stable33] fix: pfx provider testability#6773

Merged
vitormattos merged 3 commits intostable33from
backport/6770/stable33
Feb 8, 2026
Merged

[stable33] fix: pfx provider testability#6773
vitormattos merged 3 commits intostable33from
backport/6770/stable33

Conversation

@backportbot-libresign
Copy link

Backport of PR #6770

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>
@github-project-automation github-project-automation bot moved this to 0. Needs triage in Roadmap Feb 8, 2026
@backportbot-libresign backportbot-libresign bot added this to the Next RC (33) milestone Feb 8, 2026
@vitormattos vitormattos merged commit 6e27f2b into stable33 Feb 8, 2026
32 checks passed
@vitormattos vitormattos deleted the backport/6770/stable33 branch February 8, 2026 16:03
@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

Projects

Status: 4. to release

Development

Successfully merging this pull request may close these issues.

1 participant

Comments