v1

latestOpenAPI 3.0.32026-07-22238629559.2 KB
PoliciesService

List Policy Rules

List the rules for a given policy.

get/api/policies/v1/deployments/{deploymentId}/{policyId}/rules

Path parameters

deploymentIdstring int64 required

The unique numerical identifier for the deployment.

policyIdstring int64 required

The unique numerical identifier for the policy. Find your policy's ID via the List Policies endpoint.

Query parameters

cursorstring

Cursor to paginate through the rules. Provide a cursor value from the response to retrieve the next page.

limitinteger

Page size to paginate through the rules. The default page size is 500 and the maximum allowed page size is 2000.

Response

OK

cursorstring

Cursor to paginate through the rules.

Example response

{
  "policy": {
    "id": "1",
    "isDefault": true,
    "name": "Global Policy",
    "productType": "PRODUCT_TYPE_SAST",
    "slug": "global_policy"
  },
  "rules": [
    {
      "id": "1",
      "policyMode": "MODE_MONITOR",
      "path": "python.rule.1",
      "source": "SOURCE_COMMUNITY",
      "severity": "SEVERITY_HIGH",
      "languages": [
        "python"
      ],
      "confidence": "CONFIDENCE_HIGH",
      "vulnerabilityClass": [
        "Improper Authentication"
      ],
      "rulesets": [],
      "lastChangeAt": "2024-07-29T22:33:37.380293Z",
      "category": "security",
      "owaspCategories": [
        "A07: Cross-Site Scripting (XSS)"
      ],
      "technologies": [
        "django",
        "flask"
      ],
      "cweCategories": [
        "CWE-918: Server-Side Request Forgery (SSRF)"
      ],
      "url": "https://semgrep.com/r/123/python.rule.1",
      "registryMaintainer": "semgrep"
    },
    {
      "id": "2",
      "policyMode": "MODE_COMMENT",
      "path": "python.rule.shared",
      "source": "SOURCE_PRO",
      "severity": "SEVERITY_MEDIUM",
      "languages": [
        "python"
      ],
      "confidence": "CONFIDENCE_HIGH",
      "vulnerabilityClass": [
        "Improper Authentication"
      ],
      "rulesets": [
        "comment",
        "default"
      ],
      "lastChangeAt": "2024-07-29T22:33:37.380293Z",
      "category": "security",
      "owaspCategories": [
        "A01:2021 - Broken Access Control",
        "A07: Cross-Site Scripting (XSS)"
      ],
      "technologies": [
        "django",
        "flask"
      ],
      "cweCategories": [
        "CWE-918: Server-Side Request Forgery (SSRF)"
      ],
      "url": "https://semgrep.com/r/123/python.rule.shared",
      "registryMaintainer": "semgrep"
    },
    {
      "id": "3",
      "policyMode": "MODE_BLOCK",
      "path": "python.rule.custom_rule",
      "source": "SOURCE_CUSTOM",
      "severity": "SEVERITY_MEDIUM",
      "languages": [
        "python"
      ],
      "confidence": "CONFIDENCE_HIGH",
      "vulnerabilityClass": [
        "Improper Authentication"
      ],
      "rulesets": [],
      "lastChangeAt": "2024-07-29T22:33:37.380293Z",
      "lastChangeBy": "example-user",
      "category": "best-practice",
      "owaspCategories": [],
      "technologies": [
        "django",
        "flask"
      ],
      "cweCategories": [],
      "url": "https://semgrep.com/r/123/python.rule.custom_rule",
      "registryMaintainer": "semgrep"
    }
  ],
  "cursor": "Pm0ROjIwMjQtMDItMDYgMjA6MDQ6NDguMEDzNzk2fmk6NYTM2zUxOTI"
}