Skip to content
This repository has been archived by the owner on Nov 1, 2023. It is now read-only.

add crash_report_created webhook event #392

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
280 changes: 280 additions & 0 deletions docs/webhook_events.md
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,164 @@ Each event will be submitted via HTTP POST to the user provided URL.
}
```

### crash_report_created

#### Example

```json
{
"container": "container-name",
"filename": "example.json",
"report": {
"input_blob": {
"account": "contoso-storage-account",
"container": "crashes",
"name": "input.txt"
},
"executable": "fuzz.exe",
"crash_type": "example crash report type",
"crash_site": "example crash site",
"call_stack": [
"#0 line",
"#1 line",
"#2 line"
],
"call_stack_sha256": "0000000000000000000000000000000000000000000000000000000000000000",
"input_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
"asan_log": "example asan log",
"task_id": "00000000-0000-0000-0000-000000000000",
"job_id": "00000000-0000-0000-0000-000000000000",
"scariness_score": 10,
"scariness_description": "example-scariness"
}
}
```

#### Schema

```json
{
"title": "WebhookEventCrashReportCreated",
"type": "object",
"properties": {
"container": {
"title": "Container",
"type": "string"
},
"filename": {
"title": "Filename",
"type": "string"
},
"report": {
"$ref": "#/definitions/Report"
}
},
"required": [
"container",
"filename",
"report"
],
"definitions": {
"BlobRef": {
"title": "BlobRef",
"type": "object",
"properties": {
"account": {
"title": "Account",
"type": "string"
},
"container": {
"title": "Container",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"account",
"container",
"name"
]
},
"Report": {
"title": "Report",
"type": "object",
"properties": {
"input_url": {
"title": "Input Url",
"type": "string"
},
"input_blob": {
"$ref": "#/definitions/BlobRef"
},
"executable": {
"title": "Executable",
"type": "string"
},
"crash_type": {
"title": "Crash Type",
"type": "string"
},
"crash_site": {
"title": "Crash Site",
"type": "string"
},
"call_stack": {
"title": "Call Stack",
"type": "array",
"items": {
"type": "string"
}
},
"call_stack_sha256": {
"title": "Call Stack Sha256",
"type": "string"
},
"input_sha256": {
"title": "Input Sha256",
"type": "string"
},
"asan_log": {
"title": "Asan Log",
"type": "string"
},
"task_id": {
"title": "Task Id",
"type": "string",
"format": "uuid"
},
"job_id": {
"title": "Job Id",
"type": "string",
"format": "uuid"
},
"scariness_score": {
"title": "Scariness Score",
"type": "integer"
},
"scariness_description": {
"title": "Scariness Description",
"type": "string"
}
},
"required": [
"input_blob",
"executable",
"crash_type",
"crash_site",
"call_stack",
"call_stack_sha256",
"input_sha256",
"task_id",
"job_id"
]
}
}
}
```

### ping

#### Example
Expand Down Expand Up @@ -696,6 +854,9 @@ Each event will be submitted via HTTP POST to the user provided URL.
},
{
"$ref": "#/definitions/WebhookEventPing"
},
{
"$ref": "#/definitions/WebhookEventCrashReportCreated"
}
]
}
Expand All @@ -713,6 +874,7 @@ Each event will be submitted via HTTP POST to the user provided URL.
"task_created",
"task_stopped",
"task_failed",
"crash_report_created",
"ping"
]
},
Expand Down Expand Up @@ -1194,6 +1356,124 @@ Each event will be submitted via HTTP POST to the user provided URL.
"format": "uuid"
}
}
},
"BlobRef": {
"title": "BlobRef",
"type": "object",
"properties": {
"account": {
"title": "Account",
"type": "string"
},
"container": {
"title": "Container",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"account",
"container",
"name"
]
},
"Report": {
"title": "Report",
"type": "object",
"properties": {
"input_url": {
"title": "Input Url",
"type": "string"
},
"input_blob": {
"$ref": "#/definitions/BlobRef"
},
"executable": {
"title": "Executable",
"type": "string"
},
"crash_type": {
"title": "Crash Type",
"type": "string"
},
"crash_site": {
"title": "Crash Site",
"type": "string"
},
"call_stack": {
"title": "Call Stack",
"type": "array",
"items": {
"type": "string"
}
},
"call_stack_sha256": {
"title": "Call Stack Sha256",
"type": "string"
},
"input_sha256": {
"title": "Input Sha256",
"type": "string"
},
"asan_log": {
"title": "Asan Log",
"type": "string"
},
"task_id": {
"title": "Task Id",
"type": "string",
"format": "uuid"
},
"job_id": {
"title": "Job Id",
"type": "string",
"format": "uuid"
},
"scariness_score": {
"title": "Scariness Score",
"type": "integer"
},
"scariness_description": {
"title": "Scariness Description",
"type": "string"
}
},
"required": [
"input_blob",
"executable",
"crash_type",
"crash_site",
"call_stack",
"call_stack_sha256",
"input_sha256",
"task_id",
"job_id"
]
},
"WebhookEventCrashReportCreated": {
"title": "WebhookEventCrashReportCreated",
"type": "object",
"properties": {
"container": {
"title": "Container",
"type": "string"
},
"filename": {
"title": "Filename",
"type": "string"
},
"report": {
"$ref": "#/definitions/Report"
}
},
"required": [
"container",
"filename",
"report"
]
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions src/api-service/__app__/onefuzzlib/notifications/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
TeamsTemplate,
)
from onefuzztypes.primitives import Container, Event
from onefuzztypes.webhooks import WebhookEventCrashReportCreated

from ..azure.containers import (
StorageType,
Expand All @@ -32,6 +33,7 @@
from ..reports import get_report
from ..tasks.config import get_input_container_queues
from ..tasks.main import Task
from ..webhooks import Webhook
from .ado import notify_ado
from .github_issues import github_issue
from .teams import notify_teams
Expand Down Expand Up @@ -126,6 +128,12 @@ def new_files(container: Container, filename: str) -> None:
results["job_id"] = report.job_id
results["task_id"] = report.task_id

Webhook.send_event(
WebhookEventCrashReportCreated(
container=container, filename=filename, report=report
)
)

logging.info("notifications for %s %s %s", container, filename, notifications)
done = []
for notification in notifications:
Expand Down
Loading