Use webhooks to further automate your security posture
Prerequisites
Because we will be working with and understanding webhooks we will need a few tools.
- A basic understanding of Webhooks. Refer to this article to setup webhooks in vRx
- You will need to set up an API key within vRx. Please take a look at this article for instructions on configuring an API key.
- Install postman or another API or any other RESTapi tool.
- Configure Postman to use your API Key. Refer to this article for instructions.
- Configure a webhook listener. If you do not have one webhook.site will work.
How it works
vRx can send webhooks when specific events happen. These events include when tasks are complete or when an incidentevent takes place (Detected Vulnerability or Removed Endpoint, etc.).
- A new CVE is released - vRx Detects a vulnerability in your environment.
- vRx logs this detection as an event
- A "incidentEventIncidentEventType": "DetectedVulnerability" event is sent to all configured webhooks, including all the event details. The data is delivered in JSON format.
Getting the data you want out of the webhook.
Many Webhook listeners and automation platforms require that you provide sample data or send a webhook to be able to filter for the data you want. There are a few ways the data can be sent so the automation can be configured:
- Perform the task or action in vRx
While this option is easiest, it is only sometimes practical.- This is the easiest method though it can take longer
- Once you have configured the webhook, Perform the action in vRx for which you want the webhook data.
- For example, If you would like to receive an email alert when a task completes with a status failed, Run an auto-action task and wait for the task to finish. When the task completes, you will receive a webhook and be able to filter by the Action Status.
- Query the API for the data, then send it to the webhook as a sample.
This option requires a bit of work to accomplish but ultimately can be faster than waiting for a specific set of events to happen.- Once you have configured the webhook, query the API, clean up the data, then send it to the webhook
- For example, If you want to receive alerts based on detected vulnerabilities, You will query the API using an API tool like postman. Remove the serverObject headers from the body, then post the results to the webhook using postman.
For a step-by-step guide, refer to the Advanced webhook tutorial.
Note: Not all webhooks include all data. Getting the correct data may take some trial and error. If you need help, please reach out to your Customer Success Engineer.
Basic Webhook Tutorial
- Refer to this article for a Basic webhook Guide
Advanced Webhook tutorial
- Follow the steps in the Basic webhook tutorial to configure the webhook
- Setup Postman to query the API
- In this example, we will query the Incident Event Controller
- Create a new Get request in Postman
- Set the URL to https://<your-dashboard>.vicarius.cloud/vicarius-external-data-api/incidentEvent/filter?from=0&size=1
- Send the API Get request
- Copy the result to a text editor like notepad
- Delete the opening {, the ServerResponseResult, and the beginning of the ServerResponseObject
- It will look like this when you have deleted the right section
- Delete the closing } and ] from the end of the file
- It will look like this when you have deleted the right section
- Copy the JSON text
- Go back to postman, Create a new post request
- Enter the webhook URL in the post request and paste the modified JSON text in the body
- Send the request
- You will see the JSON data in the webhook listener