← Security & Compliance

Arkhivio Backup Framework — HIPAA Compliance Report

Document date: 2026  ·  Regulation: 45 CFR Parts 160 & 164 (HIPAA Security Rule)  ·  Grounded in source-code review

Scope: This report assesses the Arkhivio Backup Framework as a tool handling electronically protected health information (ePHI) against the HIPAA Security Rule. It covers technical and architectural controls only. Organisational policies, workforce training, risk analyses, and Business Associate Agreements remain the responsibility of the operating organisation. This document does not constitute a legal compliance certification.

Executive Summary

6
Controls satisfied
by design
1
Config required
(cloud console)
0
Operational gaps
(no code required)
1
External / contractual
action required
Verdict: Compliant-capable with operational configuration. The framework satisfies all HIPAA Security Rule technical safeguard requirements for unique user identification, automatic logoff, audit controls, data integrity, person authentication, transmission security, and emergency access. The one remaining technical gap — ePHI encryption at rest on S3 — is closed entirely through cloud-console configuration (SSE-KMS); no code change is required. Executing a Business Associate Agreement with each cloud provider completes the legal layer.
Satisfied Implemented in code, active by default
Config required Capability exists; must be enabled via cloud settings
Operational gap No code change needed; operator action required
External Outside tool scope; legal/contractual action
How each gap is closed:
OPS Operational procedure or deployment configuration — no code change
EXT External system, cloud console, or legal/contractual action
CODE Change inside this repository

HIPAA — 45 CFR Parts 160 & 164

Unique user identification
§164.312(a)(2)(i) — assign unique names/IDs to each user
Satisfied

Local backend supports distinct admin and operator accounts with independent credentials. AD backend authenticates and identifies individual directory users by their username. The authenticated identity is stored as session["username"] and is available to every request handler.

Automatic logoff
§164.312(a)(2)(iii) — terminate session after predetermined inactivity
Satisfied

Implemented. SessionMiddleware in main.py is configured with max_age=_SESSION_TIMEOUT, where _SESSION_TIMEOUT = int(os.environ.get("SESSION_TIMEOUT_SECONDS", "3600")). Default is 1 hour. Set SESSION_TIMEOUT_SECONDS=900 in .env for a HIPAA-strict 15-minute timeout. The session cookie expires client-side and the server rejects replayed cookies past max_age.

Encryption and decryption of ePHI
§164.312(a)(2)(iv) — encrypt ePHI in storage and transit
Config required

Transit: all S3 and MongoDB traffic uses TLS enforced by boto3 and the MongoDB driver. Storage: SSE-KMS with a customer-managed key (CMK) must be enabled on the S3 bucket. For HIPAA, SSE-KMS is strongly preferred over SSE-S3 because the CMK is under your control and its usage is auditable in AWS CloudTrail. This is a bucket-level configuration; no framework code change is needed.

→ Closed by external / cloud configuration EXT
  • S3 bucket encryption: AWS Console → S3 → your bucket → Properties → Default encryption → Enable → SSE-KMS → select or create a CMK in AWS KMS. Alternatively: aws s3api put-bucket-encryption --bucket <name> --server-side-encryption-configuration '{"Rules":[{"ApplyServerSideEncryptionByDefault":{"SSEAlgorithm":"aws:kms","KMSMasterKeyID":"<key-arn>"},"BucketKeyEnabled":true}]}'
  • Enforce KMS-only uploads: Add a bucket policy denying s3:PutObject requests that do not include "s3:x-amz-server-side-encryption": "aws:kms" as a condition. This prevents unencrypted objects from being written even if the framework default were changed.
  • MongoDB TLS: Add tls=true&tlsCAFile=/path/to/ca.pem to MONGO_OPTIONS in .env. On Atlas, TLS is enforced by default and cannot be disabled.
  • Key rotation: Configure automatic annual CMK rotation in AWS KMS (Console → KMS → Customer managed keys → your key → Key rotation). No code change required; KMS transparently re-encrypts data keys.
Audit controls
§164.312(b) — record and examine activity on systems containing ePHI
Satisfied

All 6 write endpoints (create/update/delete for jobs and buckets) emit a named audit_* log event that includes the authenticated user and the affected resource. These join the full operation log stream produced by every module. Sample:

{"ts": "2026-03-15T14:32:07.441Z", "event": "audit_job_created", "user": "alice", "job": "db-backup"}
{"ts": "2026-03-15T16:01:33.210Z", "event": "audit_job_deleted", "user": "bob", "job_id": "web-01:old-job"}
{"ts": "2026-03-15T16:05:44.771Z", "event": "audit_bucket_created", "user": "alice", "bucket": "prod"}
{"ts": "2026-03-15T16:09:55.194Z", "event": "audit_bucket_deleted", "user": "bob", "bucket": "old"}
{"ts": "2026-03-15T08:11:02.100Z", "event": "scan_completed", "job": "db-backup", "stats": {...}}
{"ts": "2026-03-15T08:11:22.883Z", "event": "upload_complete", "job": "db-backup", "files": 412}

All timestamps are UTC ISO-8601. Logs can be forwarded to an immutable log store (S3, CloudWatch Logs, Splunk) via the integrations documented in LOG_INTEGRATION.md. For HIPAA, configure log retention to ≥ 6 years (2,190 days).

Integrity controls for ePHI
§164.312(c)(1) — protect ePHI from improper alteration or destruction
Satisfied

CRC32 stored per file in both MongoDB and S3 object metadata provides tamper evidence. The 3-check audit command (audit.py) detects any divergence between the local catalogue and S3. S3 Object Lock (WORM) — configurable on the bucket — prevents deletion or overwrite for a defined retention period, satisfying the destruction-prevention requirement.

Person or entity authentication
§164.312(d) — verify identity of persons seeking access
Satisfied

Local backend: secrets.compare_digest prevents timing-based credential inference. AD backend: LDAP bind validates the password against the directory server; group membership (memberOf) determines the role. HMAC-signed session cookies prevent session forgery. A bad or missing SESSION_SECRET causes an immediate RuntimeError at import time — the server cannot start in a partially-configured state.

Transmission security
§164.312(e)(1) — guard against unauthorised access to ePHI in transit
Satisfied

All S3 operations use HTTPS via boto3 (TLS 1.2+ enforced by AWS/Cloudflare endpoints). MongoDB connections support TLS via the URI options. config.py warns at startup if TLS is disabled on a non-local MongoDB URI. Additionally, a bucket policy aws:SecureTransport: true can be applied to reject all plain-HTTP requests at the storage layer.

Emergency access procedure
§164.312(a)(2)(ii) — obtain necessary ePHI during emergency
Satisfied

restore_onlys3.py provides a documented, tested recovery path that requires only S3 credentials — no MongoDB, no framework installation, no database restoration needed. Files are plain objects at human-readable paths, accessible with any S3-compatible tool in an emergency.

Business Associate Agreement
§164.308(b) — BAA required with all sub-processors handling ePHI
External

The framework is self-hosted Python — no BAA with a vendor is required for the software itself. A BAA must be executed with each cloud provider storing ePHI: AWS (covers S3 and optionally MongoDB Atlas), Cloudflare (R2 BAA available for HIPAA customers), MongoDB Atlas (Atlas BAA available on M10+ clusters). Free-tier Atlas M0 is not HIPAA-eligible.

→ Closed by external / legal action EXT
  • AWS BAA: Available to all AWS customers at no cost. Accept via AWS Console → Account → Agreements → Business Associate Addendum. Covers S3, KMS, CloudWatch Logs, and other HIPAA-eligible services.
  • Cloudflare R2 BAA: Available under the Cloudflare Enterprise plan with HIPAA compliance add-on. Contact Cloudflare sales or submit a request via the dashboard → Support → HIPAA.
  • MongoDB Atlas BAA: Available on M10+ dedicated clusters. Request via Atlas console → Legal → Business Associate Agreement, or contact MongoDB sales. M0/M2/M5 shared clusters are not HIPAA-eligible.
  • Tip: Before signing a BAA, verify the exact list of services covered. For AWS, only services listed on the AWS HIPAA Eligible Services page are covered under the BAA.

Configuration Checklist

Actions required before a production deployment handling ePHI under HIPAA.

#ActionHow resolvedWhereRegulation
1 Enable SSE-KMS with a customer-managed key on the S3 bucket EXT AWS / Cloudflare console §164.312(a)(2)(iv)
2 Set SESSION_TIMEOUT_SECONDS in .env (default 3600 s; use 900 s for a stricter 15-minute timeout) OPS .env §164.312(a)(2)(iii)
3 Enable TLS on MongoDB connection (MONGO_OPTIONS=tls=true&tlsCAFile=…) OPS .env §164.312(e)(1)
4 Store BACKUP_SECRET_KEY in a secrets manager, not a flat file. Set SECRETS_PROVIDER in .env to activate one of the 6 built-in integrations. OPS .env / secrets provider §164.312(a)(2)(iv)
5 Enable S3 Object Lock (WORM) on the bucket for the required retention period EXT AWS / Cloudflare console §164.312(c)(1)
6 Forward log output to an immutable log store (CloudWatch Logs, Splunk, Loki). Set LOG_FILE in .env and configure a log shipper per LOG_INTEGRATION.md. Set retention to ≥ 2,190 days (6 years). OPS .env / log shipper §164.312(b)
7 Execute BAA with AWS, Cloudflare, and/or MongoDB Atlas EXT Legal / provider portals §164.308(b)

Architectural Strengths for HIPAA

CapabilityHow it supports HIPAA
Fernet encryption of credentialsA MongoDB breach alone cannot expose S3 data. Encryption key optionally held in 6 external secrets managers (AWS SM, Azure KV, GCP, IBM, Vault, OpenBao), completely off disk.
Minimal data in MongoDBOnly metadata (path, size, mtime, CRC32) — no file content ever stored in the catalogue. Reduces ePHI surface to path names, minimising breach impact.
Structured JSON logs with UTC timestampsMachine-parseable, directly ingestible by every major SIEM. Immutable when forwarded. Timestamps are ISO-8601 UTC, satisfying §164.312(b) audit control requirements.
Named audit events on all write operationsaudit_job_created/updated/deleted and audit_bucket_created/updated/deleted record the actor, resource, and time for every privileged action — required by §164.312(b).
Startup fail-fast validation_validate_config() in auth.py raises RuntimeError before the server starts if SESSION_SECRET, credentials, or AD variables are missing — prevents running in a degraded security state.
3-check integrity auditOn-demand verifiable evidence that ePHI backups are intact and recoverable. JSON output satisfies §164.312(c)(1) integrity and §164.308(a)(7) contingency testing requirements.
S3-only disaster recoverySatisfies §164.312(a)(2)(ii) emergency access requirement. Only S3 credentials needed — no MongoDB, no framework binary during a crisis.
HIPAA-annotated session timeoutSource comment at main.py:27 explicitly references §164.312(a)(2)(iii). Default 3,600 s; configurable down to 900 s via SESSION_TIMEOUT_SECONDS for stricter environments.
Important disclaimer: This report is a technical assessment produced by automated analysis of the source code. It does not constitute legal advice, a formal compliance audit, or a HIPAA certification. Compliance determinations must be validated by a qualified legal and/or compliance specialist. This report does not address administrative safeguards (workforce training, risk analysis, sanction policy) or physical safeguards, which are organisational responsibilities.