yaml.semgrep.metadata-confidence-incorrect-value.metadata-confidence-incorrect-value

profile photo of semgrepsemgrep
Author
unknown
Download Count*

Semgrep rule confidence: $VALUE detected, but the value must be LOW, MEDIUM, or HIGH. For more information visit: https://semgrep.dev/docs/contributing/contributing-to-semgrep-rules-repository/

Run Locally

Run in CI

Defintion

rules:
  - id: metadata-confidence-incorrect-value
    patterns:
      - pattern-inside: |
          rules: 
            ...
      - pattern-inside: |
          metadata: 
            ...
            category: security
            ...
      - pattern: |
          confidence: $VALUE
      - pattern-not: |
          confidence: LOW
      - pattern-not: |
          confidence: MEDIUM
      - pattern-not: |
          confidence: HIGH
    message: "Semgrep rule confidence: $VALUE detected, but the value must be LOW,
      MEDIUM, or HIGH. For more information
      visit:  https://semgrep.dev/docs/contributing/contributing-to-semgrep-rul\
      es-repository/"
    languages:
      - yaml
    severity: WARNING
    metadata:
      references:
        - https://semgrep.dev/docs/contributing/contributing-to-semgrep-rules-repository/
      category: correctness
      technology:
        - semgrep
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

metadata-confidence-incorrect-value.test.yaml

rules:
  - id: require-request
    message: >-
      If an attacker controls the x in require(x) then they can cause code to load that was not intended to run on the server.
    severity: LOW
    languages: [javascript, typescript]
    metadata:
      owasp: "A03:2021 - Injection"
      cwe: "CWE-706: Use of Incorrectly-Resolved Name or Reference"
      source-rule-url: https://nodesecroadmap.fyi/chapter-1/threat-UIR.html
      category: security
      likelihood: lOW
      # ruleid: metadata-confidence-incorrect-value
      confidence: lOW
      technology:
        - express
      references:
        - https://github.com/google/node-sec-roadmap/blob/master/chapter-2/dynamism.md#dynamism-when-you-need-it
    patterns: 
  - id: require-request
    message: >-
      If an attacker controls the x in require(x) then they can cause code to load that was not intended to run on the server.
    severity: LOW
    languages: [javascript, typescript]
    metadata:
      owasp: "A03:2021 - Injection"
      cwe: "CWE-706: Use of Incorrectly-Resolved Name or Reference"
      source-rule-url: https://nodesecroadmap.fyi/chapter-1/threat-UIR.html
      category: security
      # ok: metadata-confidence-incorrect-value
      confidence: LOW
      technology:
        - express
      references:
        - https://github.com/google/node-sec-roadmap/blob/master/chapter-2/dynamism.md#dynamism-when-you-need-it
    patterns: