Skip to content

Sentinel rules reference

Every Sentinel rule that ships with v1.0 — the 10 built-in HEX/NAM/SEC/TEST rules implemented in Go and the 11 documented YAML-loadable rules in the ARC/SEC/QC/DEPS families.

Updated: 2026-04-30

This is the canonical list of every Sentinel rule shipping with Korva v1.0. The first ten are implemented in Go inside the binary; the remaining are documented templates you can drop in .korva/rules/<rule-id>.yaml to enable.

Built-in rules (Go)

Hexagonal architecture

IDSeverityDetects
HEX-001ErrorDomain layer importing from infrastructure or application
HEX-002ErrorApplication layer importing from infrastructure
HEX-003Errorconsole.* in src/ (excluding tests)
HEX-004Errornew XAdapter(...) outside *.module.ts
HEX-005Warning: any without a // korva-ignore: <reason>

Naming

IDSeverityDetects
NAM-001ErrorSuffix Dto instead of DTO
NAM-002ErrorDI port token not SCREAMING_SNAKE_CASE
NAM-003WarningFiles in /adapters/ not following *.adapter[.variant].ts

Security

IDSeverityDetects
SEC-001ErrorHardcoded secrets — password, api_key, secret, token literals

Testing

IDSeverityDetects
TEST-001WarningTests in __tests__/ or test/ instead of co-located

Documented rules (YAML, opt-in)

Drop a <rule-id>.yaml file into .korva/rules/ and Sentinel will load it. The full canonical reference lives in sentinel/rules/AGENTS.md in the public repo.

Architecture (ARC-*)

IDDetects
ARC-001Imports of frameworks (express, nestjs, prisma…) inside domain/core
ARC-002Functions over 25 LOC or DB calls inside HTTP handlers
ARC-003db.query, prisma.*, mongoose.* outside repository/store

Security (SEC-* extensions)

IDDetects
SEC-002logger.info(password), console.log(token) with sensitive variable names
SEC-003Direct equality (==/===) over token / secret / HMAC / signature (timing attack)
SEC-004CORS with origin: "*" or Access-Control-Allow-Origin: *
SEC-005SQL in template literals with interpolation
SEC-006/admin, /internal, /users/:id routes without auth middleware

Quality control (QC-*)

IDDetects
QC-001console.log, debugger;, breakpoint() in src/
QC-002: any / as any without justification

Dependencies (DEPS-*)

IDDetects
DEPS-001Imports of vulnerable packages (lodash<4.17.21, moment, node-serialize, eval())

Suppressions

Inline comment on the same line as the violation:

const publicData: any = response.data // korva-ignore: external API, no static type available

A bare // korva-ignore (no reason) is itself a violation.

Profiles

ProfileActive rulesUse case
minimalSEC-001Just starting
standard (default)HEX-001/002/003 + SEC-001Most teams
strictAll built-in rulesMature teams

Pick the profile via --profile <name> or set KORVA_SENTINEL_PROFILE.

Adding a custom rule

  1. Drop my-rule.yaml into .korva/rules/.
  2. Specify a regex pattern, file glob, severity (error / warning), and a one-line message.
  3. Run korva sentinel check to verify it fires where you expect.
  4. Commit it — your team picks it up automatically when they pull.

Output formats

Terminal window
# Text — humans
korva sentinel check
# JSON — CI / tooling
korva-sentinel --format json

JSON shape:

{
"scanned": 12,
"passed": 10,
"failed": 2,
"findings": [
{
"rule": "SEC-001",
"severity": "error",
"file": "src/auth/AuthService.ts",
"line": 14,
"message": "Hardcoded secret detected",
"snippet": "const secret = \"sk_live_4xK9mP...\""
}
]
}

Next