v1

latestOpenAPI 3.1.02026-07-261690320.7 KB

Edit custom rule

Edit a custom semgrep rule

put/repositories/sast/custom-rules/{rule_id}

Path parameters

rule_idinteger required

The ID of the custom rule

Request body

semgrep_rulestring required

The semgrep rule

issue_titlestring required

The title of the issue associated with this semgrep rule

tldrstring required

A summary of what the issue associated with this semgrep rule is

how_to_fixstring required

A description on how to fix the issue associated with this semgrep rule

priorityinteger required

A numeric value from 1 to 100 indicating how severe the issue associated with this semgrep rule is

language'JS' | 'TS' | 'PHP' | 'Java' | 'Scala' | 'GO' | 'PY' | 'Ruby' | '.NET' | 'RUST' | 'Dart' | 'Swift' | 'Elixir' | 'C' | 'Clojure' | 'kotlin' | 'terraform' | 'generic' required

The programming language associated with this semgrep rule

Example request

{
  "semgrep_rule": "rules:\n- id: CUSTOM-RULE-1\n  pattern: console.log(...)\n  message: Semgrep found a debug statement\n  languages: [javascript]\n  severity: WARNING",
  "issue_title": "console.log",
  "priority": 20,
  "tldr": "console.log should be avoided in frontend applications",
  "how_to_fix": "remove the console.log",
  "language": "JS"
}

Response

The custom rule has successfully been updated

successinteger

the integer 1 indicating success

Example response

{
  "success": 1
}