π Security Architecture Implementation
This PR adds comprehensive security features to the Dossier system, including integrity verification, cryptographic signatures, risk assessment, and MCP server integration.
π Summary
10 commits | 13 files changed | ~2,300 lines added
Phase 1: Core Security Implementation β
- Security schema fields and validation
- Signing and verification tools
- Security-enhanced templates and examples
- Protocol and documentation updates
Phase 2: MCP Integration β
- MCP security verification tool
- Security resources for LLM understanding
- Security-first execution flow
π― Key Features
1. Multi-Layer Security Model
Layer 1: Integrity Verification (REQUIRED)
- SHA256 checksums for all dossiers
- Automatic tamper detection
- BLOCKS execution if checksum fails
Layer 2: Cryptographic Signatures (OPTIONAL)
- minisign-based signatures
- Trust levels: VERIFIED, SIGNED_UNKNOWN, UNSIGNED, INVALID
- Decentralized trust model (like Docker Hub)
Layer 3: Risk Assessment (REQUIRED)
- Risk levels: low, medium, high, critical
- Specific risk factors (modifies_files, requires_credentials, etc.)
- Detailed destructive operations documentation
- Automatic approval requests for high-risk operations
Layer 4: MCP Verification (AUTOMATIC)
verify_dossiertool for automated checks- ALLOW/WARN/BLOCK recommendations
- Security-first execution flow
π Changes by Category
Schema Updates
- dossier-schema.json: +90 lines
checksum(REQUIRED) - SHA256 integritysignature(OPTIONAL) - minisign authenticityrisk_level(REQUIRED) - risk classificationrisk_factors(OPTIONAL) - specific risksrequires_approval(REQUIRED) - approval flagdestructive_operations(OPTIONAL) - dangerous actions
Security Tools
-
tools/sign-dossier.js: +230 lines
- Calculate SHA256 checksums
- Sign with minisign
- Embed in frontmatter
- Dry-run mode, help, key management
-
tools/verify-dossier.js: +330 lines
- Verify integrity (checksum)
- Verify authenticity (signature)
- Check trusted keys
- Risk assessment
- ALLOW/WARN/BLOCK recommendations
- Beautiful CLI + JSON output
Templates & Examples
-
templates/dossier-template.md: +84 lines
- Security fields in frontmatter
- Embedded LLM execution guide
- Security documentation
-
examples/: +108 lines across 4 files
- deploy-to-aws.md: risk=high, cloud operations
- migrate-schema.md: risk=critical, database operations
- setup-react-library.md: risk=medium, file modifications
- train-ml-model.md: risk=medium, resource intensive
Documentation
-
SECURITY_ARCHITECTURE.md: +814 lines (NEW)
- Complete security design
- Implementation plan (3 phases)
- Risk classification guidelines
- Trust model explanation
- FAQ and best practices
-
PROTOCOL.md: +156 lines
- Security Verification Protocol (4 steps)
- Risk-based approval matrix
- Execution monitoring guidelines
- Verification tools documentation
-
KEYS.txt: +133 lines (NEW)
- Official public key documentation
- Trust model explanation
- Community key guidelines
- Revocation procedures
-
README.md: +79 lines
- Security & Trust section
- Integrity verification
- Cryptographic signatures
- Risk assessment overview
- Trust model
MCP Server Integration
-
mcp-server/SPECIFICATION.md: +223 lines
verify_dossiertool specificationdossier://securityresourcedossier://keysresource- Security-first execution flow
- 3 detailed verification examples
-
mcp-server/README.md: +77 lines
- Security features overview
- Automatic verification example
- Trust model explanation
- Updated roadmap
π Security Flow
Before Execution:
1. π Verify checksum (integrity)
β Mismatch β BLOCK execution
2. π Verify signature (authenticity) if present
β
Verified + trusted β Proceed
β οΈ Unsigned/unknown β Warn user
β Invalid β BLOCK execution
3. β οΈ Assess risk level
High/Critical β Request approval
4. β
Execute if approved
MCP Integration:
// LLM calls verify_dossier tool
const verification = await verify_dossier({ path: "dossier.md" });
if (verification.recommendation === "BLOCK") {
// DO NOT EXECUTE
return;
}
if (verification.recommendation === "WARN") {
// Show warning, request approval
const approved = await askUser("Proceed? (y/N)");
if (!approved) return;
}
// ALLOW - proceed with execution
executeDossier();
π― Design Decisions
Why minisign?
- β Purpose-built for software artifacts
- β Lightweight (~100KB vs GPG ~20MB)
- β Simple trust model
- β No infrastructure required
- β Battle-tested (OpenBSD, Homebrew)
Why Decentralized Trust?
- β Like Docker Hub - anyone can sign
- β Users choose which keys to trust
- β No central authority required
- β Community-friendly
Why Optional Signatures?
- β Integrity always checked (checksums)
- β Warnings for unsigned dossiers
- β Flexibility for development
- β Path to gradual adoption
π Documentation
All aspects fully documented:
- β SECURITY_ARCHITECTURE.md - Complete design
- β PROTOCOL.md - Execution protocol
- β KEYS.txt - Trust model
- β README.md - Overview
- β Tools - Help text and examples
- β MCP Spec - Integration details
π§ͺ Testing
Tools tested:
- β sign-dossier.js - Creates valid checksums and signatures
- β verify-dossier.js - Verifies integrity and authenticity
- β Exit codes: 0=ALLOW, 2=WARN, 1=BLOCK
Examples validated:
- β All 4 examples have valid security metadata
- β Risk levels appropriately assigned
- β Destructive operations documented
π Impact
For Users:
- β Know dossiers havenβt been tampered with
- β Verify authenticity before execution
- β Understand risks before running
- β Control trust relationships
For LLMs:
- β Automatic security verification (MCP)
- β Clear execution guidance
- β Risk-aware execution
- β Structured approval flow
For Authors:
- β Sign dossiers to build trust
- β Document risks clearly
- β Flexible trust model
π Checklist
- Schema updated with security fields
- Signing tool created (sign-dossier.js)
- Verification tool created (verify-dossier.js)
- Template updated with security fields
- All examples updated with security metadata
- PROTOCOL.md updated with security steps
- KEYS.txt created
- README.md security section added
- SECURITY_ARCHITECTURE.md comprehensive doc
- MCP verify_dossier tool specified
- MCP security resources added
- MCP README updated
- All changes committed and pushed
π Related
- Implements SECURITY_ARCHITECTURE.md design
- Follows PROTOCOL.md v1.0
- Compatible with dossier-schema v1.0.0
- Ready for Phase 3: MCP implementation
πΈ Example Output
$ node tools/verify-dossier.js examples/devops/deploy-to-aws.md
π Dossier Verification Report
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
File: examples/devops/deploy-to-aws.md
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
π INTEGRITY CHECK (Checksum)
β
Status: VALID
Checksum matches - content has not been tampered with
π AUTHENTICITY CHECK (Signature)
β οΈ Status: UNSIGNED
No signature found - authenticity cannot be verified
β οΈ RISK ASSESSMENT
π Risk Level: HIGH
Risk Factors:
β’ modifies_cloud_resources
β’ requires_credentials
β’ network_access
Destructive Operations:
β’ Creates/updates AWS infrastructure
β’ Modifies IAM roles
Requires Approval: YES
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β οΈ RECOMMENDATION: WARN
βββββββββββββββββββββββββββββββββββββββββββββββββββββ
β οΈ WARNING: This dossier should be reviewed before execution.
Reasons:
β’ Dossier is not signed (cannot verify author)
β’ High risk level: high
Only execute if you trust the source!
Ready for review and merge! π
Rendered from docs/contributing/pr-guide.md in the repository. Edit it there.