generic.secrets.security.detected-snyk-api-key.detected-snyk-api-key

profile photo of semgrepsemgrep
Author
163
Download Count*

Snyk API Key detected

Run Locally

Run in CI

Defintion

rules:
  - id: detected-snyk-api-key
    pattern-regex: (?i)snyk.{0,50}['|"|`]?[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}['"\s]?
    languages:
      - regex
    message: Snyk API Key detected
    severity: ERROR
    metadata:
      cwe:
        - "CWE-798: Use of Hard-coded Credentials"
      category: security
      technology:
        - secrets
        - snyk
      confidence: LOW
      owasp:
        - A07:2021 - Identification and Authentication Failures
      references:
        - https://owasp.org/Top10/A07_2021-Identification_and_Authentication_Failures
      cwe2022-top25: true
      cwe2021-top25: true
      subcategory:
        - audit
      likelihood: LOW
      impact: MEDIUM
      license: Commons Clause License Condition v1.0[LGPL-2.1-only]
      vulnerability_class:
        - Hard-coded Secrets

Examples

detected-snyk-api-key.txt

# ruleid: detected-snyk-api-key
snyk_token: 12e45678-12e4-12e4-12e4-12e456789012

# ruleid: detected-snyk-api-key
API_SNYK='12e45678-12e4-12e4-12e4-12e456789012'

# ruleid: detected-snyk-api-key
snyktoken="12e45678-12e4-12e4-12e4-12e456789012"

# ruleid: detected-snyk-api-key
snyktoken=`12e45678-12e4-12e4-12e4-12e456789012`

# ok: detected-snyk-api-key
12e4567812e412e412e412e456789012

# ok: detected-snyk-api-key
other_token: 12e45678-12e4-12e4-12e4-12e456789012