Security Architecture

How DocGovernance protects document integrity through cryptographic design.

Cryptographic Primitives

ComponentAlgorithmPurpose
Content hashingSHA-256Fingerprint every document and derived artifact. Hash is computed on original bytes before any transformation.
Event signingEd25519Every ledger event is signed with the server's Ed25519 private key. Signature covers the canonicalized event JSON.
JSON canonicalizationRFC 8785 (JCS)Deterministic sorted-key serialization ensures hash reproducibility across Node.js, Python, and browser verifiers.
Ledger chainingSHA-256 hash chainEach event includes the hash of the previous event. Any deletion or reordering breaks the chain.
Batch integrityMerkle tree (SHA-256)Order-sensitive Merkle root computed over event hashes. Batch integrity verifiable without reading every event.

Evidence Ledger Design

The ledger is an append-only JSONL file. Each line is a signed event record. The structure ensures:

Offline Verification

Every court bundle export contains two independent verifiers:

VerifierRuntimeNetwork required
verify.htmlAny modern browserNone — fully self-contained
dg-court-verify.cjsNode.js (any version ≥ 16)None — no external dependencies

Both verifiers check: SHA-256 content hashes, Ed25519 signature validity, hash chain continuity, Merkle root consistency, and key status (valid / rotated / revoked).

Key Management

Ed25519 keypairs are generated on first server start and persisted to PEM files. The public key registry is co-packaged with every exported bundle, enabling offline signature verification. Key rotation archives the old key with its rotation timestamp; all historical bundles continue to verify against the archived public key.

Upload Security

ControlDetail
Authentication requiredAll upload endpoints require a valid JWT. Unauthenticated requests return 401.
File type validationExtension allowlist + MIME type check + PDF magic bytes validation.
Size limits50MB per file, 500 pages per PDF.
Storage key randomizationOriginal filename stored as metadata only. Object storage keys are randomized UUIDs.
Hash before transformationSHA-256 of original bytes computed before any processing step.

Data in Transit and at Rest

All connections use TLS 1.2+. Document storage uses S3-compatible object storage with server-side encryption. Database connections use SSL. Signing keys are stored with filesystem permissions restricted to the application process.

AI Interrogation Safety

Document content is treated as untrusted input. System prompts and document text are strictly separated. AI output cannot create approvals, alter events, delete artifacts, or export bundles without explicit user action. Every AI report requires human review and approval before the report hash is written to the ledger.

Vulnerability Disclosure

If you discover a security vulnerability in DocGovernance, please report it responsibly to: [email protected]

We aim to respond within 48 hours and will work with you to understand and address the issue before public disclosure.