Audit integrity

What lets someone outside Soter check that a process's audit trail is the one the platform recorded at the time, and that nobody has changed it since, without trusting the platform. Three pieces:

  1. Sessions. Every audit entry records the session it came from: the identity provider's session id (sid), else the token id (jti), else a digest of the token, or the personal access token's id. Automatic work records the ProcessOS worker run or tick, the release run, or the operator run of a command run by hand. Taken from the verified credential only; nothing in a request can name it. Shown on step views (updatedBySessionId) and record timeline entries (sessionId). History recorded before this has none.
  2. The chain. Every write to a process appends one event to that process's chain: the Merkle root of its audit state after the write (each recorded value a salted leaf), the length of each audit list, the sessions on the entries the write added or changed, and the hash of the previous event. The stores keep the chain beside the process and never return it from a read. A value changed afterwards by any means no longer matches.
  3. Anchors. Once a day the worker writes one object listing every process's chain head to write-once storage (retention-locked; the platform cannot change or delete it). A head anchored there can no longer be rewritten unnoticed, even by someone with the database.

Commands

CommandDoes
npm run audit:verify [-- --id <processId>] [--json]Recomputes every chain (or one) against the stored state; names the first value that no longer matches. Never writes.
npm run audit:genesis [-- --yes] [--as <userId>]Starts the chain of every process recorded before chaining (one genesis event over its stored state). Run once; see the order below.
npm run audit:correct -- --id <processId> --reason "<why>" --yes [--as <userId>]Records a data fix made outside the platform: a correction event with its reason, sealing the state as now stored.
npm run audit:anchor [-- --daily]Writes an on-demand anchor now (before a report goes into a data room); --daily writes today's if the worker has not.

audit:genesis and audit:correct are commands run by hand: they act as the operator (--as or PROCESS_OPERATOR_USER_ID), like the migration commands.

Configuration

Variable
PROCESS_AUDIT_ANCHOR_STOREs3 or file. Unset: anchoring is off and the worker says so at start.
PROCESS_AUDIT_ANCHOR_S3_ENDPOINThttps://… S3-compatible API endpoint (AWS S3, Cloudflare R2, GCS interoperability, MinIO).
PROCESS_AUDIT_ANCHOR_S3_BUCKETA bucket with Object Lock enabled (compliance mode).
PROCESS_AUDIT_ANCHOR_S3_REGIONThe bucket's region (auto for R2).
PROCESS_AUDIT_ANCHOR_S3_ACCESS_KEY_ID, PROCESS_AUDIT_ANCHOR_S3_SECRET_ACCESS_KEYA key that may put and read objects in the bucket, and nothing else (no delete, no lock changes).
PROCESS_AUDIT_ANCHOR_S3_PREFIXOptional key prefix (e.g. the deployment id).
PROCESS_AUDIT_ANCHOR_DIRFor file: a local directory. Development and tests only: a local disk is within the platform's reach.
PROCESS_AUDIT_ANCHOR_HOUR_UTCHour after which the daily anchor is written (default 0).

Set on the worker (and wherever audit:anchor runs). Anchors are retained 3650 days. Use a cloud account separate from the one the platform runs in, so nobody who administers the platform can lift the lock.

Rolling it out

Order matters, because the chain vouches for history as it stands when it starts:

  1. Finish pending data fixes (actor names, vote notes, the automation remap).
  2. Deploy. From then on every new process is chained from its creation, and an existing process starts its chain at its next write.
  3. npm run audit:genesis -- --yes --as <you> to start the chain of every remaining process now.
  4. Configure the anchor store on the worker; the first daily anchor follows.
  5. npm run audit:verify should report every process verified.

After that, a data fix made directly in the database must be followed by audit:correct with its reason: the fix is recorded openly, and the anchors written before it still show the state before it.

Checking a report

GET /api/process/<id>/audit-evidence?mode=external|full returns the evidence: the chain's events, the recorded values the report shows with their revealed leaf salts and Merkle proofs, and the latest anchor that commits the chain (or null: not yet anchored). External (default) shows what someone with no internal permission may read, to anyone who may read the process; values withheld from them appear only as hashes inside proofs. Full shows every recorded value, to holders of processes:audit or processes:read_all. It refuses (409) when the chain does not verify.

A recipient checks it with applications/main/scripts/verify-audit-evidence.mjs, a single file with no dependencies:

node verify-audit-evidence.mjs evidence.json anchor.json

anchor.json is the anchor object read from the write-once store (key in evidence.anchor.key). The verifier recomputes every event hash and link, proves every shown value into the chain's latest root, proves the anchored head into the anchor's root, and checks the anchor object lists that head.

What this does and does not prove

  • It proves the trail is unchanged since the anchor that covers it. Events after the newest anchor are covered by the next one (pendingEvents); anchor on demand before a report goes out.
  • It does not prove who sat at the keyboard: an entry names the account and session that wrote it. Sessions match the identity provider's login records.
  • The chain does not stop someone with the database from rewriting history before it is anchored; the anchor does. The anchor's protection is the store's retention lock, so the store's credentials and account must stay outside the platform's administration.
  • Anchors are not signed. A signed anchor (or one published on a public chain) is a later step if a recipient needs it.