Skip to content

test(ca): cover legacy CA identifier parsing and PKI paths - #9518

Merged
vitormattos merged 1 commit into
LibreSign:mainfrom
matheusa1:test/ca-identifier-legacy-parsing-9472
Nov 15, 2026
Merged

vitormattos merged 1 commit into
LibreSign:mainfrom
matheusa1:test/ca-identifier-legacy-parsing-9472

Conversation

@matheusa1

Copy link
Copy Markdown
Contributor

Requested by Matheus · project thread

Resolves: #9472

📝 Summary

Adds regression tests to the existing CaIdentifierServiceTest that pin the legacy OpenSSL (_e:o) and CFSSL (_e:c) CA identifier contract before the multi-CA registry work. No production code changes.

  • getCaIdParsed(): asserts all parsed fields (engineName, instanceId, generation, engineType) for both engines, plus 14 malformed IDs that must throw InvalidArgumentException (exception messages are not asserted).
  • generatePkiDirectoryName() / generatePkiDirectoryNameFromParams(): exact paths for both engines and several generations; invalid IDs are rejected.
  • generateCaId(): exact ID shape and the values stored in instance_id / ca_id, plus unsupported engine rejection.

🧪 How to test

composer test:unit -- --filter CaIdentifierServiceTest

Validation evidence

  • Focused regression/acceptance test: CaIdentifierServiceTest OK (39 tests, 45 assertions). Temporary mutations of the pki/ prefix, directory separator, CFSSL engine letter and the generation regex each made the tests fail.
  • Relevant lint/type/static-analysis checks: composer cs:check (0 of 959 files to fix), Psalm (no errors), php -l.
  • Broader suite required by the changed surface: full PHPUnit unit suite (4618 tests OK) and integration suite (434 tests OK, 3 skipped) on Nextcloud 36 with sqlite. Behat and the MySQL/PostgreSQL/MariaDB matrices were not run locally.
  • CI reviewed

⚙️ API / Back-end changes

  • No API/service/architecture changes; test-only.
  • Unit and/or integration tests added or updated
  • Authorization and negative paths checked when applicable
  • Capabilities updated when applicable (not applicable)
  • Documentation updated when applicable (not applicable)
  • API documentation regenerated with composer openapi when necessary (not necessary)

✅ Checklist

  • I have read and followed the contribution guide.
  • The diff does not contain unrelated refactors or generated changes.
  • Commits follow Conventional Commits where applicable.
  • All commits include the required DCO sign-off.

🤖 AI (if applicable)

  • The content of this PR was partially or fully generated using AI

Add data-provider based regression tests for getCaIdParsed(),
generatePkiDirectoryName() and generatePkiDirectoryNameFromParams()
for both OpenSSL (_e:o) and CFSSL (_e:c) legacy IDs, malformed ID
rejection and the exact shape of generated CA IDs.

Refs: LibreSign#9472

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Signed-off-by: Matheus Andrade <2002matheus@gmail.com>
@matheusa1
matheusa1 requested a review from a team as a code owner November 15, 2026 17:10
@welcome

welcome Bot commented Nov 15, 2026

Copy link
Copy Markdown

Thanks for opening your first pull request in this repository! ✌️

@vitormattos
vitormattos merged commit 6749ef4 into LibreSign:main Nov 15, 2026
77 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add regression coverage for legacy CA identifier parsing

2 participants