dgryski.semgrep-go.http-ctx-goroutine.http-request-go-context

profile photo of dgryskidgryski
Author
unknown
Download Count*
License

passing an http-request scoped Context to a goroutine

Run Locally

Run in CI

Defintion

rules:
  - id: http-request-go-context
    patterns:
      - pattern-either:
          - pattern: |
              $CTX := ($R : *http.Request).Context()
              ...
              go $F($CTX, ...)
          - pattern: |
              go $F(($R : *http.Request).Context(), ...)
    message: passing an http-request scoped Context to a goroutine
    languages:
      - go
    severity: ERROR
    metadata:
      license: MIT