yaml.semgrep.metadata-technology.metadata-technology

profile photo of returntocorpreturntocorp
Author
198
Download Count*

This Semgrep rule is missing a 'technology' field in the 'metadata'. Consider adding a list of technologies based on the rule's associated library or framework, or another piece of relevant information.

Run Locally

Run in CI

Defintion

rules:
  - id: metadata-technology
    message: This Semgrep rule is missing a 'technology' field in the 'metadata'.
      Consider adding a list of technologies based on the rule's associated
      library or framework, or another piece of relevant information.
    severity: INFO
    patterns:
      - pattern-inside: "rules: [..., $RULE, ...]"
      - pattern: |
          id: ...
          ...
      - pattern-not: |
          id: ...
          ...
          metadata:
            ...
            technology:
              - ...
    languages:
      - yaml
    metadata:
      category: best-practice
      technology:
        - semgrep
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]

Examples

metadata-technology.test.yaml

rules:
  # ruleid: metadata-technology
  - id: unchecked-subprocess-call
    patterns:
      - pattern-either:
          - pattern: |
              subprocess.call(...)
          - pattern: |
              subprocess.call(...)
      - pattern-not-inside: |
          $S = subprocess.call(...)
      - pattern-not-inside: |
          subprocess.call(...) == $X
    message: >-
      bad stuff
    severity: WARNING
    fix: subprocess.check_call(...)
    metadata:
      category: best-practice
  # ok: metadata-technology
  - id: subprocess-run
    patterns: subprocess.run(...)
    message: >-
      bad stuff
    severity: WARNING
    fix: subprocess.check_call(...)
    metadata:
      category: python
      technology:
        - semgrep
  # ok: metadata-technology
  - metadata:
      category: python
      technology:
        - semgrep
    id: subprocess-run-2
    patterns: subprocess.run(...)
    message: >-
      bad stuff
    severity: WARNING
    fix: subprocess.check_call(...)