Summary
A single-character difference —out.warn(authError) vs out.error(authError); process.exit(1) — determines whether a CLI tool enforces authentication or merely suggests it. In the STRATT CLI, all 4 write commands (publish, deprecate, gate, new) used warn, meaning unauthenticated users could publish units to R2, deprecate production units, and approve gate decisions.
The Problem
The auth check functioncheckPermission(operation) was correctly implemented — it verified JWT tokens, checked role hierarchy, and returned descriptive error messages. But the calling code treated the result as advisory:
The Fix
checkDomainAccess() was defined but never called from any command. We wired it into all write paths so domain-restricted tokens can’t write to unauthorized domains.
The Lesson
When auditing CLI security, search for the patternwarn(auth or warn(permission across all commands. Every warning about authentication is a security hole — auth decisions must be binary: proceed or exit.
The broader pattern: if a function returns an error and the caller ignores it by warning, the function might as well not exist. Auth checks that warn are security theatre.