Skip to content

Commit

Permalink
Merge branch 'dev' into master-into-dev/2.38.2-2.39.0-dev
Browse files Browse the repository at this point in the history
  • Loading branch information
Maffooch committed Sep 16, 2024
2 parents 5abef72 + 3641886 commit ef3040a
Show file tree
Hide file tree
Showing 90 changed files with 1,978 additions and 145 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/rest-framework-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
run: docker/setEnv.sh unit_tests_cicd

# phased startup so we can use the exit code from unit test container
- name: Start Postgres
run: docker compose up -d postgres
- name: Start Postgres and webhook.endpoint
run: docker compose up -d postgres webhook.endpoint

# no celery or initializer needed for unit tests
- name: Unit tests
Expand Down
2 changes: 1 addition & 1 deletion components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"google-code-prettify": "^1.0.0",
"jquery": "^3.7.1",
"jquery-highlight": "3.5.0",
"jquery-ui": "1.13.3",
"jquery-ui": "1.14.0",
"jquery.cookie": "1.4.1",
"jquery.flot.tooltip": "^0.9.0",
"jquery.hotkeys": "jeresig/jquery.hotkeys#master",
Expand Down
12 changes: 6 additions & 6 deletions components/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -678,12 +678,12 @@ [email protected]:
dependencies:
jquery ">= 1.0.0"

jquery-ui@1.13.3:
version "1.13.3"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.13.3.tgz#d9f5292b2857fa1f2fdbbe8f2e66081664eb9bc5"
integrity sha512-D2YJfswSJRh/B8M/zCowDpNFfwsDmtfnMPwjJTyvl+CBqzpYwQ+gFYIbUUlzijy/Qvoy30H1YhoSui4MNYpRwA==
jquery-ui@1.14.0:
version "1.14.0"
resolved "https://registry.yarnpkg.com/jquery-ui/-/jquery-ui-1.14.0.tgz#b75d417826f0bab38125f907356d2e3313a9c6d5"
integrity sha512-mPfYKBoRCf0MzaT2cyW5i3IuZ7PfTITaasO5OFLAQxrHuI+ZxruPa+4/K1OMNT8oElLWGtIxc9aRbyw20BKr8g==
dependencies:
jquery ">=1.8.0 <4.0.0"
jquery ">=1.12.0 <5.0.0"

[email protected]:
version "1.4.1"
Expand All @@ -699,7 +699,7 @@ jquery.hotkeys@jeresig/jquery.hotkeys#master:
version "0.2.0"
resolved "https://codeload.github.com/jeresig/jquery.hotkeys/tar.gz/f24f1da275aab7881ab501055c256add6f690de4"

"jquery@>= 1.0.0", jquery@>=1.7, jquery@>=1.7.0, "jquery@>=1.8.0 <4.0.0", jquery@^3.7.1:
"jquery@>= 1.0.0", "jquery@>=1.12.0 <5.0.0", jquery@>=1.7, jquery@>=1.7.0, jquery@^3.7.1:
version "3.7.1"
resolved "https://registry.yarnpkg.com/jquery/-/jquery-3.7.1.tgz#083ef98927c9a6a74d05a6af02806566d16274de"
integrity sha512-m4avr8yL8kmFN8psrbFFFmB/If14iN5o9nw/NgnnM+kybDJpRsAynV2BsfpTYrTRysYUdADVD7CkUUizgkpLfg==
Expand Down
2 changes: 2 additions & 0 deletions docker-compose.override.dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,5 @@ services:
published: 8025
protocol: tcp
mode: host
"webhook.endpoint":
image: mccutchen/go-httpbin:v2.14.1@sha256:2612f203b1be154524b0dbb65212a158776f0643e2f6e1dad45984fc93413d97
2 changes: 2 additions & 0 deletions docker-compose.override.unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ services:
redis:
image: busybox:1.36.1-musl
entrypoint: ['echo', 'skipping', 'redis']
"webhook.endpoint":
image: mccutchen/go-httpbin:v2.14.1@sha256:2612f203b1be154524b0dbb65212a158776f0643e2f6e1dad45984fc93413d97
volumes:
defectdojo_postgres_unit_tests: {}
defectdojo_media_unit_tests: {}
2 changes: 2 additions & 0 deletions docker-compose.override.unit_tests_cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ services:
redis:
image: busybox:1.36.1-musl
entrypoint: ['echo', 'skipping', 'redis']
"webhook.endpoint":
image: mccutchen/go-httpbin:v2.14.1@sha256:2612f203b1be154524b0dbb65212a158776f0643e2f6e1dad45984fc93413d97
volumes:
defectdojo_postgres_unit_tests: {}
defectdojo_media_unit_tests: {}
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ services:
source: ./docker/extra_settings
target: /app/docker/extra_settings
postgres:
image: postgres:16.4-alpine@sha256:492898505cb45f9835acc327e98711eaa9298ed804e0bb36f29e08394229550d
image: postgres:16.4-alpine@sha256:d898b0b78a2627cb4ee63464a14efc9d296884f1b28c841b0ab7d7c42f1fffdf
environment:
POSTGRES_DB: ${DD_DATABASE_NAME:-defectdojo}
POSTGRES_USER: ${DD_DATABASE_USER:-defectdojo}
POSTGRES_PASSWORD: ${DD_DATABASE_PASSWORD:-defectdojo}
volumes:
- defectdojo_postgres:/var/lib/postgresql/data
redis:
image: redis:7.2.5-alpine@sha256:0bc09d9f486508aa42ecc2f18012bb1e3a1b2744ef3a6ad30942fa12579f0b03
image: redis:7.2.5-alpine@sha256:6aaf3f5e6bc8a592fbfe2cccf19eb36d27c39d12dab4f4b01556b7449e7b1f44
volumes:
- defectdojo_redis:/data
volumes:
Expand Down
7 changes: 7 additions & 0 deletions docs/content/en/getting_started/upgrading/2.39.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
title: 'Upgrading to DefectDojo Version 2.39.x'
toc_hide: true
weight: -20240903
description: No special instructions.
---
There are no special instructions for upgrading to 2.39.x. Check the [Release Notes](https://github.com/DefectDojo/django-DefectDojo/releases/tag/2.39.0) for the contents of the release.
2 changes: 1 addition & 1 deletion docs/content/en/integrations/burp-plugin.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Defect Dojo Burp plugin"
description: "Export findings directly from Burp to DefectDojo."
draft: false
weight: 8
weight: 9
---

**Please note: The DefectDojo Burp Plugin has been sunset and is no longer a supported feature.**
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/integrations/exporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Exporting"
description: "DefectDojo has the ability to export findings."
draft: false
weight: 11
weight: 12
---


Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/integrations/google-sheets-sync.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Google Sheets synchronisation"
description: "Export finding details to Google Sheets and upload changes from Google Sheets."
draft: false
weight: 7
weight: 8
---

**Please note - the Google Sheets feature has been deprecated as of DefectDojo version 2.21.0 - these documents are for reference only.**
Expand Down
2 changes: 1 addition & 1 deletion docs/content/en/integrations/languages.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "Languages and lines of code"
description: "You can import an analysis of languages used in a project, including lines of code."
draft: false
weight: 9
weight: 10
---

## Import of languages for a project
Expand Down
79 changes: 79 additions & 0 deletions docs/content/en/integrations/notification_webhooks/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
---
title: "Notification Webhooks (experimental)"
description: "How to setup and use webhooks"
weight: 7
chapter: true
---

Webhooks are HTTP requests coming from the DefectDojo instance towards user-defined webserver which expects this kind of incoming traffic.

## Transition graph:

It is not unusual that in some cases webhook can not be performed. It is usually connected to network issues, server misconfiguration, or running upgrades on the server. DefectDojo needs to react to these outages. It might temporarily or permanently disable related endpoints. The following graph shows how it might change the status of the webhook definition based on HTTP responses (or manual user interaction).

```mermaid
flowchart TD
START{{Endpoint created}}
ALL{All states}
STATUS_ACTIVE([STATUS_ACTIVE])
STATUS_INACTIVE_TMP
STATUS_INACTIVE_PERMANENT
STATUS_ACTIVE_TMP([STATUS_ACTIVE_TMP])
END{{Endpoint removed}}
START ==> STATUS_ACTIVE
STATUS_ACTIVE --HTTP 200 or 201 --> STATUS_ACTIVE
STATUS_ACTIVE --HTTP 5xx <br>or HTTP 429 <br>or Timeout--> STATUS_INACTIVE_TMP
STATUS_ACTIVE --Any HTTP 4xx response<br>or any other HTTP response<br>or non-HTTP error--> STATUS_INACTIVE_PERMANENT
STATUS_INACTIVE_TMP -.After 60s.-> STATUS_ACTIVE_TMP
STATUS_ACTIVE_TMP --HTTP 5xx <br>or HTTP 429 <br>or Timeout <br>within 24h<br>from the first error-->STATUS_INACTIVE_TMP
STATUS_ACTIVE_TMP -.After 24h.-> STATUS_ACTIVE
STATUS_ACTIVE_TMP --HTTP 200 or 201 --> STATUS_ACTIVE_TMP
STATUS_ACTIVE_TMP --HTTP 5xx <br>or HTTP 429 <br>or Timeout <br>within 24h from the first error<br>or any other HTTP response or error--> STATUS_INACTIVE_PERMANENT
ALL ==Activation by user==> STATUS_ACTIVE
ALL ==Deactivation by user==> STATUS_INACTIVE_PERMANENT
ALL ==Removal of endpoint by user==> END
```

Notes:

1. Transitions:
- bold: manual changes by user
- dotted: automated by celery
- others: based on responses on webhooks
1. Nodes:
- Stadium-shaped: Active - following webhook can be sent
- Rectangles: Inactive - performing of webhook will fail (and not retried)
- Hexagonal: Initial and final states
- Rhombus: All states (meta node to make the graph more readable)

## Body and Headers

The body of each request is JSON which contains data about related events like names and IDs of affected elements.
Examples of bodies are on pages related to each event (see below).

Each request contains the following headers. They might be useful for better handling of events by server this process events.

```yaml
User-Agent: DefectDojo-<version of DD>
X-DefectDojo-Event: <name of the event>
X-DefectDojo-Instance: <Base URL for DD instance>
```
## Disclaimer
This functionality is new and in experimental mode. This means Functionality might generate breaking changes in following DefectDojo releases and might not be considered final.
However, the community is open to feedback to make this functionality better and transform it stable as soon as possible.
## Roadmap
There are a couple of known issues that are expected to be implemented as soon as core functionality is considered ready.
- Support events - Not only adding products, product types, engagements, tests, or upload of new scans but also events around SLA
- User webhook - right now only admins can define webhooks; in the future also users will be able to define their own
- Improvement in UI - add filtering and pagination of webhook endpoints
## Events
<!-- Hugo automatically renders list of subpages here -->
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---
title: "Event: engagement_added"
weight: 3
chapter: true
---

## Event HTTP header
```yaml
X-DefectDojo-Event: engagement_added
```
## Event HTTP body
```json
{
"description": null,
"engagement": {
"id": 7,
"name": "notif eng",
"url_api": "http://localhost:8080/api/v2/engagements/7/",
"url_ui": "http://localhost:8080/engagement/7"
},
"product": {
"id": 4,
"name": "notif prod",
"url_api": "http://localhost:8080/api/v2/products/4/",
"url_ui": "http://localhost:8080/product/4"
},
"product_type": {
"id": 4,
"name": "notif prod type",
"url_api": "http://localhost:8080/api/v2/product_types/4/",
"url_ui": "http://localhost:8080/product/type/4"
},
"url_api": "http://localhost:8080/api/v2/engagements/7/",
"url_ui": "http://localhost:8080/engagement/7",
"user": null
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: "Event: product_added"
weight: 2
chapter: true
---

## Event HTTP header
```yaml
X-DefectDojo-Event: product_added
```
## Event HTTP body
```json
{
"description": null,
"product": {
"id": 4,
"name": "notif prod",
"url_api": "http://localhost:8080/api/v2/products/4/",
"url_ui": "http://localhost:8080/product/4"
},
"product_type": {
"id": 4,
"name": "notif prod type",
"url_api": "http://localhost:8080/api/v2/product_types/4/",
"url_ui": "http://localhost:8080/product/type/4"
},
"url_api": "http://localhost:8080/api/v2/products/4/",
"url_ui": "http://localhost:8080/product/4",
"user": null
}
```
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: "Event: product_type_added"
weight: 1
chapter: true
---

## Event HTTP header
```yaml
X-DefectDojo-Event: product_type_added
```
## Event HTTP body
```json
{
"description": null,
"product_type": {
"id": 4,
"name": "notif prod type",
"url_api": "http://localhost:8080/api/v2/product_types/4/",
"url_ui": "http://localhost:8080/product/type/4"
},
"url_api": "http://localhost:8080/api/v2/product_types/4/",
"url_ui": "http://localhost:8080/product/type/4",
"user": null
}
```
Loading

0 comments on commit ef3040a

Please sign in to comment.