Skip to content

Commit 3df6b6a

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Added new optional field definition to include more detail in findings for '/api/v2/posture_management/findings' (#2245)
Co-authored-by: ci.datadog-api-spec <[email protected]>
1 parent 007a4e6 commit 3df6b6a

File tree

9 files changed

+198
-11
lines changed

9 files changed

+198
-11
lines changed

.apigentools-info

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
"spec_versions": {
55
"v1": {
66
"apigentools_version": "1.6.6",
7-
"regenerated": "2025-06-05 08:11:19.271303",
8-
"spec_repo_commit": "0e7259ca"
7+
"regenerated": "2025-06-05 09:49:40.724881",
8+
"spec_repo_commit": "faa72400"
99
},
1010
"v2": {
1111
"apigentools_version": "1.6.6",
12-
"regenerated": "2025-06-05 08:11:19.287369",
13-
"spec_repo_commit": "0e7259ca"
12+
"regenerated": "2025-06-05 09:49:40.740637",
13+
"spec_repo_commit": "faa72400"
1414
}
1515
}
1616
}

.generator/schemas/v2/openapi.yaml

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15279,10 +15279,16 @@ components:
1527915279
FindingAttributes:
1528015280
description: The JSON:API attributes of the finding.
1528115281
properties:
15282+
datadog_link:
15283+
$ref: '#/components/schemas/FindingDatadogLink'
15284+
description:
15285+
$ref: '#/components/schemas/FindingDescription'
1528215286
evaluation:
1528315287
$ref: '#/components/schemas/FindingEvaluation'
1528415288
evaluation_changed_at:
1528515289
$ref: '#/components/schemas/FindingEvaluationChangedAt'
15290+
external_id:
15291+
$ref: '#/components/schemas/FindingExternalId'
1528615292
mute:
1528715293
$ref: '#/components/schemas/FindingMute'
1528815294
resource:
@@ -15300,6 +15306,22 @@ components:
1530015306
vulnerability_type:
1530115307
$ref: '#/components/schemas/FindingVulnerabilityType'
1530215308
type: object
15309+
FindingDatadogLink:
15310+
description: The Datadog relative link for this finding.
15311+
example: /security/compliance?panels=cpfinding%7Cevent%7CruleId%3Adef-000-u5t%7CresourceId%3Ae8c9ab7c52ebd7bf2fdb4db641082d7d%7CtabId%3Aoverview
15312+
type: string
15313+
FindingDescription:
15314+
description: The description and remediation steps for this finding.
15315+
example: '## Remediation
15316+
15317+
15318+
1. In the console, go to **Storage Account**.
15319+
15320+
2. For each Storage Account, navigate to **Data Protection**.
15321+
15322+
3. Select **Set soft delete enabled** and enter the number of days to retain
15323+
soft deleted data.'
15324+
type: string
1530315325
FindingEvaluation:
1530415326
description: The evaluation of the finding.
1530515327
enum:
@@ -15317,6 +15339,10 @@ components:
1531715339
format: int64
1531815340
minimum: 1
1531915341
type: integer
15342+
FindingExternalId:
15343+
description: The cloud-based ID for the resource related to the finding.
15344+
example: arn:aws:s3:::my-example-bucket
15345+
type: string
1532015346
FindingID:
1532115347
description: The unique ID for this finding.
1532215348
example: ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==
@@ -53082,13 +53108,19 @@ paths:
5308253108
the equal sign: `filter[evaluation_changed_at]=>=1678809373257`.\n\nQuery
5308353109
parameters must be only among the documented ones and with values of correct
5308453110
types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`)
53085-
are not allowed.\n\n### Response\n\nThe response includes an array of finding
53086-
objects, pagination metadata, and a count of items that match the query.\n\nEach
53087-
finding object contains the following:\n\n- The finding ID that can be used
53088-
in a `GetFinding` request to retrieve the full finding details.\n- Core attributes,
53089-
including status, evaluation, high-level resource details, muted state, and
53090-
rule details.\n- `evaluation_changed_at` and `resource_discovery_date` time
53091-
stamps.\n- An array of associated tags.\n"
53111+
are not allowed.\n\n### Additional extension fields\n\nAdditional extension
53112+
fields are available for some findings.\n\nThe data is available when you
53113+
include the query parameter `?detailed_findings=true` in the request.\n\nThe
53114+
following fields are available for findings:\n- `external_id`: The resource
53115+
external ID related to the finding.\n- `description`: The description and
53116+
remediation steps for the finding.\n- `datadog_link`: The Datadog relative
53117+
link for the finding.\n\n### Response\n\nThe response includes an array of
53118+
finding objects, pagination metadata, and a count of items that match the
53119+
query.\n\nEach finding object contains the following:\n\n- The finding ID
53120+
that can be used in a `GetFinding` request to retrieve the full finding details.\n-
53121+
Core attributes, including status, evaluation, high-level resource details,
53122+
muted state, and rule details.\n- `evaluation_changed_at` and `resource_discovery_date`
53123+
time stamps.\n- An array of associated tags.\n"
5309253124
operationId: ListFindings
5309353125
parameters:
5309453126
- description: Limit the number of findings returned. Must be <= 1000.
@@ -53191,6 +53223,14 @@ paths:
5319153223
items:
5319253224
$ref: '#/components/schemas/FindingVulnerabilityType'
5319353225
type: array
53226+
- description: Return additional fields for some findings.
53227+
example:
53228+
- true
53229+
in: query
53230+
name: detailed_findings
53231+
required: false
53232+
schema:
53233+
type: boolean
5319453234
responses:
5319553235
'200':
5319653236
content:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"2025-05-20T12:11:24.321Z"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"log": {
3+
"_recordingName": "Security Monitoring/List findings returns \"OK\" response with details",
4+
"creator": {
5+
"comment": "persister:fs",
6+
"name": "Polly.JS",
7+
"version": "6.0.5"
8+
},
9+
"entries": [
10+
{
11+
"_id": "0b731c8b9bbe98674f8ad005c800b7d6",
12+
"_order": 0,
13+
"cache": {},
14+
"request": {
15+
"bodySize": 0,
16+
"cookies": [],
17+
"headers": [
18+
{
19+
"_fromType": "array",
20+
"name": "accept",
21+
"value": "application/json"
22+
}
23+
],
24+
"headersSize": 543,
25+
"httpVersion": "HTTP/1.1",
26+
"method": "GET",
27+
"queryString": [
28+
{
29+
"name": "detailed_findings",
30+
"value": "true"
31+
}
32+
],
33+
"url": "https://api.datadoghq.com/api/v2/posture_management/findings?detailed_findings=true"
34+
},
35+
"response": {
36+
"bodySize": 89,
37+
"content": {
38+
"mimeType": "application/vnd.api+json",
39+
"size": 89,
40+
"text": "{\"data\":[],\"meta\":{\"page\":{\"total_filtered_count\":0},\"snapshot_timestamp\":1747743085077}}"
41+
},
42+
"cookies": [],
43+
"headers": [
44+
{
45+
"name": "content-type",
46+
"value": "application/vnd.api+json"
47+
}
48+
],
49+
"headersSize": 524,
50+
"httpVersion": "HTTP/1.1",
51+
"redirectURL": "",
52+
"status": 200,
53+
"statusText": "OK"
54+
},
55+
"startedDateTime": "2025-05-20T12:11:24.786Z",
56+
"time": 462
57+
}
58+
],
59+
"pages": [],
60+
"version": "1.2"
61+
}
62+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* List findings returns "OK" response with details
3+
*/
4+
5+
import { client, v2 } from "@datadog/datadog-api-client";
6+
7+
const configuration = client.createConfiguration();
8+
configuration.unstableOperations["v2.listFindings"] = true;
9+
const apiInstance = new v2.SecurityMonitoringApi(configuration);
10+
11+
const params: v2.SecurityMonitoringApiListFindingsRequest = {
12+
detailedFindings: true,
13+
};
14+
15+
apiInstance
16+
.listFindings(params)
17+
.then((data: v2.ListFindingsResponse) => {
18+
console.log(
19+
"API called successfully. Returned data: " + JSON.stringify(data)
20+
);
21+
})
22+
.catch((error: any) => console.error(error));

features/support/scenarios_model_mapping.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3332,6 +3332,10 @@ export const ScenariosModelMappings: {[key: string]: {[key: string]: any}} = {
33323332
"type": "Array<FindingVulnerabilityType>",
33333333
"format": "",
33343334
},
3335+
"detailedFindings": {
3336+
"type": "boolean",
3337+
"format": "",
3338+
},
33353339
"operationResponseType": "ListFindingsResponse",
33363340
},
33373341
"v2.MuteFindings": {

features/v2/security_monitoring.feature

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -840,6 +840,14 @@ Feature: Security Monitoring
840840
Then the response status is 200 OK
841841
And the response "data[0].type" is equal to "finding"
842842

843+
@team:DataDog/cloud-security-posture-management
844+
Scenario: List findings returns "OK" response with details
845+
Given operation "ListFindings" enabled
846+
And new "ListFindings" request
847+
And request contains "detailed_findings" parameter with value true
848+
When the request is sent
849+
Then the response status is 200 OK
850+
843851
@generated @skip @team:DataDog/cloud-security-posture-management @with-pagination
844852
Scenario: List findings returns "OK" response with pagination
845853
Given operation "ListFindings" enabled

packages/datadog-api-client-v2/apis/SecurityMonitoringApi.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1532,6 +1532,7 @@ export class SecurityMonitoringApiRequestFactory extends BaseAPIRequestFactory {
15321532
filterEvaluation?: FindingEvaluation,
15331533
filterStatus?: FindingStatus,
15341534
filterVulnerabilityType?: Array<FindingVulnerabilityType>,
1535+
detailedFindings?: boolean,
15351536
_options?: Configuration
15361537
): Promise<RequestContext> {
15371538
const _config = _options || this.configuration;
@@ -1647,6 +1648,13 @@ export class SecurityMonitoringApiRequestFactory extends BaseAPIRequestFactory {
16471648
"multi"
16481649
);
16491650
}
1651+
if (detailedFindings !== undefined) {
1652+
requestContext.setQueryParam(
1653+
"detailed_findings",
1654+
ObjectSerializer.serialize(detailedFindings, "boolean", ""),
1655+
""
1656+
);
1657+
}
16501658

16511659
// Apply auth methods
16521660
applySecurityAuthentication(_config, requestContext, [
@@ -7029,6 +7037,11 @@ export interface SecurityMonitoringApiListFindingsRequest {
70297037
* @type Array<FindingVulnerabilityType>
70307038
*/
70317039
filterVulnerabilityType?: Array<FindingVulnerabilityType>;
7040+
/**
7041+
* Return additional fields for some findings.
7042+
* @type boolean
7043+
*/
7044+
detailedFindings?: boolean;
70327045
}
70337046

70347047
export interface SecurityMonitoringApiListHistoricalJobsRequest {
@@ -8338,6 +8351,17 @@ export class SecurityMonitoringApi {
83388351
*
83398352
* Query parameters must be only among the documented ones and with values of correct types. Duplicated query parameters (e.g. `filter[status]=low&filter[status]=info`) are not allowed.
83408353
*
8354+
* ### Additional extension fields
8355+
*
8356+
* Additional extension fields are available for some findings.
8357+
*
8358+
* The data is available when you include the query parameter `?detailed_findings=true` in the request.
8359+
*
8360+
* The following fields are available for findings:
8361+
* - `external_id`: The resource external ID related to the finding.
8362+
* - `description`: The description and remediation steps for the finding.
8363+
* - `datadog_link`: The Datadog relative link for the finding.
8364+
*
83418365
* ### Response
83428366
*
83438367
* The response includes an array of finding objects, pagination metadata, and a count of items that match the query.
@@ -8368,6 +8392,7 @@ export class SecurityMonitoringApi {
83688392
param.filterEvaluation,
83698393
param.filterStatus,
83708394
param.filterVulnerabilityType,
8395+
param.detailedFindings,
83718396
options
83728397
);
83738398
return requestContextPromise.then((requestContext) => {
@@ -8406,6 +8431,7 @@ export class SecurityMonitoringApi {
84068431
param.filterEvaluation,
84078432
param.filterStatus,
84088433
param.filterVulnerabilityType,
8434+
param.detailedFindings,
84098435
options
84108436
);
84118437
const responseContext = await this.configuration.httpApi.send(

packages/datadog-api-client-v2/models/FindingAttributes.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ import { AttributeTypeMap } from "../../datadog-api-client-common/util";
1515
* The JSON:API attributes of the finding.
1616
*/
1717
export class FindingAttributes {
18+
/**
19+
* The Datadog relative link for this finding.
20+
*/
21+
"datadogLink"?: string;
22+
/**
23+
* The description and remediation steps for this finding.
24+
*/
25+
"description"?: string;
1826
/**
1927
* The evaluation of the finding.
2028
*/
@@ -23,6 +31,10 @@ export class FindingAttributes {
2331
* The date on which the evaluation for this finding changed (Unix ms).
2432
*/
2533
"evaluationChangedAt"?: number;
34+
/**
35+
* The cloud-based ID for the resource related to the finding.
36+
*/
37+
"externalId"?: string;
2638
/**
2739
* Information about the mute status of this finding.
2840
*/
@@ -72,6 +84,14 @@ export class FindingAttributes {
7284
* @ignore
7385
*/
7486
static readonly attributeTypeMap: AttributeTypeMap = {
87+
datadogLink: {
88+
baseName: "datadog_link",
89+
type: "string",
90+
},
91+
description: {
92+
baseName: "description",
93+
type: "string",
94+
},
7595
evaluation: {
7696
baseName: "evaluation",
7797
type: "FindingEvaluation",
@@ -81,6 +101,10 @@ export class FindingAttributes {
81101
type: "number",
82102
format: "int64",
83103
},
104+
externalId: {
105+
baseName: "external_id",
106+
type: "string",
107+
},
84108
mute: {
85109
baseName: "mute",
86110
type: "FindingMute",

0 commit comments

Comments
 (0)