Skip to content

Comments

Added DefectDojo Hook Support for all secureCodeBox Scanners#487

Merged
rfelber merged 9 commits intomainfrom
integrate-generic-dd-parser
Jun 29, 2021
Merged

Added DefectDojo Hook Support for all secureCodeBox Scanners#487
rfelber merged 9 commits intomainfrom
integrate-generic-dd-parser

Conversation

@JohannesZahn
Copy link
Contributor

Description

The generic DefectDojo JSON Parser will be used now if no specific compatible parser exists. The SCB Findings json is therefore transformed into the findings format that is compatible to the generic DefectDojo JSON Parser.

Closes #332

Checklist

  • Test your changes as thoroughly as possible before you commit them. Preferably, automate your test by unit/integration tests.
  • Make sure npm test runs for the whole project.
  • Make codeclimate checks happy

@JohannesZahn JohannesZahn self-assigned this Jun 10, 2021
@JohannesZahn JohannesZahn added defectdojo All issues regarding the DefectDojo Integration enhancement New feature or request hook Implement or update a hook persistence Implement or update a persistence store labels Jun 10, 2021
@JohannesZahn JohannesZahn force-pushed the integrate-generic-dd-parser branch 3 times, most recently from 9237897 to ec852c1 Compare June 10, 2021 15:46
@EndPositive
Copy link
Contributor

EndPositive commented Jun 10, 2021

The generic parser is currently failing when importing findings that have locations/endpoints without a protocol. I've made a PR to fix this issue: #4643

@EndPositive
Copy link
Contributor

EndPositive commented Jun 11, 2021

The finding attributes are not imported into the DefectDojo description. Scans such as screenshooter save important information into the findings attributes.

Is it possible to parse the finding attributes generically into DefectDojo's description?

@JohannesZahn
Copy link
Contributor Author

The finding attributes are not imported into the DefectDojo description. Scans such as screenshooter save important information into the findings attributes.

Is it possible to parse the finding attributes generically into DefectDojo's description?

Do you mean that findings attributes that are currently not passed to defectdojo (like category, osi layer etc.) should be concatenated to the description string?

@EndPositive
Copy link
Contributor

EndPositive commented Jun 15, 2021

Here's a finding from ssh_scan:

[
  {
    "name": "SSH Service",
    "description": "SSH Service Information",
    "category": "SSH Service",
    "osi_layer": "APPLICATION",
    "severity": "INFORMATIONAL",
    "reference": {},
    "hint": "",
    "location": "[REDACTED]",
    "attributes": {
      "hostname": "[REDACTED]",
      "ip_address": "[REDACTED]",
      "server_banner": "SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10",
      "ssh_version": 2,
      "os_cpe": "o:canonical:ubuntu:16.04",
      "ssh_lib_cpe": "a:openssh:openssh:7.2p2",
      "compliance_policy": "Mozilla Modern",
      "compliant": false,
      "grade": "D",
      "references": [
        "https://wiki.mozilla.org/Security/Guidelines/OpenSSH"
      ],
      "auth_methods": [
        "publickey",
        "password"
      ],
      "key_algorithms": [
        "[email protected]",
        [...]
      ],
      "encryption_algorithms": [
        "[email protected]",
        [...]
      ],
      "mac_algorithms": [
        "[email protected]",
        [...]
      ],
      "compression_algorithms": [
        "none",
        "[email protected]"
      ]
    },
    "id": "aa12b3d2-4493-4fff-b5bf-65de3ac20a70"
  }
]

And the corresponding DefectDojo finding:

image

As you can see, all the finding attributes (such as auth_methods, grade, mac_algorithms, etc.), are not imported.

My question was whether all these attributes can be formatted into the DefectDojo description. This could either be a pretty printed json or some kind of formatter to markdown such that the description would be something like:

SSH Service Information
hostname: [REDACTED]
ip_address: [REDACTED]
server_banner: SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.10
ssh_version: 2
[...]
auth_methods: publickey, password
[...]

Especially for informational findings these attributes are really valuable and should be viewable in DefectDojo.

@JohannesZahn
Copy link
Contributor Author

JohannesZahn commented Jun 18, 2021

@EndPositive the findings attributes are now written into the description as prettified JSON :)

@JohannesZahn JohannesZahn force-pushed the integrate-generic-dd-parser branch from 63f0620 to 9386d88 Compare June 18, 2021 10:31
@J12934 J12934 self-requested a review June 18, 2021 10:34
@EndPositive
Copy link
Contributor

Awesome! Works wonderfully for me.

@EndPositive
Copy link
Contributor

DefectDojo's Finding model houses a field called unique_id_from_tool with help text Vulnerability technical id from the source tool. Allows to track unique vulnerabilities..

Would it be possible to fill this with the SecureCodeBox finding ID?

@rfelber rfelber added this to the v3.0.0 milestone Jun 18, 2021
@JohannesZahn
Copy link
Contributor Author

@EndPositive if I'm not mistaken unique_id_from_tool is already populated with the finding id. My unit test also checks for it to be correctly set. Is it not populated in DefectDojo?

@EndPositive
Copy link
Contributor

EndPositive commented Jun 22, 2021

Hmm, yeah I now see that it does work with the generic parser, but not with any pre-existing parser. The built-in DefectDojo tools all work with the raw findings and thus don't have access to the SecureCodeBox ID.

For us, it would be really nice to have the SecureCodeBox finding ID throughout all DefectDojo findings. Maybe the persistence provider could patch the created finding with the SecureCodeBox ID?

Since this is getting a bit unrelated to the current PR and requested features, we can move this discussion somewhere else if you want.

@rfelber
Copy link
Member

rfelber commented Jun 26, 2021

I would prefer to separate your request to patch the secureCodeBox UID within DefectDojo into a different Issue/PR. Do you want to create an issue for that @EndPositive ?

@JohannesZahn Beside that is there any stuff here that needs attention or can we mark this PR as ready to review?

@JohannesZahn
Copy link
Contributor Author

It is ready to review from my side 👍

@rfelber rfelber marked this pull request as ready for review June 27, 2021 05:39
Copy link
Member

@rfelber rfelber left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this PR! Just some minor improvements necessary

@JohannesZahn JohannesZahn requested a review from rfelber June 29, 2021 08:19
@rfelber rfelber changed the title DefectDojo Hook now supports all Scanners Added DefectDojo Hook Support for all secureCodeBox Scanners Jun 29, 2021
@rfelber rfelber merged commit 2040f80 into main Jun 29, 2021
@rfelber rfelber deleted the integrate-generic-dd-parser branch June 29, 2021 21:00
@damiencarol
Copy link

@JohannesZahn @rseedorff ICYDK generic JSON format is part of 2.0.0 release.

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

Labels

defectdojo All issues regarding the DefectDojo Integration enhancement New feature or request hook Implement or update a hook persistence Implement or update a persistence store

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⚙️ Add a generic (SCB) finding importer to the DefectDojo Integration Hook

4 participants