rules:
- id: ajv-allerrors-true
  message: >-
    By setting `allErrors: true` in `Ajv` library, all error objects will be allocated without limit.
    This allows the attacker to produce a huge number of errors which can lead to denial of service. Do
    not use `allErrors: true` in production.
  metadata:
    cwe:
    - 'CWE-400: Uncontrolled Resource Consumption'
    category: security
    technology:
    - ajv
    references:
    - https://ajv.js.org/options.html#allerrors
    cwe2022-top25: true
    subcategory:
    - audit
    likelihood: LOW
    impact: LOW
    confidence: LOW
  languages:
  - javascript
  - typescript
  severity: WARNING
  pattern-either:
  - pattern: |
      new Ajv({...,allErrors: true,...},...)
  - patterns:
    - pattern: |
        new Ajv($SETTINGS,...)
    - pattern-inside: |
        $SETTINGS = {...,allErrors: true,...}
        ...
