contrib.nodejsscan.good_helmet_checks.helmet_header_nosniff

profile photo of semgrepsemgrep
Author
99
Download Count*
License

Content-Type-Options header is present. More information: https://helmetjs.github.io/docs/dont-sniff-mimetype/

Run Locally

Run in CI

Defintion

rules:
  - id: helmet_header_nosniff
    message: "Content-Type-Options header is present. More information:
      https://helmetjs.github.io/docs/dont-sniff-mimetype/"
    languages:
      - javascript
    severity: WARNING
    patterns:
      - pattern-not: |
          $HELMET(..., {noSniff: false}, ...)
      - pattern-either:
          - pattern: |
              $APP.use(helmet())
          - pattern: |
              helmet.noSniff()
          - pattern: |
              noSniff()
          - pattern: |
              helmet({noSniff: ...})
    metadata:
      category: security
      technology:
        - node.js
        - express
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]