Version: 1.1.0
Last Updated: 2025-11-09
Classification: Public
JSON✯Atomic is a ledger-based constitutional governance platform that provides cryptographic integrity for atomic execution units. This document identifies potential threats, attack vectors, and mitigations for the system.
- Core Library - TypeScript/Node.js module for ledger operations
- CLI Tools - Command-line interface (Deno runtime)
- Playground - Browser-based UI for atomic creation
- Ledger Storage - Append-only NDJSON file storage
- Verification System - Streaming hash and signature verification
- Executor - Code execution engine (safe-by-default)
┌─────────────────────────────────────────────┐
│ External Network / Users │
└──────────────┬──────────────────────────────┘
│
┌──────────────▼──────────────────────────────┐
│ Application Layer │
│ - Playground (Browser) │
│ - CLI (Deno) │
│ - API (if applicable) │
└──────────────┬──────────────────────────────┘
│
┌──────────────▼──────────────────────────────┐
│ Core Library │
│ - Crypto (BLAKE3, Ed25519) │
│ - Canonical JSON │
│ - Verification │
└──────────────┬──────────────────────────────┘
│
┌──────────────▼──────────────────────────────┐
│ Storage Layer │
│ - Filesystem (ledger.jsonl) │
│ - Optional: PostgreSQL, S3 │
└─────────────────────────────────────────────┘
- Observer - Read-only access to ledger
- Contributor - Can append atomics to ledger
- Signer - Has private key to sign atomics
- Validator - Runs verification on ledger
- Administrator - Manages infrastructure and keys
- External Attacker - No system access
- Insider Threat - Compromised contributor/signer
- Supply Chain Attacker - Compromised dependencies
- Infrastructure Attacker - Compromised hosting/cloud
| Asset | Confidentiality | Integrity | Availability | Classification |
|---|---|---|---|---|
| Private Keys | CRITICAL | CRITICAL | HIGH | SECRET |
| Ledger Data | LOW | CRITICAL | HIGH | PUBLIC |
| Source Code | LOW | HIGH | MEDIUM | PUBLIC |
| Configuration | MEDIUM | HIGH | MEDIUM | INTERNAL |
| Logs | LOW | MEDIUM | LOW | INTERNAL |
- Severity: High
- Description: Attacker finds two atomics with same BLAKE3 hash
- Impact: Could forge atomic that verifies as different content
- Likelihood: Very Low (BLAKE3 has 256-bit security)
- Mitigations:
- ✅ Use BLAKE3 (cryptographically secure)
- ✅ Domain separation ("JsonAtomic/v1" context)
- ✅ Monitor for collision reports
- Residual Risk: Very Low
- Severity: Critical
- Description: Attacker forges Ed25519 signature
- Impact: Could impersonate legitimate signer
- Likelihood: Very Low (Ed25519 has 128-bit security)
- Mitigations:
- ✅ Use Ed25519 (state-of-the-art)
- ✅ Structured signature includes public key
- ✅ Signatures stored with atomics for auditability
- Residual Risk: Very Low
- Severity: Critical
- Description: Private signing key stolen or leaked
- Impact: Attacker can sign atomics as legitimate user
- Likelihood: Medium
- Mitigations:
- ✅ Key generation uses secure randomness
- ✅ CLI warns against committing keys
- ✅ Keys stored outside repository
⚠️ No HSM/hardware key support (future)⚠️ No key rotation mechanism yet (placeholder)
- Residual Risk: Medium
- Recommendations:
- Implement key rotation
- Add HSM support for production
- Implement key ceremony procedures
- Severity: High
- Description: Predictable key generation
- Impact: Keys could be guessed
- Likelihood: Very Low
- Mitigations:
- ✅ Uses
ed25519.utils.randomPrivateKey()from @noble - ✅ Relies on platform CSPRNG
- ✅ Browser uses
crypto.randomUUID()
- ✅ Uses
- Residual Risk: Very Low
- Severity: High
- Description: Attacker modifies existing ledger entries
- Impact: Historical data corrupted
- Likelihood: Medium (filesystem access)
- Mitigations:
- ✅ Hash chains detect modifications
- ✅ Signatures provide non-repudiation
- ✅ Streaming verifier checks all entries
⚠️ No file-level integrity (future: append-only storage)
- Residual Risk: Medium
- Recommendations:
- Use append-only storage (e.g., WORM drives)
- Implement anchoring to blockchain
- Regular verification audits
- Severity: Medium
- Description: Attacker creates multiple chains for same trace_id
- Impact: Confusion about canonical chain
- Likelihood: Medium
- Mitigations:
- ✅ Fork detection in verifier
- ✅ Reports forks with line numbers
⚠️ No automatic resolution (manual intervention)
- Residual Risk: Low
- Recommendations:
- Implement consensus mechanism
- Add fork resolution policies
- Severity: Low
- Description: Re-submit old valid atomic
- Impact: Duplicate entries in ledger
- Likelihood: Medium
- Mitigations:
- ✅ Hash-based deduplication
- ✅ Trace ID continuity checks
⚠️ No timestamp validation
- Residual Risk: Low
- Severity: Low
- Description: Invalid genesis atomic (no prev after line 1)
- Impact: Chain integrity unclear
- Likelihood: Low
- Mitigations:
- ✅ Genesis rule enforced in schema
- ✅ Verifier detects invalid genesis
- Residual Risk: Very Low
- Severity: Medium
- Description: Huge ledger file exhausts memory
- Impact: Verification fails or OOM
- Likelihood: Medium
- Mitigations:
- ✅ Streaming verifier (no full file load)
- ✅ Line size limits (10MB default)
- ✅ Configurable max line size
- Residual Risk: Low
- Severity: Low
- Description: Invalid JSON causes parse errors
- Impact: Verification stopped (if --stop-on-error)
- Likelihood: High
- Mitigations:
- ✅ Robust error handling
- ✅ Structured error reporting
- ✅ Continue-on-error option
- Residual Risk: Very Low
- Severity: Medium
- Description: Excessive hash/signature operations
- Impact: CPU exhaustion
- Likelihood: Low
- Mitigations:
- ✅ Efficient algorithms (BLAKE3, Ed25519)
⚠️ No rate limiting⚠️ No process limits
- Residual Risk: Medium
- Recommendations:
- Add rate limiting
- Implement timeouts
- Add resource quotas
- Severity: Critical
- Description: Attacker executes code via executor
- Impact: Full system compromise
- Likelihood: Low (safe-by-default)
- Mitigations:
- ✅ Executor disabled by default
- ✅ Requires explicit --enable-sandbox flag
⚠️ Sandbox not implemented (placeholder)⚠️ No isolation guarantees
- Residual Risk: High (if enabled)
- Recommendations:
- DO NOT enable executor in production
- Implement proper sandboxing (WASM, isolated-vm)
- Add policy enforcement
- Severity: High
- Description: Command/SQL/code injection
- Impact: Unauthorized operations
- Likelihood: Low
- Mitigations:
- ✅ No SQL database by default
- ✅ Deno permissions restrict filesystem
- ✅ CSP in playground prevents XSS
- Residual Risk: Low
- Severity: High
- Description: Malicious code in npm packages
- Impact: Supply chain attack
- Likelihood: Medium
- Mitigations:
- ✅ Dependabot monitors vulnerabilities
- ✅ npm audit in CI
- ✅ Trivy scanning
- ✅ SBOM generation (CycloneDX)
- ✅ Pinned versions in Docker
⚠️ No signature verification on packages
- Residual Risk: Medium
- Recommendations:
- Enable npm signature verification
- Use Sigstore/cosign for artifacts
- Vendor critical dependencies
- Severity: High
- Description: Attacker modifies CI/CD pipeline
- Impact: Malicious code in releases
- Likelihood: Low
- Mitigations:
- ✅ GitHub Actions with restricted permissions
- ✅ CodeQL scanning
- ✅ Branch protection rules
⚠️ No artifact signing (placeholder)⚠️ No SLSA provenance
- Residual Risk: Medium
- Recommendations:
- Implement artifact signing (cosign)
- Add SLSA provenance
- Use verified builders
- Severity: High
- Description: Injection of malicious scripts
- Impact: Session hijacking, data theft
- Likelihood: Low
- Mitigations:
- ✅ Strict CSP headers
- ✅ No external resources
- ✅ React auto-escapes content
- ✅ No
dangerouslySetInnerHTML
- Residual Risk: Very Low
- Severity: Medium
- Description: Unauthorized actions via forged requests
- Impact: Unwanted atomic creation
- Likelihood: Low (no server)
- Mitigations:
- ✅ Client-side only (no backend)
- ✅ No authentication cookies
- Residual Risk: Very Low
- Severity: Low
- Description: Embedding in iframe for deception
- Impact: User performs unintended actions
- Likelihood: Low
- Mitigations:
- ✅ X-Frame-Options: DENY
- ✅ CSP frame-ancestors: none
- Residual Risk: Very Low
- Severity: Medium
- Description: Stealing user data
- Impact: Private keys or atomics leaked
- Likelihood: Low
- Mitigations:
- ✅ CSP blocks unauthorized connections
- ✅ No telemetry by default
- ✅ Service Worker caches locally
⚠️ LocalStorage could be read by extensions
- Residual Risk: Low
- Severity: Critical
- Description: Lost or inaccessible signing keys
- Impact: Cannot sign new atomics
- Likelihood: Medium
- Mitigations:
⚠️ No key backup mechanism⚠️ No key recovery process⚠️ No key splitting/sharing
- Residual Risk: High
- Recommendations:
- Document key backup procedures
- Implement Shamir's Secret Sharing
- Use hardware keys with backup
- Severity: High
- Description: Filesystem corruption or data loss
- Impact: Ledger unreadable
- Likelihood: Low
- Mitigations:
- ✅ NDJSON format (line-oriented, recoverable)
⚠️ No automatic backups⚠️ No replication
- Residual Risk: Medium
- Recommendations:
- Implement automated backups
- Add replication support
- Test disaster recovery
- Severity: Medium
- Description: Misconfiguration enables vulnerabilities
- Impact: Security controls bypassed
- Likelihood: Medium
- Mitigations:
- ✅ Secure defaults (executor disabled)
- ✅ Documentation of security settings
⚠️ No configuration validation
- Residual Risk: Medium
| Control | Implemented | Effectiveness | Priority |
|---|---|---|---|
| Cryptographic hashing (BLAKE3) | ✅ | High | P0 |
| Digital signatures (Ed25519) | ✅ | High | P0 |
| Domain separation | ✅ | High | P0 |
| Streaming verification | ✅ | High | P0 |
| Fork detection | ✅ | Medium | P1 |
| Line size limits | ✅ | Medium | P1 |
| CSP headers | ✅ | High | P0 |
| Non-root Docker user | ✅ | Medium | P1 |
| Dependabot | ✅ | Medium | P1 |
| SBOM generation | ✅ | Low | P2 |
| Security scanning (Trivy) | ✅ | Medium | P1 |
| CodeQL analysis | ✅ | Medium | P1 |
| Key rotation | ❌ | N/A | P1 |
| HSM support | ❌ | N/A | P2 |
| Artifact signing | ❌ | N/A | P1 |
| SLSA provenance | ❌ | N/A | P2 |
| Blockchain anchoring | ❌ | N/A | P2 |
| Executor sandboxing | ❌ | N/A | P0 |
- Do NOT enable executor in production until proper sandboxing is implemented
- Implement key rotation mechanism
- Add comprehensive testing for security controls
- Implement artifact signing (cosign)
- Add HSM support for production keys
- Implement rate limiting and resource quotas
- Add ledger replication/backup automation
- Implement executor sandboxing with proper isolation
- Add SLSA provenance generation
- Implement blockchain anchoring
- Add cross-platform golden tests for crypto
- Implement Shamir's Secret Sharing for keys
- Add Byzantine fault tolerance
- Immediately revoke compromised key
- Generate new key pair
- Re-sign affected atomics
- Audit ledger for unauthorized entries
- Notify affected parties
- Stop all writes to ledger
- Restore from last known good backup
- Run full verification with --stop-on-error
- Investigate scope of tampering
- Implement additional controls
- Pin all dependencies to last known good versions
- Audit code changes
- Rebuild from source with verified dependencies
- Update SBOM
- Communicate with users
- GDPR: Ledger data is public; no PII should be stored
- SOC 2: Logging and monitoring recommendations provided
- NIST CSF: Aligns with Identify, Protect, Detect, Respond, Recover
- CIS Controls: Implements inventory (SBOM), secure config, access control
This threat model should be reviewed:
- Quarterly: Regular security review
- On major version changes: After significant features
- After incidents: Post-incident analysis
- On new threat intelligence: Industry vulnerabilities
Last Reviewed: 2025-11-09
Next Review: 2026-02-09
Reviewers: Security Team, Core Maintainers