Skip to content

Commit d5c0768

Browse files
api-clients-generation-pipeline[bot]ci.datadog-api-spec
andauthored
Tag security findings Jira endpoints as unstable (DataDog#3510)
Co-authored-by: ci.datadog-api-spec <packages@datadoghq.com>
1 parent 1232bf4 commit d5c0768

4 files changed

Lines changed: 35 additions & 9 deletions

File tree

.generator/schemas/v2/openapi.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79838,6 +79838,9 @@ paths:
7983879838
permissions:
7983979839
- security_monitoring_findings_write
7984079840
- appsec_vm_write
79841+
x-unstable: '**Note**: This endpoint is in beta and is subject to change.
79842+
79843+
Please check the documentation regularly for updates.'
7984179844
post:
7984279845
description: Create Jira issues for security findings. This operation creates
7984379846
a case in Datadog and a Jira issue linked to that case for bidirectional sync
@@ -79878,6 +79881,9 @@ paths:
7987879881
permissions:
7987979882
- security_monitoring_findings_write
7988079883
- appsec_vm_write
79884+
x-unstable: '**Note**: This endpoint is in beta and is subject to change.
79885+
79886+
Please check the documentation regularly for updates.'
7988179887
/api/v2/security/sboms:
7988279888
get:
7988379889
description: 'Get a list of assets SBOMs for an organization.

api/datadog/configuration.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,8 +619,10 @@ func NewConfiguration() *Configuration {
619619
"v2.GetOpenAPI": false,
620620
"v2.ListAPIs": false,
621621
"v2.UpdateOpenAPI": false,
622+
"v2.AttachJiraIssue": false,
622623
"v2.CancelThreatHuntingJob": false,
623624
"v2.ConvertJobResultToSignal": false,
625+
"v2.CreateJiraIssues": false,
624626
"v2.DeleteThreatHuntingJob": false,
625627
"v2.GetFinding": false,
626628
"v2.GetRuleVersionHistory": false,

api/datadogV2/api_security_monitoring.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,15 @@ func (a *SecurityMonitoringApi) AttachJiraIssue(ctx _context.Context, body Attac
109109
localVarReturnValue FindingCaseResponse
110110
)
111111

112+
operationId := "v2.AttachJiraIssue"
113+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
114+
if !isOperationEnabled {
115+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
116+
}
117+
if isOperationEnabled && a.Client.Cfg.Debug {
118+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
119+
}
120+
112121
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.AttachJiraIssue")
113122
if err != nil {
114123
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}
@@ -675,6 +684,15 @@ func (a *SecurityMonitoringApi) CreateJiraIssues(ctx _context.Context, body Crea
675684
localVarReturnValue FindingCaseResponseArray
676685
)
677686

687+
operationId := "v2.CreateJiraIssues"
688+
isOperationEnabled := a.Client.Cfg.IsUnstableOperationEnabled(operationId)
689+
if !isOperationEnabled {
690+
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: _fmt.Sprintf("Unstable operation '%s' is disabled", operationId)}
691+
}
692+
if isOperationEnabled && a.Client.Cfg.Debug {
693+
_log.Printf("WARNING: Using unstable operation '%s'", operationId)
694+
}
695+
678696
localBasePath, err := a.Client.Cfg.ServerURLWithContext(ctx, "v2.SecurityMonitoringApi.CreateJiraIssues")
679697
if err != nil {
680698
return localVarReturnValue, nil, datadog.GenericOpenAPIError{ErrorMessage: err.Error()}

tests/scenarios/features/v2/security_monitoring.feature

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Feature: Security Monitoring
99
And a valid "appKeyAuth" key in the system
1010
And an instance of "SecurityMonitoring" API
1111

12-
@team:DataDog/k9-investigation
12+
@skip @team:DataDog/k9-investigation
1313
Scenario: Attach security finding to a Jira issue returns "OK" response
1414
Given new "AttachJiraIssue" request
1515
And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}}
@@ -30,21 +30,21 @@ Feature: Security Monitoring
3030
And the response "data.attributes.status_group" is equal to "SG_OPEN"
3131
And the response "data.attributes.insights" has item with field "resource_id" with value "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="
3232

33-
@team:DataDog/k9-investigation
33+
@skip @team:DataDog/k9-investigation
3434
Scenario: Attach security findings to a Jira issue returns "Bad Request" response
3535
Given new "AttachJiraIssue" request
3636
And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": []}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}}
3737
When the request is sent
3838
Then the response status is 400 Bad Request
3939

40-
@team:DataDog/k9-investigation
40+
@skip @team:DataDog/k9-investigation
4141
Scenario: Attach security findings to a Jira issue returns "Not Found" response
4242
Given new "AttachJiraIssue" request
4343
And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "wrong-finding-id", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}}
4444
When the request is sent
4545
Then the response status is 404 Not Found
4646

47-
@team:DataDog/k9-investigation
47+
@skip @team:DataDog/k9-investigation
4848
Scenario: Attach security findings to a Jira issue returns "OK" response
4949
Given new "AttachJiraIssue" request
5050
And body with value {"data": {"attributes": {"jira_issue_url": "https://datadoghq-sandbox-538.atlassian.net/browse/CSMSEC-105476"}, "relationships": {"findings": {"data": [{"id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI=", "type": "findings"}, {"id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM=", "type": "findings"}]}, "project": {"data": {"id": "959a6f71-bac8-4027-b1d3-2264f569296f", "type": "projects"}}}, "type": "jira_issues"}}
@@ -258,7 +258,7 @@ Feature: Security Monitoring
258258
Then the response status is 200 OK
259259
And the response "terraformContent" is equal to "resource \"datadog_security_monitoring_rule\" \"_{{ unique_hash }}\" {\n\tname = \"_{{ unique_hash }}\"\n\tenabled = true\n\tquery {\n\t\tquery = \"@test:true\"\n\t\tgroup_by_fields = []\n\t\thas_optional_group_by_fields = false\n\t\tdistinct_fields = []\n\t\taggregation = \"count\"\n\t\tname = \"\"\n\t\tdata_source = \"logs\"\n\t}\n\toptions {\n\t\tkeep_alive = 3600\n\t\tmax_signal_duration = 86400\n\t\tdetection_method = \"threshold\"\n\t\tevaluation_window = 900\n\t}\n\tcase {\n\t\tname = \"\"\n\t\tstatus = \"info\"\n\t\tnotifications = []\n\t\tcondition = \"a > 0\"\n\t}\n\tmessage = \"Test rule\"\n\ttags = []\n\thas_extended_title = false\n\ttype = \"log_detection\"\n}\n"
260260

261-
@team:DataDog/k9-investigation
261+
@skip @team:DataDog/k9-investigation
262262
Scenario: Create Jira issue for security finding returns "Created" response
263263
Given new "CreateJiraIssues" request
264264
And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "6a773295-8729-4034-aada-53b64cbe02e7"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}]}}, "id": "6a773295-8729-4034-aada-53b64cbe02e7"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "ZGZhMDI3ZjdjMDM3YjJmNzcxNTlhZGMwMjdmZWNiNTZ-MTVlYTNmYWU3NjNlOTNlYTE2YjM4N2JmZmI4Yjk5N2Y="}]}
@@ -274,7 +274,7 @@ Feature: Security Monitoring
274274
And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING"
275275
And the response "data[0].attributes.jira_issue.status" is equal to "COMPLETED"
276276

277-
@team:DataDog/k9-investigation
277+
@skip @team:DataDog/k9-investigation
278278
Scenario: Create Jira issue for security findings returns "Created" response
279279
Given new "CreateJiraIssues" request
280280
And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "e469ceda-957a-4557-a607-9ff25032e9ca"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}, {"type": "findings", "id": "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}]}}, "id": "e469ceda-957a-4557-a607-9ff25032e9ca"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "MzUxMDI4OWYyYWEyODRhYjQ0Zjg2YjY2ZTFmNjRjYzd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}, {"type": "findings", "id": "ZjE2ZGI5YjdmYTQyYzhhMDQ3Nzc3YjM1NGQ2Y2NmZTd-NDU2OWQyNTk1MjM5OGI2NzJjMTVhYjhiODY1ZDcwZWY="}]}
@@ -292,14 +292,14 @@ Feature: Security Monitoring
292292
And the response "data[0].attributes.insights[0].type" is equal to "SECURITY_FINDING"
293293
And the response "data[0].attributes.jira_issue.status" is equal to "COMPLETED"
294294

295-
@team:DataDog/k9-investigation
295+
@skip @team:DataDog/k9-investigation
296296
Scenario: Create Jira issues for security findings returns "Bad Request" response
297297
Given new "CreateJiraIssues" request
298298
And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "a7c38bab-ae98-4113-878c-c98799f914c2"}}}}], "included": [{"type": "cases", "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": []}}, "id": "a7c38bab-ae98-4113-878c-c98799f914c2"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}]}
299299
When the request is sent
300300
Then the response status is 400 Bad Request
301301

302-
@team:DataDog/k9-investigation
302+
@skip @team:DataDog/k9-investigation
303303
Scenario: Create Jira issues for security findings returns "Created" response
304304
Given new "CreateJiraIssues" request
305305
And body with value {"data": [{"type": "jira_issues", "attributes":{}, "relationships": {"case": {"data": {"type": "cases", "id":"53e242c6-a7d6-46ad-9680-b8d14753f716"}}}}, {"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "195772b2-1f53-41d2-b81e-48c8e6c21d33"}}}}], "included":[{"type":"cases", "attributes":{"title":"A title", "description":"A description"}, "relationships":{"project":{"data":{"type":"projects", "id":"959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data": [{"type": "findings", "id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}]}}, "id": "53e242c6-a7d6-46ad-9680-b8d14753f716"}, {"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}}, "findings": {"data":[{"type": "findings", "id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}]}}, "id": "195772b2-1f53-41d2-b81e-48c8e6c21d33"}, {"type": "projects", "id": "959a6f71-bac8-4027-b1d3-2264f569296f"}, {"type": "findings", "id": "OTQ3NjJkMmYwMTIzMzMxNTc1Y2Q4MTA5NWU0NTBmMDl-ZjE3NjMxZWVkYzBjZGI1NDY2NWY2OGQxZDk4MDY4MmI="}, {"type": "findings", "id": "MTNjN2ZmYWMzMDIxYmU1ZDFiZDRjNWUwN2I1NzVmY2F-YTA3MzllMTUzNWM3NmEyZjdiNzEzOWM5YmViZTMzOGM="}]}
@@ -323,7 +323,7 @@ Feature: Security Monitoring
323323
And the response "data[1].attributes.insights[0].type" is equal to "SECURITY_FINDING"
324324
And the response "data[1].attributes.jira_issue.status" is equal to "COMPLETED"
325325

326-
@team:DataDog/k9-investigation
326+
@skip @team:DataDog/k9-investigation
327327
Scenario: Create Jira issues for security findings returns "Not Found" response
328328
Given new "CreateJiraIssues" request
329329
And body with value {"data": [{"type": "jira_issues", "attributes": {}, "relationships": {"case": {"data": {"type": "cases", "id": "6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3"}}}}], "included": [{"type": "cases", "attributes": {"title": "A title", "description": "A description"}, "relationships": {"project": {"data": {"type": "projects", "id": "00000000-0000-0000-0000-000000000000"}}, "findings": {"data": [{"type": "findings", "id": "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM="}]}}, "id": "6ed1d7c2-e1a3-4369-b92b-a38d3cc75cf3"}, {"type": "projects", "id": "00000000-0000-0000-0000-000000000000"}, {"type": "findings", "id": "YzM2MTFjYzcyNmY0Zjg4MTAxZmRlNjQ1MWU1ZGQwYzR-YzI5NzE5Y2Y4MzU4ZjliNzhkNjYxNTY0ODIzZDQ2YTM="}]}

0 commit comments

Comments
 (0)