Skip to content

ReversingLabs Spectra Assure: rewrite parser, add policy violations and hash_code deduplication - #17058

Open
rl-maartenb wants to merge 1 commit into
DefectDojo:devfrom
rl-maartenb:dev-reversinglabs-spectraassure
Open

rl-maartenb wants to merge 1 commit into
DefectDojo:devfrom
rl-maartenb:dev-reversinglabs-spectraassure

Conversation

@rl-maartenb

Copy link
Copy Markdown
Contributor

Replaces #17057, which was closed because its branch held a merge commit and a placeholder commit author.

Description

This rewrites the ReversingLabs Spectra Assure (rl-json) parser.

Findings

  • Vulnerabilities: one finding per active CVE or GHSA on a component, or on a dependency found inside a component.
    • The same binary (same sha256) at several paths is reported once: nb_occurences is raised and an also at: <path> line is added per extra path.
    • Severity comes from the CVSS base score (v2, v3.x, v4.0). The score is stored in cvssv3_score or cvssv4_score.
    • Exploit information becomes tags and impact: Fix Available, Exploit Exists, Exploited by Malware, Patching Mandated. Patching Mandated also sets known_exploited.
  • New: policy violations: one finding per component that a failing threats or secrets policy violation points at.
    • vuln_id_from_tool is <category>-<rule_id>.
    • The description holds the threat name, or the secret details and evidence.
  • Titles: they carry the first 8 characters of the component's sha256. Multi-language installers ship several binaries with the same name and path; without the sha256 their findings would be identical rows.
  • Component version: the report's version, except that Generic without a purl is no version. Generic is Spectra Assure's version for a file that has no version of its own.
  • Locations: with V3_FEATURE_LOCATIONS on, each vulnerability finding whose package has a purl gets one dependency location.
  • Report date: a report without a valid timestamp is rejected. The timestamp is used as the finding date.

Deduplication

  • unique_id_from_tool = <vulnerability id | category-rule_id>/sha256:<component sha256>. A report without a sha256 uses path: instead.
  • settings.dist.py gets one new entry in each of two dicts:
    • HASHCODE_FIELDS_PER_SCANNER: ["unique_id_from_tool", "component_name", "component_version"]
    • DEDUPLICATION_ALGORITHM_PER_PARSER: DEDUPE_ALGO_HASH_CODE
  • The parser passes None instead of "" for an empty component name or version. Otherwise the hash computed at import would differ from a later recompute, after the blank fields are stored as NULL.
  • Breaking: the earlier parser deduplicated on a sha256 of the title. Findings imported with the earlier version will not match findings imported with this version.

Code layout

  • The package rlJsonInfo/ is replaced by rl_json_info/, which follows PEP 8 naming:
    • rl_json_info.py: report walking
    • cve_info_node.py: the finding data
    • rl_json_secrets.py: secret details
  • parser.py maps the result to Finding.

Docs

  • The parser page describes every field, the severity table, the version rule, locations and deduplication.
  • It also changes "Spectra Assure Assets" back to "Spectra Assure products". Spectra Assure products are ReversingLabs offerings, not DefectDojo assets.

Test data

  • The three existing sample reports are replaced by current exports of the same packages. They make up most of the diff.
  • Two reports are new:
    • azure-cli-2.84.0-x64: 104 CVE findings and 1 secrets violation
    • synthetic-shared-component: one component with a CVE and threats and secrets violations; a small hand-made report used for the dedupe cases

Test results

  • unittests/tools/test_reversinglabs_spectraassure_parser.py: 18 tests covering:
    • counts and fields per sample
    • titles, severities, tags and impact
    • policy violations
    • shared components, also at and occurrences
    • Generic without a purl
    • locations on and off
    • rejected reports
  • unittests/tools/test_reversinglabs_spectraassure_deduplication.py (new): 8 tests that run real imports through the API, covering:
    • the settings entries, and that the stored hash uses them rather than the legacy fallback
    • the same report imported twice or three times
    • another engagement (duplicate) and another product (not a duplicate)
    • changes outside the identity (still duplicates)
    • a new sha256, version or rule id (new findings)
    • reimport of the same report (nothing changes)
  • Run: ./run-unittest.sh with both test classes passes (26 tests) with DD_V3_FEATURE_LOCATIONS on and off. One test is skipped when it is off.
  • Lint: ruff passes with the repository's configuration.

Documentation

Updated: docs/content/supported_tools/parsers/file/reversinglabs_spectraassure.md.

Checklist

  • Rebased against the latest dev.
  • Submitted against the dev branch.
  • Meaningful PR name.
  • Ruff compliant.
  • Python 3.13 compliant.
  • Documentation updated in docs/.
  • Model changes: none, so no migrations.
  • Unit tests added.
  • Labels (moderators): enhancement, settings_changes.

🤖 Generated with Claude Code

@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 Nov 23, 2026

This branch has not been deployed

No deployments
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.

1 participant