Skip to content

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 high

The default path for both is balerx.lock. -o sets the lock output. -l sets the lockfile diff reads.

Drift kinds

KindSeverityRuleMeaning
MCP URL changedhighLOCK-URL-001A remote server URL changed, including a swap to another host
MCP auth changedhighLOCK-AUTH-001Remote authentication appeared or disappeared
MCP version, command, or args changedhighLOCK-VER-001 / LOCK-CMD-001 / LOCK-ARGS-001A server no longer matches the locked command. An args-only unpin is args drift, not a blank version
Auto-approve changedhighLOCK-PERM-001An approval setting flipped
New MCP servermediumLOCK-NEW-001A server is present that the lockfile did not record
Hooks disabledmediumLOCK-HOOK-001Hooks that were on are off
New agentlowLOCK-AGENT-001An agent definition appeared
Agent version changedlowLOCK-AGENT-003The reported agent version changed
Config hash changedlowLOCK-CFG-001The config file contents changed
Agent removedinfoLOCK-AGENT-002An agent from the lockfile is gone
MCP server removedinfoLOCK-RM-001A 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.