semgrep.yml 991 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # Usage: semgrep scan -f semgrep.yml
  2. rules:
  3. - id: rule-0
  4. message: "find http requests made not with *fiber.Ctx available"
  5. languages: [go]
  6. severity: WARNING
  7. patterns:
  8. - pattern-either:
  9. - pattern: |
  10. http.UnwrapWebAPIRequest(...)
  11. - pattern: |
  12. http.WebAPIRequest(...)
  13. - pattern-not-inside: |
  14. func $FUNC(c *fiber.Ctx, ...) $RET {
  15. ...
  16. }
  17. - id: rule-1
  18. message: "find http requests made (limiter should be installed at all places)"
  19. languages: [go]
  20. # severity: INFO
  21. severity: INVENTORY
  22. patterns:
  23. - pattern-either:
  24. - pattern: |
  25. http.UnwrapWebAPIRequest(...)
  26. - pattern: |
  27. http.WebAPIRequest(...)
  28. - id: rule-2
  29. message: "gjson.Get without gjson.Valid"
  30. languages: [go]
  31. severity: ERROR
  32. patterns:
  33. # - pattern-inside: |
  34. # func $FUNC(...) $RET {
  35. # ...
  36. # }
  37. - pattern: |
  38. gjson.Get($X, ...)
  39. - pattern-not-inside: |
  40. if !gjson.Valid($X) {
  41. $...DISCARD
  42. }
  43. ...