Skip to content

feat(parsers): add Alert Logic CSV parser#14930

Open
skywalke34 wants to merge 7 commits into
DefectDojo:devfrom
skywalke34:alertlogic-parser
Open

feat(parsers): add Alert Logic CSV parser#14930
skywalke34 wants to merge 7 commits into
DefectDojo:devfrom
skywalke34:alertlogic-parser

Conversation

@skywalke34
Copy link
Copy Markdown
Contributor

Summary

Adds a parser for Alert Logic vulnerability scan CSV exports.

  • New scan type: Alert Logic Scan
  • Format: CSV (UTF-8 with BOM, 26 columns, multi-line quoted fields)
  • Class: dojo.tools.alertlogic.parser.AlertlogicParser

Mirrors the structure of recent single-format parsers (IriusRisk #14384) and the dedup pattern of Qualys VMDR (#14453). Alert Logic emits a stable native Vulnerability ID, so deduplication uses DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE with hashcode fallback fields ["title", "component_name", "vuln_id_from_tool"].

Files

  • dojo/tools/alertlogic/{__init__.py,parser.py} — parser (166 lines)
  • unittests/tools/test_alertlogic_parser.py — 32 tests (severity matrix, title truncation, single + multi-IP + IPv6 endpoints, endpoint.clean(), BOM handling, CVE present/absent, CISA Known Exploited tagging, CVSS score parsing, multi-line description preservation)
  • unittests/scans/alertlogic/{no_vuln,one_vuln,many_vulns}.csv — synthetic fixtures (real public CVE data; reserved-doc IPs 192.0.2.x / 198.51.100.x / 203.0.113.x; .example.com hostnames; fictional AcmeCorp account)
  • docs/content/supported_tools/parsers/file/alertlogic.md — field mapping, severity mapping, special processing notes
  • dojo/settings/settings.dist.py — registers Alert Logic Scan in HASHCODE_FIELDS_PER_SCANNER and DEDUPLICATION_ALGORITHM_PER_PARSER

Test plan

  • ruff check dojo/tools/alertlogic/ unittests/tools/test_alertlogic_parser.py — clean
  • 32/32 unit tests pass
  • endpoint.clean() validated on all 10 endpoints generated from the many_vulns fixture
  • Manual smoke-test through the DefectDojo UI: imported many_vulns.csv into an engagement; findings displayed correctly with proper severities, endpoints, and tags
  • CI

Notes

Severity values map 1:1 (Info → Info, Low → Low, etc.) — no normalization needed. Protocol/Port value TCP/0 is treated as "no specific port" and the port is omitted from the endpoint. CISA Known Exploited rows receive a cisa-known-exploited tag.

Empty __init__.py + stub parser.py with the 4 required methods returning
placeholder values. Sets up the package for TDD tests to import against
before the real implementation in Task 8.

Authored by T. Walker - DefectDojo
Three fixtures matching the 26-column Alert Logic vulnerability export
shape (UTF-8 BOM, embedded CRLF in multi-line fields):

- no_vuln.csv      — header only, 0 data rows
- one_vuln.csv     — single Medium finding (HTTP/2 Rapid Reset)
- many_vulns.csv   — 7 rows covering Info / Low / Medium / High / Critical,
                     with/without CVE, single & multi-IP (IPv4+IPv6),
                     CISA Known Exploited Yes/No, multi-line Description
                     and Resolution, a >500-char title for truncation test,
                     empty CVSS and empty Operating System edge cases.

All asset names, IPs, deployment names, and the customer account are
synthetic (reserved doc IP ranges 192.0.2.x / 198.51.100.x / 203.0.113.x;
.example.com hostnames; fictional AcmeCorp account). CVE identifiers and
their associated descriptions/resolutions are from public sources.

Authored by T. Walker - DefectDojo
Skeleton with 4 tests: get_scan_types, parse_no_findings, parse_one_finding,
parse_many_findings. The one/many assertions fail against the Task 3 stub
(which returns []) — that's the intended TDD red state. Full field-validation
tests will be appended in Task 9 after the parser implementation lands in
Task 8.

Authored by T. Walker - DefectDojo
Parses Alert Logic vulnerability scan CSV exports (26 columns, UTF-8 with
BOM, multi-line quoted fields). Single-format, monolithic implementation
following the IriusRisk skeleton.

Field mapping:
- Vulnerability               → title (truncated at 500 chars with ellipsis)
- Severity                    → severity (direct 1:1 Info/Low/Medium/High/Critical)
- CVSS Score                  → cvssv3_score (float, None if empty)
- Asset Name                  → component_name
- IP Address                  → unsaved_endpoints (comma-split IPv4/IPv6)
- Protocol/Port               → endpoint protocol + port (port 0 → omitted)
- CVE                         → unsaved_vulnerability_ids
- Resolution                  → mitigation
- Vulnerability ID            → unique_id_from_tool (stable native ID)
- Description, Evidence, OS,
  Vuln Span ID, Vuln Key,
  Asset Key/Type, Service,
  Category, VPC/Network,
  Deployment Name, Customer
  Account, First Seen, Last
  Scanned, Published Date,
  Age (days), CISA KEV         → description (markdown table)
- CISA Known Exploited = Yes  → unsaved_tags: ["cisa-known-exploited"]

static_finding=True, dynamic_finding=False (infrastructure vulnerability
scanner pattern, matches Qualys VMDR).

All 7 fixture findings parse cleanly with correct severities, multi-IP
endpoint extraction (IPv4+IPv6), title truncation, CVE list, CVSS score,
and tags. endpoint.clean() passes on all 10 endpoints generated from the
many_vulns fixture.

Authored by T. Walker - DefectDojo
Adds 28 new tests on top of the TDD scaffold, bringing total coverage to
32 tests. Categories covered:

- Scan-type metadata: get_label, get_description
- Basic fields: title, severity, component_name, unique_id_from_tool,
  cvssv3_score, static/dynamic flags, mitigation content, description
  structure
- Severity mapping: one test per source level (Info/Low/Medium/High/Critical)
- Title truncation: long (>500) gets [:497] + "...", short stays as-is
- unique_id_from_tool: distinct values per finding, matches source
- Endpoints: single IPv4, multi-IP (IPv4+IPv6), IPv6-only, port=0 omission,
  endpoint.clean() on every endpoint
- CVE handling: present and absent
- CISA Known Exploited tag: added on "Yes", absent on "No"
- CVSS score: parsed when present, None when empty
- BOM handling: title resolves correctly (proves UTF-8 BOM is stripped)
- Multi-line field preservation in description

All 32 tests pass against the parser implementation from the previous
commit.

Authored by T. Walker - DefectDojo
Documents the Alert Logic CSV parser including:
- File-export workflow from the Alert Logic console
- Default deduplication strategy (unique_id_from_tool + hashcode fallback)
- Complete 26-column field mapping table (expandable)
- Additional Finding field settings (static/dynamic flags, active default)
- Special processing notes covering severity conversion, title truncation,
  description construction, endpoint multi-IP / IPv6 / port-zero handling,
  deduplication algorithm, CVE handling, CISA Known Exploited tagging,
  and UTF-8 BOM + multi-line field handling

Authored by T. Walker - DefectDojo
Adds Alert Logic Scan entries to:
- HASHCODE_FIELDS_PER_SCANNER with ["title", "component_name", "vuln_id_from_tool"]
  (fallback when Vulnerability ID is missing on a row)
- DEDUPLICATION_ALGORITHM_PER_PARSER as DEDUPE_ALGO_UNIQUE_ID_FROM_TOOL_OR_HASH_CODE
  (uses Vulnerability ID as the stable native identifier with hashcode fallback)

Mirrors the Qualys VMDR dedup pattern (same field set, same algorithm).

Authored by T. Walker - DefectDojo
@github-actions github-actions Bot added settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR docs unittests parser labels May 28, 2026
@skywalke34 skywalke34 changed the title Add Alert Logic CSV parser feat(parsers): add Alert Logic CSV parser May 28, 2026
@valentijnscholten valentijnscholten added this to the 2.60.0 milestone May 31, 2026
Copy link
Copy Markdown
Member

@valentijnscholten valentijnscholten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you look at the failing tests?

@mtesauro
Copy link
Copy Markdown
Contributor

@skywalke34
Looks like there's some issues in your parser code:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs parser settings_changes Needs changes to settings.py based on changes in settings.dist.py included in this PR unittests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants