Add regression coverage for legacy CA identifier parsing

Abierto Apto para principiantes
#9,472 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
82/100
Tipo de issue
Nueva funcionalidad
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
php
Área
testing

Línea de trabajo

Empieza con la CaIdentifierServiceTest existente en tests/php/Unit/Service/CaIdentifierServiceTest.php y luego lee lib/Service/CaIdentifierService.php para ver qué devuelven getCaIdParsed() y generatePkiDirectoryName() para los IDs _e:o y _e:c. Añade casos con nombre en el data provider que comprueben cada campo analizado y los nombres exactos de los directorios, además de rechazos de IDs mal formados. Está terminado cuando composer test:unit -- --filter CaIdentifierServiceTest pasa y las nuevas aserciones fallarían si cambiara el contrato de análisis.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

backend enhancement good first issue php

Goal

Add deterministic regression tests for legacy LibreSign CA identifiers, protecting current OpenSSL and CFSSL behavior before the multi-CA registry is introduced.

Current implementation

Start with:

  • lib/Service/CaIdentifierService.php
  • tests/php/Unit/Service/CaIdentifierServiceTest.php

Existing tests already cover CA ID generation, some validation cases and one OpenSSL PKI-directory name. They do not thoroughly assert the parsed fields returned by getCaIdParsed() or cover both engine types in directory-name generation.

Scope

Extend the existing unit test class with named data providers where helpful. Verify:

  • Correct parsing through public getCaIdParsed() for legacy OpenSSL (_e:o) and CFSSL (_e:c) IDs, including instanceId, generation, engineType and engineName.
  • Expected directory paths from generatePkiDirectoryName() for both engine types and representative generations.
  • Rejection of malformed or unsupported IDs by the public parsing path.
  • Preservation of the existing ID shape and output without modifying production code.

Use synthetic identifiers and mocked IAppConfig. Do not invoke private methods directly or generate real CA keys.

Acceptance criteria

  • Tests cover both engines and at least one positive and negative parsing scenario.
  • Assertions compare all important parsed fields and exact directory-name outputs, not just non-null values.
  • Tests fail when the legacy parsing or directory-path contract is unintentionally changed.
  • Existing CaIdentifierServiceTest remains deterministic and passes.
  • No production CA logic, public identifier format, storage layout or CRL URL is modified.

Tests

Run composer test:unit -- --filter CaIdentifierServiceTest and applicable PHP syntax/static checks. Include the command results in the PR.

Next steps in the parent epic (not this task)

The multi-CA epic will later create a persistent issuer registry, retain compatibility with these legacy identifiers, and introduce context-aware CA operations and CRL routing. These tests are a baseline for compatibility, not the new registry implementation.

Good first issue

All work stays inside an established PHPUnit test class with a small public service contract. Follow its existing DataProvider examples. No database, encryption, authorization or CA lifecycle changes are required. Check for an active PR; questions and coordination are optional.

Additional context
Lenguaje dominante
PHP
Estrellas
844
Forks
176
Merge medio
13 h 46 min
PR fusionados (30 d)
299

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de LibreSign/libresign

Todos los issues de LibreSign/libresign

Issues similares

Más issues de PHP

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.