Skip to content

Configuration ​

CodeGuard reads codeguard.config.json from the project root. Unknown top-level keys and unknown rule IDs are validation errors.

json
{
  "language": "auto",
  "rules": {
    "typescript": true,
    "javascript": true,
    "security": {
      "SEC001": true,
      "SEC002": true,
      "SEC003": true,
      "SEC004": true,
      "SEC005": true
    },
    "architecture": {
      "ARCH001": true,
      "ARCH002": true
    }
  },
  "ignore": ["generated", "fixtures/**"]
}

Settings ​

  • language: auto, typescript, or javascript. The field is retained for compatibility; analyzer enablement is controlled under rules.
  • rules.typescript and rules.javascript: booleans. Both default to true.
  • rules.security and rules.architecture: booleans or maps of rule ID to boolean. Both default to false; unspecified rules in a map are disabled. Boolean true enables all rules in that analyzer.
  • ignore: project-relative names or glob patterns excluded from the scan.

Rule IDs ​

IDAnalyzerDetection
SEC001SecurityDynamic eval execution.
SEC002SecurityFunction constructor use.
SEC003SecurityDynamic command strings passed to selected child_process APIs.
SEC004SecurityNon-placeholder static strings assigned to credential-like names. Secret contents are omitted from findings.
SEC005SecurityString arguments to setTimeout or setInterval.
ARCH001ArchitectureCycles among scanned local modules.
ARCH002ArchitectureUnresolved relative or configured alias imports.

Security rules are pattern checks, not proof that a vulnerability is exploitable. See Analyzers for limits.

Validation ​

Malformed JSON, wrong setting types, unknown keys, and unsupported rule IDs cause CLI exit code 2. Correct the indicated setting and rerun the command. codeguard init (or the built local executable) creates a default file only when none exists.