Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Implementation:0xSteph Pentest ai JUnit XML Export

From Leeroopedia
Knowledge Sources
Domains Export, JUnit, CI_CD
Last Updated 2026-10-23 00:00 GMT

Overview

Concrete tool for converting pentest findings into JUnit XML format for CI systems to display as test results, provided by the pentest-ai engine.

Description

The findings_to_junit function converts a list of finding dicts into JUnit XML format. Critical and high severity findings become test failures, while medium/low/info become system-out entries. Each finding maps to a testcase with the finding title as name, category as classname, and description/target/CVSS/remediation as failure text.

Usage

Import this function when you need to export findings as JUnit XML for CI integration. Used by the CI gate and report generator.

Code Reference

Source Location

Signature

FAILURE_SEVERITIES = frozenset({"critical", "high"})

def findings_to_junit(
    findings: list[dict[str, Any]],
    engagement: dict[str, Any],
) -> str: ...

Import

from engine.junit_xml import findings_to_junit

I/O Contract

Inputs

Name Type Required Description
findings list[dict] Yes Findings with title, severity, category, description, target
engagement dict Yes Engagement dict with target

Outputs

Name Type Description
xml str JUnit XML string with testsuite and testcases

Usage Examples

Export to JUnit XML

from engine.junit_xml import findings_to_junit

findings = [
    {"title": "SQLi in search", "severity": "critical", "category": "injection",
     "description": "Boolean-based SQLi", "target": "https://example.com/search",
     "cwe_id": "CWE-89", "cvss_score": 9.8, "remediation": "Use parameterized queries"},
    {"title": "Missing HSTS", "severity": "info", "category": "misconfiguration",
     "description": "HSTS header not set", "target": "https://example.com"},
]

xml = findings_to_junit(findings, {"target": "example.com"})
Path("security-report.xml").write_text(xml)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment