Skip to content

twistlock2hdf: unmapped severities silently become impact 0, and hdf2ckl then marks those findings Not_Applicable #8611

Description

@wdower

Twistlock scan output can contain severities that are missing from IMPACT_MAPPING in libs/hdf-converters/src/twistlock-mapper.ts:

const IMPACT_MAPPING: Map<string, number> = new Map([
  ['critical', 0.9],
  ['important', 0.9],
  ['high', 0.7],
  ['medium', 0.5],
  ['moderate', 0.5],
  ['low', 0.3]
]);

Real Twistlock reports also emit at least unassigned, unimportant, and negligible. None are in the map, so impactMapping() in base-converter.ts falls through to its || 0 default and the finding is written into OHDF with impact 0.0 — with no warning, and indistinguishable from a genuine 0.0.

Reproduce: convert any Twistlock report containing a finding with "severity": "unassigned", then run the result through hdf2ckl. The finding's stanza has STATUS: Not_Applicable.

Suggested fix: add the missing severities to IMPACT_MAPPING (unassigned and unimportant presumably map somewhere in the 0.3–0.5 band; negligible near the floor — needs a decision). The silent-miss behavior of impactMapping() itself is a separate, converter-wide issue: see companion issue #8610.

The reporters have offered matched sample reports from their corpus as regression fixtures.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions