Webhook di notifica (Open Source)
Questa è una funzionalità Open Source sperimentale — il comportamento potrebbe cambiare nelle release future.
I webhook sono richieste HTTP in uscita inviate dalla tua istanza DefectDojo a un server definito dall’utente ogni volta che si verificano eventi specifici.
Configurazione
Gli endpoint webhook vengono configurati dagli amministratori. Quando viene creato un webhook, DefectDojo invia un evento ping per verificare che l’endpoint sia raggiungibile e restituisca il codice di stato previsto.
Transizioni di stato dell’endpoint
DefectDojo monitora il successo della consegna e disabiliterà temporaneamente o permanentemente un endpoint in base alle risposte HTTP o ai guasti di rete. È possibile anche la riattivazione manuale da parte di un amministratore.
- Stati a forma di stadio: Active — i webhook possono essere inviati
- Stati rettangolari: Inactive — la consegna del webhook fallirà e non verrà ritentata
- Transizioni guidate da: risposte HTTP dal server di destinazione, automazione celery, o azione manuale dell’amministratore
Header della richiesta
Ogni richiesta webhook include i seguenti header:
User-Agent: DefectDojo-<version>
X-DefectDojo-Event: <event_name>
X-DefectDojo-Instance: <base_url_of_dd_instance>Eventi
product_type_added
Attivato quando viene creato un nuovo Product Type.
Header:
X-DefectDojo-Event: product_type_addedBody:
{
"description": "",
"title": "",
"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": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}product_added
Attivato quando viene creato un nuovo Prodotto.
Header:
X-DefectDojo-Event: product_addedBody:
{
"description": "",
"title": "",
"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": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}engagement_added
Attivato quando viene creato un nuovo Engagement.
Header:
X-DefectDojo-Event: engagement_addedBody:
{
"description": "",
"title": "",
"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": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}test_added
Attivato quando viene creato un nuovo Test.
Header:
X-DefectDojo-Event: test_addedBody:
{
"description": "",
"title": "",
"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"
},
"test": {
"id": 90,
"title": "notif test",
"url_api": "http://localhost:8080/api/v2/tests/90/",
"url_ui": "http://localhost:8080/test/90"
},
"url_api": "http://localhost:8080/api/v2/tests/90/",
"url_ui": "http://localhost:8080/test/90",
"user": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}scan_added / scan_added_empty
Attivato quando una scansione viene importata o reimportata. scan_added_empty si attiva quando una reimportazione non produce alcuna modifica (nessun riscontro creato o chiuso).
Headers:
X-DefectDojo-Event: scan_addedX-DefectDojo-Event: scan_added_emptyBody:
{
"description": "",
"title": "",
"engagement": {
"id": 7,
"name": "notif eng",
"url_api": "http://localhost:8080/api/v2/engagements/7/",
"url_ui": "http://localhost:8080/engagement/7"
},
"finding_count": 4,
"findings": {
"mitigated": [
{
"id": 233,
"severity": "Medium",
"title": "Mitigated Finding",
"url_api": "http://localhost:8080/api/v2/findings/233/",
"url_ui": "http://localhost:8080/finding/233"
}
],
"new": [
{
"id": 232,
"severity": "Critical",
"title": "New Finding",
"url_api": "http://localhost:8080/api/v2/findings/232/",
"url_ui": "http://localhost:8080/finding/232"
}
],
"reactivated": [
{
"id": 234,
"severity": "Low",
"title": "Reactivated Finding",
"url_api": "http://localhost:8080/api/v2/findings/234/",
"url_ui": "http://localhost:8080/finding/234"
}
],
"untouched": [
{
"id": 235,
"severity": "Info",
"title": "Untouched Finding",
"url_api": "http://localhost:8080/api/v2/findings/235/",
"url_ui": "http://localhost:8080/finding/235"
}
]
},
"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"
},
"test": {
"id": 90,
"title": "notif test",
"url_api": "http://localhost:8080/api/v2/tests/90/",
"url_ui": "http://localhost:8080/test/90"
},
"url_api": "http://localhost:8080/api/v2/tests/90/",
"url_ui": "http://localhost:8080/test/90",
"user": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}ping
Inviato durante la configurazione del webhook per verificare che l’endpoint sia raggiungibile.
Header:
X-DefectDojo-Event: pingBody:
{
"description": "Test webhook notification",
"title": "",
"user": {
"id": 1,
"email": "admin@defectdojo.local",
"first_name": "Admin",
"last_name": "User",
"username": "admin",
"url_api": "http://localhost:8080/api/v2/users/1/",
"url_ui": "http://localhost:8080/user/1"
}
}Roadmap
Miglioramenti pianificati noti:
- Eventi relativi agli SLA (non ancora supportati)
- Webhook definiti dall’utente (attualmente solo per amministratori)
- UI migliorata con filtri e paginazione per gli endpoint webhook