Skip to content

Reimporting SCB Findings from OWASP DefectDojo after persisting them#330

Merged
J12934 merged 18 commits intomainfrom
feature/extract-findings-from-dd
Mar 25, 2021
Merged

Reimporting SCB Findings from OWASP DefectDojo after persisting them#330
J12934 merged 18 commits intomainfrom
feature/extract-findings-from-dd

Conversation

@J12934
Copy link
Copy Markdown
Member

@J12934 J12934 commented Mar 19, 2021

This PR changes the DefectDojo Hook from a ReadOnly Hook to a ReadAndWrite Hook.

After uploading the raw result findings of different SCB scanner to OWASP DefectDojo this extension is responsible for importing the uploaded findings back to the secureCodeBox. This lets us import the false positive / duplicate status from DefectDojo attributes to the scans findings in further hooks, e.g. slack notification or later on elasticSearch persistence.

	┌─SCB OWASP ZAP──┐        ┌───────────────┐       ┌─────────────────────┐         ┌ ─ ─ ─ ┐
	│                │        │ ReadWriteHook:│       │ ReadHook:           │
	│┌──────────────┐│        │ DefectDojo-   ├──────▶│ Teams Notification  ├──────▶  │ Teams │
	││ ZAP Scanner  ││        │ Persistence   │       │ Hook                │
	│└──────────────┘│        │               │       └─────────────────────┘         └ ─ ─ ─ ┘
	│                │───────▶│               │
	│┌──────────────┐│        │               │       ┌─────────────────────┐         ┌ ─ ─ ─ ┐
	││ ZAP Parser   ││        │               │       │ ReadHook:           │
	│└──────────────┘│        │               ├──────▶│ Elasticsearch-      ├──────▶  │ ECK   │
	│                │        │               │       │ Persistence Hook    │
	└────────────────┘        └────┬──────────┘       └─────────────────────┘         └ ─ ─ ─ ┘
	                               │     ▲
	                               │     │
	                               │     │◀═══════════════  Added by PR 330
	                               ▼     │
	                          ┌ ─ ─ ─ ─ ─ ─ ─ ┐

	                          │ DefectDojo    │
	                            Instance
	                          │               │
	                           ─ ─ ─ ─ ─ ─ ─ ─

The imported findings from DefectDojo are mapped back to the secureCodeBox finding format and overwrite the original secureCodeBox findings from the parser. Here's a example mapped finding:

{
    "id": "fdc841ef-ef22-45e8-8ecd-c6f246312eb0",
    "name": "Content Security Policy (CSP) Header Not Set",
    "location": "http://juice-shop:3000",
    "description": "Content Security Policy (CSP) is an added layer of security that helps to detect and mitigate certain types of attacks, including Cross Site Scripting (XSS) and data injection attacks. These attacks are used for everything from data theft to site defacement or distribution of malware. CSP provides a set of standard HTTP headers that allow website owners to declare approved sources of content that browsers should be allowed to load on that page — covered types are JavaScript, CSS, HTML frames, fonts, images and embeddable objects such as Java applets, ActiveX, audio and video files.\n\nReference: https://developer.mozilla.org/en-US/docs/Web/Security/CSP/Introducing_Content_Security_Policyhttps://cheatsheetseries.owasp.org/cheatsheets/Content_Security_Policy_Cheat_Sheet.htmlhttp://www.w3.org/TR/CSP/http://w3c.github.io/webappsec/specs/content-security-policy/csp-specification.dev.htmlhttp://www.html5rocks.com/en/tutorials/security/content-security-policy/http://caniuse.com/#feat=contentsecuritypolicyhttp://content-security-policy.com/\n\nURL: http://juice-shop:3000/ftp/\nMethod: GET\n\nURL: http://juice-shop:3000/ftp\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/coupons_2013.md.bak\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/suspicious_errors.yml\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/encrypt.pyc\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/eastere.gg\nMethod: GET\n\nURL: http://juice-shop:3000/\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/package.json.bak\nMethod: GET\n\nURL: http://juice-shop:3000/ftp/quarantine\nMethod: GET\n\nURL: http://juice-shop:3000\nMethod: GET\n\nURL: http://juice-shop:3000/sitemap.xml\nMethod: GET\n",
    "category": "DefectDojo Imported Finding",
    "severity": "Medium",
    "attributes": {
      "defectdojo.org/finding-id": 10414,
      "defectdojo.org/finding-url": "https://defectdojo.example.com/finding/10414",
      "defectdojo.org/test-id": 588,
      "falsePositive": false,
      "defectdojo.org/test-url": "https://defectdojo.example.com/test/588",
      "duplicate": true
    },
    "osi_layer": null
  }

I updated the Kubernetes Client version and regenerated the autogenerated Classes for the CRD's which causes probably 98% of this PR diff, you can skip passed them (everything under io.securecodebox.models in commit a9e519b).

J12934 added 9 commits March 10, 2021 14:09
⚠️ Had to manually change the finishedAt timestamp of the ScanStatus Class, this was still generating the deprecated joda DateTime classes, which do not build correctly with the corrent Kubernetes client-java anymore
# Conflicts:
#	hooks/persistence-defectdojo/src/main/java/io/securecodebox/persistence/strategies/Strategy.java
#	hooks/persistence-defectdojo/src/main/java/io/securecodebox/persistence/strategies/VersionedEngagementsStrategy.java
@J12934 J12934 added enhancement New feature or request persistence Implement or update a persistence store hook Implement or update a hook labels Mar 19, 2021
@J12934 J12934 requested a review from rfelber March 19, 2021 09:58
@J12934 J12934 self-assigned this Mar 19, 2021
Copy link
Copy Markdown

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 9784 lines exceeds the maximum allowed for the inline comments feature.

@J12934 J12934 force-pushed the feature/extract-findings-from-dd branch from a8ec0c8 to d84dbb0 Compare March 19, 2021 10:18
Copy link
Copy Markdown

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 9818 lines exceeds the maximum allowed for the inline comments feature.

@J12934 J12934 enabled auto-merge March 19, 2021 13:00
@rfelber rfelber added this to the v2.6.0 milestone Mar 19, 2021
@rfelber rfelber changed the title Extract Findings Back from Defectdojo after Importing Them 🤖 Extract SCB Findings from Defectdojo after importing them Mar 19, 2021
@rfelber rfelber added the defectdojo All issues regarding the DefectDojo Integration label Mar 20, 2021
@J12934 J12934 force-pushed the feature/extract-findings-from-dd branch from d91fefe to 704499a Compare March 22, 2021 17:38
Copy link
Copy Markdown

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 9903 lines exceeds the maximum allowed for the inline comments feature.

@J12934 J12934 requested a review from rfelber March 23, 2021 10:14
Copy link
Copy Markdown

@qlty-cloud-legacy qlty-cloud-legacy bot left a comment

Choose a reason for hiding this comment

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

The PR diff size of 9903 lines exceeds the maximum allowed for the inline comments feature.

@J12934 J12934 merged commit 9141e19 into main Mar 25, 2021
@J12934 J12934 deleted the feature/extract-findings-from-dd branch March 25, 2021 10:55
@rfelber rfelber removed the enhancement New feature or request label Mar 26, 2021
@rfelber rfelber changed the title 🤖 Extract SCB Findings from Defectdojo after importing them Extract SCB Findings from Defectdojo after importing them Mar 30, 2021
@rfelber rfelber changed the title Extract SCB Findings from Defectdojo after importing them Extract SCB Findings from OWASP DefectDojo after importing them Mar 30, 2021
@rfelber rfelber changed the title Extract SCB Findings from OWASP DefectDojo after importing them Reimporting SCB Findings from OWASP DefectDojo after importing them Apr 11, 2021
@rfelber rfelber changed the title Reimporting SCB Findings from OWASP DefectDojo after importing them Reimporting SCB Findings from OWASP DefectDojo after persisting them Apr 11, 2021
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 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.

2 participants