File

.semgrep.yml @ 13833:497efa2cbf2c 13.0

mod_storage_sql: Add shell command to create tables and indices (again) This is meant as a way to diagnose e.g. issues creating indices. It would have been nice to capture e.g. PostgreSQL notices, but LuaDBI would need support for this first, see https://github.com/mwild1/luadbi/issues/62
author Kim Alvefur <zash@zash.se>
date Wed, 09 Apr 2025 15:06:48 +0200
parent 13700:9b7687b47da9
line wrap: on
line source

rules:
- id: log-variable-fmtstring
  patterns:
    - pattern: log("...", $A)
    - pattern-not: log("...", "...")
  message: Variable passed as format string to logging
  languages: [lua]
  severity: ERROR
- id: module-log-variable-fmtstring
  patterns:
    - pattern: module:log("...", $A)
    - pattern-not: module:log("...", "...")
  message: Variable passed as format string to logging
  languages: [lua]
  severity: ERROR
- id: module-getopt-string-default
  patterns:
    - pattern: module:get_option_string("...", $A)
    - pattern-not: module:get_option_string("...", "...")
    - pattern-not: module:get_option_string("...", host)
    - pattern-not: module:get_option_string("...", module.host)
  message: Non-string default from :get_option_string
  severity: ERROR
  languages: [lua]
- id: stanza-empty-text-constructor
  patterns:
    - pattern: $A:text()
  message: Use :get_text() to read text, or pass a value here to add text
  severity: WARNING
  languages: [lua]
- id: require-unprefixed-module
  patterns:
    - pattern: require("$X")
    - metavariable-regex:
        metavariable: $X
        regex: '^(core|net|util)\.'
  message: Prefix required module path with 'prosody.'
  severity: ERROR
  languages: [lua]