For AI agents: A markdown version of this page is available at https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/ko/api/latest/static-analysis/create-custom-rule-revision.md. A documentation index is available at /llms.txt.
Language
Datadog site

커스텀 규칙 수정 버전 생성

경고This endpoint is in Preview and may introduce breaking changes. If you have any feedback, contact Datadog support.
PUThttps://api.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.us3.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.us5.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.datadoghq.eu/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.ap1.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.ap2.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.uk1.datadoghq.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.ddog-gov.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisionshttps://api.us2.ddog-gov.com/api/v2/static-analysis/custom/rulesets/{ruleset_name}/rules/{rule_name}/revisions

개요

커스텀 규칙에 대한 새 수정 버전을 생성합니다.

인수

경로 파라미터

이름
유형
설명
ruleset_name [required]
string

The ruleset name

rule_name [required]
string

The rule name

요청

Body Data (required)

항목
유형
설명
_authentication_token
string

새 커스텀 규칙 수정 버전을 생성하기 위한 요청 본문입니다.

data
object

Data object for a custom rule revision create request.

응답

Successfully created

코드 예시

커스텀 규칙 수정 버전 생성
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF
# Path parameters
export ruleset_name="CHANGE_ME"
export rule_name="CHANGE_ME"

# 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 PUT "https://api.${DD_SITE}/api/v2/static-analysis/custom/rulesets/${ruleset_name}/rules/${rule_name}/revisions" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}" \
-d @- << EOF
{
  "data": {
    "attributes": {
      "arguments": [
        {
          "description": "Maximum call depth to analyze",
          "name": "max_depth"
        }
      ],
      "category": "SECURITY",
      "code": "def rule(node): return node.type == 'call'",
      "creation_message": "Initial revision",
      "cve": "CVE-2024-1234",
      "cwe": "CWE-79",
      "description": "Detects insecure coding patterns that may lead to vulnerabilities",
      "documentation_url": "https://docs.example.com/rules/my-rule",
      "is_published": false,
      "is_testing": false,
      "language": "PYTHON",
      "severity": "ERROR",
      "short_description": "Rule to detect insecure patterns",
      "should_use_ai_fix": false,
      "tags": [
        "security",
        "custom"
      ],
      "tests": [
        {
          "annotation_count": 1,
          "code": "result = insecure_function()",
          "filename": "test.yaml"
        }
      ],
      "tree_sitter_query": "(call_expression) @call"
    },
    "type": "custom_rule_revision"
  }
}
EOF