open-nomad/.semgrep/http_endpoint.yml

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
677 B
YAML
Raw Normal View History

rules:
- id: "http-endpoint-request-decode-error-code"
patterns:
- pattern: |
if err := decodeBody(...); err != nil {
return nil, CodedError(...)
}
- pattern-not-inside: |
if err := decodeBody(...); err != nil {
return nil, CodedError(400, ...)
}
- pattern-not-inside: |
if err := decodeBody(...); err != nil {
return nil, CodedError(http.StatusBadRequest, ...)
}
message: "HTTP endpoint request decode should return http.StatusBadRequest"
languages:
- "go"
severity: "ERROR"
paths:
include:
- "command/agent/*_endpoint.go"