Security, integrity and chain of custody
An evidence analysis workbench must be completely precise about what it can and cannot guarantee. Verity guarantees that every artifact read by its detectors, forensic analyzers, web console, and reports is byte-identical to the admitted working copy — and packages complete case records with standard SHA256SUMS.txt proofs for external custody transfer. It does not certify pre-ingest capture chain of custody, and it delegates user authentication to loopback isolation or a reverse proxy.
Content-addressed identity & read-only admission
MediaIngestor.ingest (src/verity/ingest/media_ingestor.py) streams every incoming file in 64 KiB chunks to compute its full SHA-256 checksum, derives media_id = checksum[:12], copies the bytes once into workspace/media/<media_id><suffix>, marks the working copy read-only (chmod 0o444), and records original_path, size_bytes, full checksum, and UTC ingest timestamp in .{media_id}.json.
When DetectorRunner._prepare_input_dir launches a detector subprocess, the detector receives an ephemeral copy of the working copy inside a temp directory — never the workspace/media/ file itself — so even a malfunctioning detector cannot mutate admitted evidence.
Live integrity verification
verify_integrity (src/verity_api/service.py) backing POST /api/media/{id}/verify re-hashes the read-only working copy on demand and compares both size and SHA-256 against the ingest record (plus the original source path if still reachable on disk). This allows an investigator to demonstrate integrity live during review.
Chain-of-custody Evidence Preservation Bundle (verity export)
For court exhibits, cross-team peer review, and immutable offline archiving, export_evidence_bundle (src/verity/export.py), exposed via verity export --media-id <id>, GET /api/media/{id}/export, and the Web UI's Export evidence bundle (.zip) action:
- Verifies the read-only working copy's byte size and SHA-256 against
.{media_id}.jsonbefore archiving (exiting non-zero via CLI on mismatch). - Packages cleanly organized files:
media/<original_name>andmedia/ingest_record.jsonreport/{report.html,report.pdf,analysis.json,selection.json}forensics/*(JSON and PNG diagnostic figures)detectors/<id>/*(result.json,finding.json,faces/,frames/,full_frames/,attention_maps/,reconstructions/,timeline.png, logs)
- Writes
MANIFEST.json(schema: "verity-evidence-bundle/1", media hashes, offline flag, findings summary, forensics counts, and exact per-file metadata) plusSHA256SUMS.txtsorted lexicographically across every archived entry andMANIFEST.jsonitself.
An external auditor can verify every byte inside an unpacked archive using plain sha256sum -c SHA256SUMS.txt (tests/test_packaging_and_export.py), with zero dependency on Verity software.
Offline air-gap seal (config.yaml & VERITY_OFFLINE)
src/verity/paths.py enforces air-gap discipline via is_offline():
- Setting
VERITY_OFFLINE=1immediately overrides runtime behavior. - Running
verity setup --trained --airgap-ready(orverity airgap import) verifies local checkpoints and persistsoffline: trueinside<config_dir>/config.yamlviasave_user_config(). - Once sealed,
DetectorSelectorexcludes uncached external models,env_managerforcesHF_HUB_OFFLINE=1,TRANSFORMERS_OFFLINE=1,DIFFUSERS_OFFLINE=1,UV_OFFLINE=1, andUV_NO_PYTHON_DOWNLOADS=1on every subprocess, and the API never initiates outbound model fetches.
Confined file serving, upload bounds, and safe deletion
- Path confinement (
src/verity_api/files.py):resolve_within_roots()resolves query paths withstrict=True(following symlinks first) and returns403outsideSettings.readable_roots(workspace,output_dir,detectors_dir) and415for any suffix not inALLOWED_SUFFIXES(blocking arbitrary filesystem reads). - Streaming upload cap:
POST /api/mediastreams multipart uploads to disk in 1 MiB chunks up toMAX_UPLOAD_BYTES(2 GiB, else413). - Explicit deletion:
DELETE /api/media/{id}requires?confirm=true, removes only workspace/output artifacts, and never touches the original source file outside the workspace. - Per-case lock:
JobManagerraises409 Conflictif a non-terminal job already targets the samemedia_id.
Authentication and workstation exposure
Because Verity is built for single-investigator workstations and air-gapped labs, the API ships without authentication or user roles (docker-compose.yml and verity serve bind to 127.0.0.1:8000 by default, and deploy/install.sh refuses non-loopback binds without --allow-network). Remote operators should use SSH port forwarding (ssh -L 8000:localhost:8000 user@host) or place TLS + authentication at a reverse proxy (Caddy / nginx).
Related pages
- Ingest and media analysis — initial SHA-256 admission.
- Weights and checkpoints — SHA-256 gate on model weights.
- Web API and investigator console — endpoints and integrity checks.
- Deployment, configuration and air-gap operations —
setup --airgap-readyand USB transfer kits.