List vulnerabilities
https://api.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.us3.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.us5.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.datadoghq.eu/api/v2/security/vulnerabilitieshttps://api.ap1.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.ap2.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.uk1.datadoghq.com/api/v2/security/vulnerabilitieshttps://api.ddog-gov.com/api/v2/security/vulnerabilitieshttps://api.us2.ddog-gov.com/api/v2/security/vulnerabilitiesOverview
Get a list of vulnerabilities.
Pagination
Pagination is enabled by default in both vulnerabilities and assets. The size of the page varies depending on the endpoint and cannot be modified. To automate the request of the next page, you can use the links section in the response.
This endpoint will return paginated responses. The pages are stored in the links section of the response:
{
"data": [...],
"meta": {...},
"links": {
"self": "https://.../api/v2/security/vulnerabilities",
"first": "https://.../api/v2/security/vulnerabilities?page[number]=1&page[token]=abc",
"last": "https://.../api/v2/security/vulnerabilities?page[number]=43&page[token]=abc",
"next": "https://.../api/v2/security/vulnerabilities?page[number]=2&page[token]=abc"
}
}
links.previousis empty if the first page is requested.links.nextis empty if the last page is requested.
Token
Vulnerabilities can be created, updated or deleted at any point in time.
Upon the first request, a token is created to ensure consistency across subsequent paginated requests.
A token is valid only for 24 hours.
First request
We consider a request to be the first request when there is no page[token] parameter.
The response of this first request contains the newly created token in the links section.
This token can then be used in the subsequent paginated requests.
Note: The first request may take longer to complete than subsequent requests.
Subsequent requests
Any request containing valid page[token] and page[number] parameters will be considered a subsequent request.
If the token is invalid, a 404 response will be returned.
If the page number is invalid, a 400 response will be returned.
The returned token is valid for all requests in the pagination sequence. To send paginated requests in parallel, reuse the same token and change only the page[number] parameter.
Filtering
The request can include some filter parameters to filter the data to be retrieved. The format of the filter parameters follows the JSON:API format: filter[$prop_name], where prop_name is the property name in the entity being filtered by.
All filters can include multiple values, where data will be filtered with an OR clause: filter[title]=Title1,Title2 will filter all vulnerabilities where title is equal to Title1 OR Title2.
String filters are case sensitive.
Boolean filters accept true or false as values.
Number filters must include an operator as a second filter input: filter[$prop_name][$operator]. For example, for the vulnerabilities endpoint: filter[cvss.base.score][lte]=8.
Available operators are: eq (==), lt (<), lte (<=), gt (>) and gte (>=).
Metadata
Following JSON:API format, object including non-standard meta-information.
This endpoint includes the meta member in the response. For more details on each of the properties included in this section, check the endpoints response tables.
{
"data": [...],
"meta": {
"total": 1500,
"count": 18732,
"token": "some_token"
},
"links": {...}
}
Extensions
Requests may include extensions to modify the behavior of the requested endpoint. The filter parameters follow the JSON:API format format: ext:$extension_name, where extension_name is the name of the modifier that is being applied.
Extensions can only include one value: ext:modifier=value.
Arguments
Query Strings
page[token]Its value must come from the links section of the response of the first request. Do not manually edit it.
page[number]The page number to be retrieved. It should be equal or greater than 1
filter[type]Filter by vulnerability type.
AdminConsoleActive, CodeInjection, CommandInjection, ComponentWithKnownVulnerability, DangerousWorkflows, DefaultAppDeployed, DefaultHtmlEscapeInvalid, DirectoryListingLeak, EmailHtmlInjection, EndOfLifeShow 34 more
HardcodedPassword, HardcodedSecret, HeaderInjection, HstsHeaderMissing, InsecureAuthProtocol, InsecureCookie, InsecureJspLayout, LdapInjection, MaliciousPackage, MandatoryRemediation, NoHttpOnlyCookie, NoSameSiteCookie, NoSqlMongoDbInjection, PathTraversal, ReflectionInjection, RiskyLicense, SessionRewriting, SessionRewritting, SessionTimeout, SqlInjection, Ssrf, StackTraceLeak, TemplateInjection, TrustBoundaryViolation, Unmaintained, UntrustedDeserialization, UnvalidatedRedirect, VerbTampering, WeakCipher, WeakHash, WeakRandomness, XContentTypeHeaderMissing, XPathInjection, Xssfilter[cvss.base.score][`$op`]Filter by vulnerability base (i.e. from the original advisory) severity score.
filter[cvss.base.severity]Filter by vulnerability base severity.
Unknown, None, Low, Medium, High, Criticalfilter[cvss.base.vector]Filter by vulnerability base CVSS vector.
filter[cvss.datadog.score][`$op`]Filter by vulnerability Datadog severity score.
filter[cvss.datadog.severity]Filter by vulnerability Datadog severity.
Unknown, None, Low, Medium, High, Criticalfilter[cvss.datadog.vector]Filter by vulnerability Datadog CVSS vector.
filter[status]Filter by the status of the vulnerability.
Open, Muted, Remediated, InProgress, AutoClosedfilter[tool]Filter by the tool of the vulnerability.
IAST, SCA, Infra, SASTfilter[library.name]Filter by library name.
filter[library.version]Filter by library version.
filter[advisory.id]Filter by advisory ID.
filter[risks.exploitation_probability]Filter by exploitation probability.
filter[risks.poc_exploit_available]Filter by POC exploit availability.
filter[risks.exploit_available]Filter by public exploit availability.
filter[risks.epss.severity]Filter by vulnerability EPSS severity.
Unknown, None, Low, Medium, High, Criticalfilter[language]Filter by language.
filter[ecosystem]Filter by ecosystem.
PyPI, Maven, NuGet, Npm, RubyGems, Go, Packagist, Deb, Rpm, ApkShow 6 more
Windows, Generic, MacOs, Oci, BottleRocket, Nonefilter[code_location.location]Filter by vulnerability location.
filter[code_location.file_path]Filter by vulnerability file path.
filter[code_location.method]Filter by method.
filter[fix_available]Filter by fix availability.
filter[repo_digests]Filter by vulnerability repo_digest (when the vulnerability is related to Image asset).
filter[origin]Filter by origin.
filter[running_kernel]Filter for whether the vulnerability affects a running kernel (for vulnerabilities related to a Host asset).
filter[asset.name]Filter by asset name. This field supports the usage of wildcards (*).
filter[asset.type]Filter by asset type.
Repository, Service, Host, HostImage, Image, ServerlessFunctionfilter[asset.version.first]Filter by the first version of the asset this vulnerability has been detected on.
filter[asset.version.last]Filter by the last version of the asset this vulnerability has been detected on.
filter[asset.repository_url]Filter by the repository url associated to the asset.
filter[asset.risks.in_production]Filter whether the asset is in production or not.
filter[asset.risks.under_attack]Filter whether the asset is under attack or not.
filter[asset.risks.is_publicly_accessible]Filter whether the asset is publicly accessible or not.
filter[asset.risks.has_privileged_access]Filter whether the asset is publicly accessible or not.
filter[asset.risks.has_access_to_sensitive_data]Filter whether the asset has access to sensitive data or not.
filter[asset.environments]Filter by asset environments.
filter[asset.teams]Filter by asset teams.
filter[asset.arch]Filter by asset architecture.
filter[asset.operating_system.name]Filter by asset operating system name.
filter[asset.operating_system.version]Filter by asset operating system version.
Response
OK
The expected response schema when listing vulnerabilities.
data [required]List of vulnerabilities.
attributes [required]The JSON:API attributes of the vulnerability.
advisoryAdvisory associated with the vulnerability.
id [required]Vulnerability advisory ID.
last_modification_dateVulnerability advisory last modification date.
publish_dateVulnerability advisory publish date.
advisory_idVulnerability advisory ID.
code_locationCode vulnerability location.
file_pathVulnerability location file path.
location [required]Vulnerability extracted location.
methodVulnerability location method.
cve_list [required]Vulnerability CVE list.
cvss [required]Vulnerability severities.
base [required]Vulnerability severity.
score [required]Vulnerability severity score.
severity [required]The vulnerability severity.
Unknown, None, Low, Medium, High, Criticalvector [required]Vulnerability CVSS vector.
datadog [required]Vulnerability severity.
score [required]Vulnerability severity score.
severity [required]The vulnerability severity.
Unknown, None, Low, Medium, High, Criticalvector [required]Vulnerability CVSS vector.
dependency_locationsStatic library vulnerability location.
block [required]Static library vulnerability location.
column_end [required]Location column end.
column_start [required]Location column start.
file_name [required]Location file name.
line_end [required]Location line end.
line_start [required]Location line start.
nameStatic library vulnerability location.
column_end [required]Location column end.
column_start [required]Location column start.
file_name [required]Location file name.
line_end [required]Location line end.
line_start [required]Location line start.
versionStatic library vulnerability location.
column_end [required]Location column end.
column_start [required]Location column start.
file_name [required]Location file name.
line_end [required]Location line end.
line_start [required]Location line start.
description [required]Vulnerability description.
ecosystemThe related vulnerability asset ecosystem.
PyPI, Maven, NuGet, Npm, RubyGems, Go, Packagist, Deb, Rpm, ApkShow 6 more
Windows, Generic, MacOs, Oci, BottleRocket, Noneexposure_time [required]Vulnerability exposure time in seconds.
fix_available [required]Whether the vulnerability has a remediation or not.
language [required]Vulnerability language.
libraryVulnerability library.
additional_namesRelated library or package names (such as child packages or affected binary paths).
name [required]Vulnerability library name.
versionVulnerability library version.
origin [required]Vulnerability origin.
remediations [required]List of remediations.
auto_solvable [required]Whether the vulnerability can be resolved when recompiling the package or not.
avoided_advisories [required]Avoided advisories.
base_severity [required]Advisory base severity.
id [required]Advisory id.
severityAdvisory Datadog severity.
fixed_advisories [required]Remediation fixed advisories.
base_severity [required]Advisory base severity.
id [required]Advisory id.
severityAdvisory Datadog severity.
library_name [required]Library name remediating the vulnerability.
library_version [required]Library version remediating the vulnerability.
new_advisories [required]New advisories.
base_severity [required]Advisory base severity.
id [required]Advisory id.
severityAdvisory Datadog severity.
remaining_advisories [required]Remaining advisories.
base_severity [required]Advisory base severity.
id [required]Advisory id.
severityAdvisory Datadog severity.
type [required]Remediation type.
repo_digestsVulnerability repo_digest list (when the vulnerability is related to Image asset).
risks [required]Vulnerability risks.
epssVulnerability EPSS severity.
score [required]Vulnerability EPSS severity score.
severity [required]The vulnerability severity.
Unknown, None, Low, Medium, High, Criticalexploit_available [required]Vulnerability public exploit availability.
exploit_sources [required]Vulnerability exploit sources.
exploitation_probability [required]Vulnerability exploitation probability.
poc_exploit_available [required]Vulnerability POC exploit availability.
running_kernelTrue if the vulnerability affects a package in the host’s running kernel, false if it affects a non-running kernel, and omit if it is not kernel-related.
status [required]The vulnerability status.
Open, Muted, Remediated, InProgress, AutoClosedtitle [required]Vulnerability title.
tool [required]The vulnerability tool.
IAST, SCA, Infra, SASTtype [required]The vulnerability type.
AdminConsoleActive, CodeInjection, CommandInjection, ComponentWithKnownVulnerability, DangerousWorkflows, DefaultAppDeployed, DefaultHtmlEscapeInvalid, DirectoryListingLeak, EmailHtmlInjection, EndOfLifeShow 34 more
HardcodedPassword, HardcodedSecret, HeaderInjection, HstsHeaderMissing, InsecureAuthProtocol, InsecureCookie, InsecureJspLayout, LdapInjection, MaliciousPackage, MandatoryRemediation, NoHttpOnlyCookie, NoSameSiteCookie, NoSqlMongoDbInjection, PathTraversal, ReflectionInjection, RiskyLicense, SessionRewriting, SessionRewritting, SessionTimeout, SqlInjection, Ssrf, StackTraceLeak, TemplateInjection, TrustBoundaryViolation, Unmaintained, UntrustedDeserialization, UnvalidatedRedirect, VerbTampering, WeakCipher, WeakHash, WeakRandomness, XContentTypeHeaderMissing, XPathInjection, Xssid [required]The unique ID for this vulnerability.
relationships [required]Related entities object.
affects [required]Relationship type.
data [required]Asset affected by this vulnerability.
id [required]The unique ID for this related asset.
type [required]The JSON:API type.
assetstype [required]The JSON:API type.
vulnerabilitieslinksThe JSON:API links related to pagination.
first [required]First page link.
last [required]Last page link.
nextNext page link.
previousPrevious page link.
self [required]Request link.
metaThe metadata related to this request.
count [required]Number of entities included in the response.
token [required]The token that identifies the request.
total [required]Total number of entities across all pages.
{
"data": [
{
"attributes": {
"advisory": {
"id": "TRIVY-CVE-2023-0615",
"last_modification_date": "2024-09-19 21:23:08+00:00",
"publish_date": "2024-09-19 21:23:08+00:00"
},
"advisory_id": "TRIVY-CVE-2023-0615",
"code_location": {
"file_path": "src/Class.java:100",
"location": "com.example.Class:100",
"method": "FooBar"
},
"cve_list": [
"CVE-2023-0615"
],
"cvss": {
"base": {
"score": 4.5,
"severity": "Medium",
"vector": "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
},
"datadog": {
"score": 4.5,
"severity": "Medium",
"vector": "CVSS:3.0/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H"
}
},
"dependency_locations": {
"block": {
"column_end": 140,
"column_start": 5,
"file_name": "src/go.mod",
"line_end": 10,
"line_start": 1
},
"name": {
"column_end": 140,
"column_start": 5,
"file_name": "src/go.mod",
"line_end": 10,
"line_start": 1
},
"version": {
"column_end": 140,
"column_start": 5,
"file_name": "src/go.mod",
"line_end": 10,
"line_start": 1
}
},
"description": "LDAP Injection is a security vulnerability that occurs when untrusted user input is improperly handled and directly incorporated into LDAP queries without appropriate sanitization or validation. This vulnerability enables attackers to manipulate LDAP queries and potentially gain unauthorized access, modify data, or extract sensitive information from the directory server. By exploiting the LDAP injection vulnerability, attackers can execute malicious commands, bypass authentication mechanisms, and perform unauthorized actions within the directory service.",
"ecosystem": "string",
"exposure_time": 5618604,
"first_detection": "2024-09-19 21:23:08+00:00",
"fix_available": false,
"language": "ubuntu",
"last_detection": "2024-09-01 21:23:08+00:00",
"library": {
"additional_names": [
"linux-tools-common"
],
"name": "linux-aws-5.15",
"version": "5.15.0"
},
"origin": [
"agentless-scanner"
],
"remediations": [
{
"auto_solvable": false,
"avoided_advisories": [
{
"base_severity": "Critical",
"id": "GHSA-4wrc-f8pq-fpqp",
"severity": "Medium"
}
],
"fixed_advisories": [
{
"base_severity": "Critical",
"id": "GHSA-4wrc-f8pq-fpqp",
"severity": "Medium"
}
],
"library_name": "stdlib",
"library_version": "Upgrade to a version >= 1.20.0",
"new_advisories": [
{
"base_severity": "Critical",
"id": "GHSA-4wrc-f8pq-fpqp",
"severity": "Medium"
}
],
"remaining_advisories": [
{
"base_severity": "Critical",
"id": "GHSA-4wrc-f8pq-fpqp",
"severity": "Medium"
}
],
"type": "text"
}
],
"repo_digests": [
"sha256:0ae7da091191787229d321e3638e39c319a97d6e20f927d465b519d699215bf7"
],
"risks": {
"epss": {
"score": 0.2,
"severity": "Medium"
},
"exploit_available": false,
"exploit_sources": [
"NIST"
],
"exploitation_probability": false,
"poc_exploit_available": false
},
"running_kernel": true,
"status": "Open",
"title": "LDAP Injection",
"tool": "SCA",
"type": "WeakCipher"
},
"id": "3ecdfea798f2ce8f6e964805a344945f",
"relationships": {
"affects": {
"data": {
"id": "Repository|github.com/DataDog/datadog-agent.git",
"type": "assets"
}
}
},
"type": "vulnerabilities"
}
],
"links": {
"first": "https://api.datadoghq.com/api/v2/security/vulnerabilities?page%5Bnumber%5D=1&page%5Btoken%5D=b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4",
"last": "https://api.datadoghq.com/api/v2/security/vulnerabilities?page%5Bnumber%5D=15&page%5Btoken%5D=b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4",
"next": "https://api.datadoghq.com/api/v2/security/vulnerabilities?page%5Bnumber%5D=16&page%5Btoken%5D=b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4",
"previous": "https://api.datadoghq.com/api/v2/security/vulnerabilities?page%5Bnumber%5D=14&page%5Btoken%5D=b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4",
"self": "https://api.datadoghq.com/api/v2/security/vulnerabilities?filter%5Btool%5D=Infra"
},
"meta": {
"count": 150,
"token": "b82cef018aab81ed1d4bb4xb35xxfc065da7efa685fbcecdbd338f3015e3afabbbfa3a911b4984_721ee28a-zecb-4e45-9960-c42065b574f4",
"total": 152431
}
}Bad request: The server cannot process the request due to invalid syntax in the request.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Forbidden: Access denied
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Not found: There is no request associated with the provided token.
API error response.
errors [required]A list of errors.
detailA human-readable explanation specific to this occurrence of the error.
metaNon-standard meta-information about the error
sourceReferences to the source of the error.
headerA string indicating the name of a single request header which caused the error.
parameterA string indicating which URI query parameter caused the error.
pointerA JSON pointer to the value in the request document that caused the error.
statusStatus code of the response.
titleShort human-readable summary of the error.
{
"errors": [
{
"detail": "Missing required attribute in body",
"meta": {},
"source": {
"header": "Authorization",
"parameter": "limit",
"pointer": "/data/attributes/title"
},
"status": "400",
"title": "Bad Request"
}
]
}Too many requests
API error response.
errors [required]A list of errors.
{
"errors": [
"Bad Request"
]
}Code Example
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="us3.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="us5.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="datadoghq.eu"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="ap1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="ap2.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="uk1.datadoghq.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"# Set your Datadog site and credentials
export DD_SITE="us2.ddog-gov.com"
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"
curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"// List vulnerabilities returns "OK" response
package main
import (
"context"
"encoding/json"
"fmt"
"os"
"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)
func main() {
ctx := datadog.NewDefaultContext(context.Background())
ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
configuration := datadog.NewConfiguration()
configuration.SetUnstableOperationEnabled("v2.ListVulnerabilities", true)
apiClient := datadog.NewAPIClient(configuration)
api := datadogV2.NewSecurityMonitoringApi(apiClient)
resp, r, err := api.ListVulnerabilities(ctx, *datadogV2.NewListVulnerabilitiesOptionalParameters().WithFilterCvssBaseSeverity(datadogV2.VULNERABILITYSEVERITY_HIGH).WithFilterAssetType(datadogV2.ASSETTYPE_SERVICE).WithFilterTool(datadogV2.VULNERABILITYTOOL_INFRA))
if err != nil {
fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ListVulnerabilities`: %v\n", err)
fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
}
responseContent, _ := json.MarshalIndent(resp, "", " ")
fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.ListVulnerabilities`:\n%s\n", responseContent)
}
Instructions
First install the library and its dependencies and then save the example to main.go and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"// List vulnerabilities returns "OK" response
import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.api.SecurityMonitoringApi.ListVulnerabilitiesOptionalParameters;
import com.datadog.api.client.v2.model.AssetType;
import com.datadog.api.client.v2.model.ListVulnerabilitiesResponse;
import com.datadog.api.client.v2.model.VulnerabilitySeverity;
import com.datadog.api.client.v2.model.VulnerabilityTool;
public class Example {
public static void main(String[] args) {
ApiClient defaultClient = ApiClient.getDefaultApiClient();
defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
defaultClient.setUnstableOperationEnabled("v2.listVulnerabilities", true);
SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
try {
ListVulnerabilitiesResponse result =
apiInstance.listVulnerabilities(
new ListVulnerabilitiesOptionalParameters()
.filterCvssBaseSeverity(VulnerabilitySeverity.HIGH)
.filterAssetType(AssetType.SERVICE)
.filterTool(VulnerabilityTool.INFRA));
System.out.println(result);
} catch (ApiException e) {
System.err.println("Exception when calling SecurityMonitoringApi#listVulnerabilities");
System.err.println("Status code: " + e.getCode());
System.err.println("Reason: " + e.getResponseBody());
System.err.println("Response headers: " + e.getResponseHeaders());
e.printStackTrace();
}
}
}
Instructions
First install the library and its dependencies and then save the example to Example.java and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java""""
List vulnerabilities returns "OK" response
"""
from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.asset_type import AssetType
from datadog_api_client.v2.model.vulnerability_severity import VulnerabilitySeverity
from datadog_api_client.v2.model.vulnerability_tool import VulnerabilityTool
configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["list_vulnerabilities"] = True
with ApiClient(configuration) as api_client:
api_instance = SecurityMonitoringApi(api_client)
response = api_instance.list_vulnerabilities(
filter_cvss_base_severity=VulnerabilitySeverity.HIGH,
filter_tool=VulnerabilityTool.INFRA,
filter_asset_type=AssetType.SERVICE,
)
print(response)
Instructions
First install the library and its dependencies and then save the example to example.py and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"# List vulnerabilities returns "OK" response
require "datadog_api_client"
DatadogAPIClient.configure do |config|
config.access_token = ENV["DD_BEARER_TOKEN"]
config.unstable_operations["v2.list_vulnerabilities".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
opts = {
filter_cvss_base_severity: VulnerabilitySeverity::HIGH,
filter_asset_type: AssetType::SERVICE,
filter_tool: VulnerabilityTool::INFRA,
}
p api_instance.list_vulnerabilities(opts)
Instructions
First install the library and its dependencies and then save the example to example.rb and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"// List vulnerabilities returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::ListVulnerabilitiesOptionalParams;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::AssetType;
use datadog_api_client::datadogV2::model::VulnerabilitySeverity;
use datadog_api_client::datadogV2::model::VulnerabilityTool;
#[tokio::main]
async fn main() {
let mut configuration = datadog::Configuration::new();
configuration.set_unstable_operation_enabled("v2.list_vulnerabilities", true);
let api = SecurityMonitoringAPI::with_config(configuration);
let resp = api
.list_vulnerabilities(
ListVulnerabilitiesOptionalParams::default()
.filter_cvss_base_severity(VulnerabilitySeverity::HIGH)
.filter_asset_type(AssetType::SERVICE)
.filter_tool(VulnerabilityTool::INFRA),
)
.await;
if let Ok(value) = resp {
println!("{:#?}", value);
} else {
println!("{:#?}", resp.unwrap_err());
}
}
Instructions
First install the library and its dependencies and then save the example to src/main.rs and run following commands:
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us3.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us5.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="datadoghq.eu" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ap2.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="uk1.datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo runDD_SITE="us2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run/**
* List vulnerabilities returns "OK" response
*/
import { client, v2 } from "@datadog/datadog-api-client";
const configuration = client.createConfiguration({
authMethods: {
AuthZ: {
accessToken: process.env.DD_BEARER_TOKEN as string,
},
},
});
configuration.unstableOperations["v2.listVulnerabilities"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);
const params: v2.SecurityMonitoringApiListVulnerabilitiesRequest = {
filterCvssBaseSeverity: "High",
filterTool: "Infra",
filterAssetType: "Service",
};
apiInstance
.listVulnerabilities(params)
.then((data: v2.ListVulnerabilitiesResponse) => {
console.log(
"API called successfully. Returned data: " + JSON.stringify(data)
);
})
.catch((error: any) => console.error(error));
Instructions
First install the library and its dependencies and then save the example to example.ts and run following commands:
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us3.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us5.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="datadoghq.eu" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ap2.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="uk1.datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"DD_SITE="us2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"