.semgrep.yml
author Kim Alvefur <zash@zash.se>
Thu, 08 Jul 2021 18:21:59 +0200
changeset 11665 735b8f4a6d7e
parent 11293 c6965f3c321c
child 12721 898e99f49d80
permissions -rw-r--r--
net.http: Send entire HTTP request header as one write When opportunistic writes are enabled this reduces the number of syscalls and TCP packets sent on the wire. Experiments with TCP Fast Open made this even more obvious. That table trick probably wasn't as efficient. Lua generates bytecode for a table with zero array slots and space for two entries in the hash part, plus code to set [2] and [4]. I didn't verify but I suspect it would have had to resize the table when setting [1] and [3], although probably only once. Concatenating the strings directly in Lua is easier to read and involves no extra table or function call.

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]