v1

latestOpenAPI 3.0.32026-07-22238629559.2 KB
PoliciesService

Update Policy Rule

Update a specific rule within a policy.

put/api/policies/v1/deployments/{deploymentId}/{policyId}/rules/{rulePath}

Path parameters

deploymentIdstring int64 required

The unique numerical identifier of your deployment. Can be found via the Deployments Service or in your Settings in the web UI.

policyIdstring int64 required

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

rulePathstring required

Uniquely identify the Rule using its full path. Find the Rule's path via the List Policy Rules endpoint or via the Semgrep Registry.

Example:python.rule.1

Request body

policyMode'MODE_MONITOR' | 'MODE_COMMENT' | 'MODE_BLOCK' | 'MODE_DISABLED' enum

New policy mode to set for the Rule.

  • MODE_MONITOR: Monitor mode, silently report findings
  • MODE_COMMENT: Comment mode, leaves PR comments but does not block
  • MODE_BLOCK: Block mode, leaves PR comments and blocks PR
  • MODE_DISABLED: Disabled mode, not active
valuedescription
MODE_MONITORMonitor mode, silently report findings
MODE_COMMENTComment mode, leaves PR comments but does not block
MODE_BLOCKBlock mode, leaves PR comments and blocks PR
MODE_DISABLEDDisabled mode, not active

Response

OK

policyIdstring int64

Policy ID (numeric). Find your policy's ID via the List Policies endpoint.

Example response

{
  "policyId": "456",
  "updatedRule": {
    "category": "security",
    "confidence": "CONFIDENCE_HIGH",
    "cweCategories": [
      "CWE-918: Server-Side Request Forgery (SSRF)"
    ],
    "languages": [
      "python"
    ],
    "lastChangeAt": "2024-07-29T22:33:37.380Z",
    "owaspCategories": [
      "A07: Cross-Site Scripting (XSS)"
    ],
    "path": "python.rule.1",
    "policyMode": "MODE_BLOCK",
    "registryMaintainer": "semgrep",
    "rulesets": [],
    "severity": "SEVERITY_HIGH",
    "source": "SOURCE_COMMUNITY",
    "technologies": [
      "django",
      "flask"
    ]
  }
}