Assign or unassign security findings

Note: This endpoint is in preview and is subject to change. If you have any feedback, contact Datadog support.

PATCH https://api.ap1.datadoghq.com/api/v2/security/findings/assigneehttps://api.ap2.datadoghq.com/api/v2/security/findings/assigneehttps://api.datadoghq.eu/api/v2/security/findings/assigneehttps://api.ddog-gov.com/api/v2/security/findings/assigneehttps://api.us2.ddog-gov.com/api/v2/security/findings/assigneehttps://api.uk1.datadoghq.com/api/v2/security/findings/assigneehttps://api.datadoghq.com/api/v2/security/findings/assigneehttps://api.us3.datadoghq.com/api/v2/security/findings/assigneehttps://api.us5.datadoghq.com/api/v2/security/findings/assignee

개요

보안 결과를 할당 또는 할당 해제합니다. 요청당 최대 100개의 보안 결과를 할당할 수 있습니다. assignee_id를 결과를 할당하려는 Datadog 사용자의 고유 식별자로 설정합니다. 결과 할당을 해제하려면 assignee_id를 생략하거나 null로 설정하세요. 결과별 경고 및 실패는 응답 meta 객체에 반환됩니다. This endpoint requires any of the following permissions:

  • security_monitoring_findings_write
  • appsec_vm_write

  • 요청

    Body Data (required)

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Data of the assignee request.

    attributes

    object

    Attributes of the assignee request.

    assignee_id

    string

    Unique identifier of the Datadog user to assign the security findings to. If this field is not provided, the security findings are unassigned.

    id

    string

    Unique identifier of the assignee request.

    relationships [required]

    object

    Relationships of the assignee request.

    findings [required]

    object

    Security findings to assign or unassign.

    data

    [object]

    Array of security finding data objects.

    id [required]

    string

    Unique identifier of the security finding.

    type [required]

    enum

    Security findings resource type. Allowed enum values: findings

    default: findings

    type [required]

    enum

    Assignee resource type. Allowed enum values: assignee

    default: assignee

    {
      "data": {
        "attributes": {
          "assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
        },
        "id": "00000000-0000-0000-0000-000000000001",
        "relationships": {
          "findings": {
            "data": [
              {
                "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                "type": "findings"
              }
            ]
          }
        },
        "type": "assignee"
      }
    }

    응답

    Accepted

    Response for the assign or unassign request.

    Expand All

    항목

    유형

    설명

    data [required]

    object

    Data of the assignee response.

    attributes [required]

    object

    Attributes of the assignee response.

    assignee_id

    string

    Unique identifier of the Datadog user assigned to the security findings. Omitted when the findings were unassigned.

    id [required]

    string

    Unique identifier of the assignee request.

    type [required]

    enum

    Assignee resource type. Allowed enum values: assignee

    default: assignee

    meta

    object

    Per-finding warnings and failures produced while processing the bulk assignee request.

    failures

    [object]

    Findings that could not be assigned or unassigned.

    detail [required]

    string

    Human-readable explanation of the outcome.

    finding_id [required]

    string

    Unique identifier of the security finding.

    status [required]

    int32

    HTTP-like status code describing the outcome for this finding.

    title [required]

    string

    Short label describing the outcome for this finding.

    warnings

    [object]

    Findings for which the assignment succeeded but a non-critical error occurred during processing.

    detail [required]

    string

    Human-readable explanation of the outcome.

    finding_id [required]

    string

    Unique identifier of the security finding.

    status [required]

    int32

    HTTP-like status code describing the outcome for this finding.

    title [required]

    string

    Short label describing the outcome for this finding.

    {
      "data": {
        "attributes": {
          "assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"
        },
        "id": "00000000-0000-0000-0000-000000000001",
        "type": "assignee"
      },
      "meta": {
        "failures": [
          {
            "detail": "failed to update finding assignee",
            "finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
            "status": 500,
            "title": "Internal Server Error"
          }
        ],
        "warnings": [
          {
            "detail": "failed to update finding assignee",
            "finding_id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
            "status": 500,
            "title": "Internal Server Error"
          }
        ]
      }
    }

    Bad Request

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Not Found

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    Too many requests

    API error response.

    Expand All

    항목

    유형

    설명

    errors [required]

    [string]

    A list of errors.

    {
      "errors": [
        "Bad Request"
      ]
    }

    코드 예시

                      ## default
    # 
    
    # Use a Personal Access Token or Service Access Token
    export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

    # Curl command
    curl -X PATCH "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/security/findings/assignee" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DD_BEARER_TOKEN}" \ -d @- << EOF { "data": { "attributes": { "assignee_id": "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0" }, "id": "00000000-0000-0000-0000-000000000001", "relationships": { "findings": { "data": [ { "id": "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==", "type": "findings" } ] } }, "type": "assignee" } } EOF
    """
    Assign or unassign security findings returns "Accepted" 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.assignee_data_type import AssigneeDataType
    from datadog_api_client.v2.model.assignee_request import AssigneeRequest
    from datadog_api_client.v2.model.assignee_request_data import AssigneeRequestData
    from datadog_api_client.v2.model.assignee_request_data_attributes import AssigneeRequestDataAttributes
    from datadog_api_client.v2.model.assignee_request_data_relationships import AssigneeRequestDataRelationships
    from datadog_api_client.v2.model.finding_data import FindingData
    from datadog_api_client.v2.model.finding_data_type import FindingDataType
    from datadog_api_client.v2.model.findings import Findings
    
    body = AssigneeRequest(
        data=AssigneeRequestData(
            attributes=AssigneeRequestDataAttributes(
                assignee_id="f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
            ),
            id="00000000-0000-0000-0000-000000000001",
            relationships=AssigneeRequestDataRelationships(
                findings=Findings(
                    data=[
                        FindingData(
                            id="ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                            type=FindingDataType.FINDINGS,
                        ),
                    ],
                ),
            ),
            type=AssigneeDataType.ASSIGNEE,
        ),
    )
    
    configuration = Configuration()
    configuration.access_token = environ["DD_BEARER_TOKEN"]
    configuration.unstable_operations["update_findings_assignee"] = True
    with ApiClient(configuration) as api_client:
        api_instance = SecurityMonitoringApi(api_client)
        response = api_instance.update_findings_assignee(body=body)
    
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
    # Assign or unassign security findings returns "Accepted" response
    
    require "datadog_api_client"
    DatadogAPIClient.configure do |config|
      config.access_token = ENV["DD_BEARER_TOKEN"]
      config.unstable_operations["v2.update_findings_assignee".to_sym] = true
    end
    api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
    
    body = DatadogAPIClient::V2::AssigneeRequest.new({
      data: DatadogAPIClient::V2::AssigneeRequestData.new({
        attributes: DatadogAPIClient::V2::AssigneeRequestDataAttributes.new({
          assignee_id: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
        }),
        id: "00000000-0000-0000-0000-000000000001",
        relationships: DatadogAPIClient::V2::AssigneeRequestDataRelationships.new({
          findings: DatadogAPIClient::V2::Findings.new({
            data: [
              DatadogAPIClient::V2::FindingData.new({
                id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                type: DatadogAPIClient::V2::FindingDataType::FINDINGS,
              }),
            ],
          }),
        }),
        type: DatadogAPIClient::V2::AssigneeDataType::ASSIGNEE,
      }),
    })
    p api_instance.update_findings_assignee(body)
    

    Instructions

    First install the library and its dependencies and then save the example to example.rb and run following commands:

        
    DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
    // Assign or unassign security findings returns "Accepted" 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() {
    	body := datadogV2.AssigneeRequest{
    		Data: datadogV2.AssigneeRequestData{
    			Attributes: &datadogV2.AssigneeRequestDataAttributes{
    				AssigneeId: datadog.PtrString("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"),
    			},
    			Id: datadog.PtrString("00000000-0000-0000-0000-000000000001"),
    			Relationships: datadogV2.AssigneeRequestDataRelationships{
    				Findings: datadogV2.Findings{
    					Data: []datadogV2.FindingData{
    						{
    							Id:   "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
    							Type: datadogV2.FINDINGDATATYPE_FINDINGS,
    						},
    					},
    				},
    			},
    			Type: datadogV2.ASSIGNEEDATATYPE_ASSIGNEE,
    		},
    	}
    	ctx := datadog.NewDefaultContext(context.Background())
    	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
    	configuration := datadog.NewConfiguration()
    	configuration.SetUnstableOperationEnabled("v2.UpdateFindingsAssignee", true)
    	apiClient := datadog.NewAPIClient(configuration)
    	api := datadogV2.NewSecurityMonitoringApi(apiClient)
    	resp, r, err := api.UpdateFindingsAssignee(ctx, body)
    
    	if err != nil {
    		fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.UpdateFindingsAssignee`: %v\n", err)
    		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
    	}
    
    	responseContent, _ := json.MarshalIndent(resp, "", "  ")
    	fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.UpdateFindingsAssignee`:\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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
    // Assign or unassign security findings returns "Accepted" 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.model.AssigneeDataType;
    import com.datadog.api.client.v2.model.AssigneeRequest;
    import com.datadog.api.client.v2.model.AssigneeRequestData;
    import com.datadog.api.client.v2.model.AssigneeRequestDataAttributes;
    import com.datadog.api.client.v2.model.AssigneeRequestDataRelationships;
    import com.datadog.api.client.v2.model.AssigneeResponse;
    import com.datadog.api.client.v2.model.FindingData;
    import com.datadog.api.client.v2.model.FindingDataType;
    import com.datadog.api.client.v2.model.Findings;
    import java.util.Collections;
    
    public class Example {
      public static void main(String[] args) {
        ApiClient defaultClient = ApiClient.getDefaultApiClient();
        defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
        defaultClient.setUnstableOperationEnabled("v2.updateFindingsAssignee", true);
        SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);
    
        AssigneeRequest body =
            new AssigneeRequest()
                .data(
                    new AssigneeRequestData()
                        .attributes(
                            new AssigneeRequestDataAttributes()
                                .assigneeId("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0"))
                        .id("00000000-0000-0000-0000-000000000001")
                        .relationships(
                            new AssigneeRequestDataRelationships()
                                .findings(
                                    new Findings()
                                        .data(
                                            Collections.singletonList(
                                                new FindingData()
                                                    .id("ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==")
                                                    .type(FindingDataType.FINDINGS)))))
                        .type(AssigneeDataType.ASSIGNEE));
    
        try {
          AssigneeResponse result = apiInstance.updateFindingsAssignee(body);
          System.out.println(result);
        } catch (ApiException e) {
          System.err.println("Exception when calling SecurityMonitoringApi#updateFindingsAssignee");
          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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
    // Assign or unassign security findings returns "Accepted" response
    use datadog_api_client::datadog;
    use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
    use datadog_api_client::datadogV2::model::AssigneeDataType;
    use datadog_api_client::datadogV2::model::AssigneeRequest;
    use datadog_api_client::datadogV2::model::AssigneeRequestData;
    use datadog_api_client::datadogV2::model::AssigneeRequestDataAttributes;
    use datadog_api_client::datadogV2::model::AssigneeRequestDataRelationships;
    use datadog_api_client::datadogV2::model::FindingData;
    use datadog_api_client::datadogV2::model::FindingDataType;
    use datadog_api_client::datadogV2::model::Findings;
    
    #[tokio::main]
    async fn main() {
        let body = AssigneeRequest::new(
            AssigneeRequestData::new(
                AssigneeRequestDataRelationships::new(Findings::new().data(vec![FindingData::new(
                    "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==".to_string(),
                    FindingDataType::FINDINGS,
                )])),
                AssigneeDataType::ASSIGNEE,
            )
            .attributes(
                AssigneeRequestDataAttributes::new()
                    .assignee_id("f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0".to_string()),
            )
            .id("00000000-0000-0000-0000-000000000001".to_string()),
        );
        let mut configuration = datadog::Configuration::new();
        configuration.set_unstable_operation_enabled("v2.update_findings_assignee", true);
        let api = SecurityMonitoringAPI::with_config(configuration);
        let resp = api.update_findings_assignee(body).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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
    /**
     * Assign or unassign security findings returns "Accepted" 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.updateFindingsAssignee"] = true;
    const apiInstance = new v2.SecurityMonitoringApi(configuration);
    
    const params: v2.SecurityMonitoringApiUpdateFindingsAssigneeRequest = {
      body: {
        data: {
          attributes: {
            assigneeId: "f315bdaf-9ee7-4808-a9c1-99c15bf0f4d0",
          },
          id: "00000000-0000-0000-0000-000000000001",
          relationships: {
            findings: {
              data: [
                {
                  id: "ZGVmLTAwcC1pZXJ-aS0wZjhjNjMyZDNmMzRlZTgzNw==",
                  type: "findings",
                },
              ],
            },
          },
          type: "assignee",
        },
      },
    };
    
    apiInstance
      .updateFindingsAssignee(params)
      .then((data: v2.AssigneeResponse) => {
        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.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"