test : add unit tests for KnowledgeBase.infer_cpe and _normalize_version
Nadie ha tomado este issue todavía.
- #2252 de @tmdeveloper007 — cerrado sin fusionar
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 25/100
Línea de trabajo
Start with testing/backend/unit/test_knowledgebase.py and find the existing KnowledgeBase unit tests; then read the infer_cpe and _normalize_version implementations to confirm expected behavior. Add the listed cases and run the focused unit test file. Done when both helpers’ specified cases pass; the issue notes it is being handled and links a closed, unmerged pull request.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Summary of What Needs to be Done:
Add unit tests for KnowledgeBase.infer_cpe() and KnowledgeBase._normalize_version() in testing/backend/unit/test_knowledgebase.py. These methods are not currently tested despite being public helpers in the knowledgebase module.
Changes that Need to be Made:
Add tests to testing/backend/unit/test_knowledgebase.py:
For infer_cpe():
- exact CPE match for seeded products (nginx 1.18.0, apache 2.4.49)
- returns None for unknown product/service
- handles empty product/service strings
- handles None values gracefully
For _normalize_version():
- strips leading 'v' prefix (v1.2.3 -> 1.2.3)
- extracts numeric prefix (1.2.3-beta -> 1.2.3)
- handles empty string
- handles purely alphabetic strings (returns as-is)
Impact that it would Provide:
- Ensures knowledgebase CPE inference behaves correctly across version formats
- Improves reliability of the vulnerability matching pipeline
- Tests pure, isolated helpers that do not require a database or network
Note: This task is being handled by tmdeveloper007 — please assign to that account when picking it up.
- Lenguaje dominante
- Python
- Estrellas
- 36
- Forks
- 234
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Incluye un Dockerfile o un archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de utksh1/SecuScan
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
-
area:frontend good first issue level:beginner priority:low type:testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
-
area:frontend good first issue level:intermediate priority:low type:testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Todos los issues de utksh1/SecuScan
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
Los mantenedores suelen responder en 1 día
-
comp/desktop P3 type/feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
NousResearch/hermes-agent#154285 ·
Los mantenedores suelen responder en 1 día
-
docs: qualify copied and custom kubectl debug policy notesPosiblemente ocupada @nym01 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
kubescape/cel-admission-library#166 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
SACGF/variantgrid#2804 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[BUG] HTTP lifecycle dispatch treats a NO_PROXY-only environment as corporate egress and skips the resolve-and-pinned sessionPosiblemente ocupada @bodapatisaikrishna la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Los mantenedores suelen responder en 1 día