DOCS
Lockfile and drift
A lockfile is a snapshot of the agents and MCP servers the scanner found. Drift is the difference between that file and the machine today.
Paths in the file are relative to the home directory (~/...). The hostname is not recorded. Each agent entry includes a SHA-256 of the config file contents, so a rewritten file is its own drift kind even when the server list looks the same.
MCP command, args, and package name and version are stored after URL redaction. Command and args also redact credential-like long flags (-- names containing token, secret, password, passwd, key, auth, credential, or cookie, with a following value or =value), -H / --header values that carry Authorization, Cookie, X-Api-Key, or X-Auth*, and inline shell -c strings when the shell is command or an arg. Benign query parameters such as authSource, sslmode, and mode stay. Userinfo is taken from the @ in the authority only, so a path such as /pkg@latest stays. A / inside what looks like userinfo ends the authority, so that value is a path and is not redacted. Values that appear only in a URL path are not redacted. The per-server hash is computed from name, command, args, and URL only. It does not include headers, env, or credential values. Auth presence is stored as a boolean and compared on its own. An older lockfile of the same machine does not report command, args, or version drift after you upgrade the scanner. Lockfiles from before this version omit url and auth; missing fields are not HIGH drift. Re-run balerx lock to start tracking them. A lockfile written by this version shows spurious command/args drift when read by an older scanner (v0.1.5 and earlier). Run balerx lock with the same version everywhere. balerx diff also redacts credentials in printed command-change and version-change messages, including scheme-less host/path query fragments.
balerx lock --output balerx.lock
balerx diff --lockfile balerx.lock
balerx diff --fail-on highThe default path for both is balerx.lock. -o sets the lock output. -l sets the lockfile diff reads.
Drift kinds
| Kind | Severity | Rule | Meaning |
|---|---|---|---|
| MCP URL changed | high | LOCK-URL-001 | A remote server URL changed, including a swap to another host |
| MCP auth changed | high | LOCK-AUTH-001 | Remote authentication appeared or disappeared |
| MCP version, command, or args changed | high | LOCK-VER-001 / LOCK-CMD-001 / LOCK-ARGS-001 | A server no longer matches the locked command. An args-only unpin is args drift, not a blank version |
| Auto-approve changed | high | LOCK-PERM-001 | An approval setting flipped |
| New MCP server | medium | LOCK-NEW-001 | A server is present that the lockfile did not record |
| Hooks disabled | medium | LOCK-HOOK-001 | Hooks that were on are off |
| New agent | low | LOCK-AGENT-001 | An agent definition appeared |
| Agent version changed | low | LOCK-AGENT-003 | The reported agent version changed |
| Config hash changed | low | LOCK-CFG-001 | The config file contents changed |
| Agent removed | info | LOCK-AGENT-002 | An agent from the lockfile is gone |
| MCP server removed | info | LOCK-RM-001 | A server from the lockfile is gone |
balerx diff --fail-on high exits 1 when any HIGH drift is present, including an evil-URL swap or an auth header appearing. A hash-only MCP change is not HIGH. Without --fail-on, any drift still exits 1.
Review high drift before you refresh the lockfile. Updating the lockfile makes the new state the baseline. It does not undo the change on disk.
Upload can attach the same drift to a machine. See Upload and fleet.
