ADR-005: Validator Service Security Boundary
Date: 2025-11-16 Status: Accepted Deciders: Sorcha Architecture Team Tags: security, architecture, validator, blockchain
Context and Problem Statement
During the implementation of the Register Service Phase 1 & 2, we discovered that DocketManager and ChainValidator were initially placed in Sorcha.Register.Core. However, these components have critical security requirements that necessitate execution in a secured environment with access to cryptographic keys.
Key Security Requirements:
- Cryptographic Operations - Docket building requires access to signing keys for blockchain integrity
- Chain Validation - Hash calculations and signature verification need cryptographic key access
- Consensus Participation - Validators need to sign attestations and validate peer signatures
- Enclave Execution - Production deployment requires Intel SGX/AMD SEV/HSM support
- Key Isolation - Validation logic must run in environment with controlled key access
Problem: The current placement in Register.Core violates the principle of least privilege and creates a security boundary violation, as Register.Core is a general-purpose library that should not have access to cryptographic keys.
Decision Drivers
- Security First - Cryptographic operations must be isolated in secure execution environments
- Principle of Least Privilege - Only components that absolutely need key access should have it
- Audit and Compliance - Security-sensitive operations must be in auditable, controlled services
- Enclave Compatibility - Design must support Intel SGX, AMD SEV, and HSM deployment
- Clear Service Boundaries - Each service should have well-defined security perimeters
Considered Options
Option 1: Keep in Register.Core (Current - Rejected)
Pros:
- No code movement required
- Tests already exist
Cons:
- ❌ Violates security boundaries
- ❌ Cannot deploy in secure enclaves
- ❌ Gives unnecessary key access to general library
- ❌ Fails compliance requirements
- ❌ Contradicts existing Validator Service design
Option 2: Create Validator.Core Library (Rejected)
Pros:
- Separates validation logic
- Portable library approach
Cons:
- ❌ Still doesn't enforce secure execution environment
- ❌ Doesn't address key access control
- ❌ Misses the service boundary aspect
Option 3: Move to Validator Service with Secure Boundary (Selected)
Pros:
- ✅ Enforces secure execution environment
- ✅ Aligns with existing Validator Service design
- ✅ Enables enclave deployment (Intel SGX, AMD SEV, HSM)
- ✅ Properly isolates cryptographic operations
- ✅ Supports audit and compliance requirements
- ✅ Clear service-to-service communication boundaries
- ✅ Wallet Service integration for key operations
Cons:
- Requires code movement and test updates
- Adds service dependency (mitigated by proper API design)
Decision
We will move DocketManager and ChainValidator from Sorcha.Register.Core to a new Sorcha.Validator.Service with the following structure:
src/
├── Core/
│ ├── Sorcha.Validator.Core/ # Enclave-safe validation logic
│ │ ├── Managers/
│ │ │ └── DocketManager.cs # Moved from Register.Core
│ │ └── Validators/
│ │ └── ChainValidator.cs # Moved from Register.Core
│ │
│ └── Sorcha.Validator.Models/ # Validation-specific models
│
└── Services/
└── Sorcha.Validator.Service/ # Secured API service
├── Controllers/
├── Services/
└── Program.csSecurity Enhancements:
- Enclave-Safe Core -
Validator.Coredesigned for Intel SGX/AMD SEV - Wallet Service Integration - All key operations delegated to Wallet Service
- Minimal API Surface - Only essential validation endpoints exposed
- Rate Limiting - DoS protection on validation endpoints
- Audit Logging - Comprehensive security event logging
Consequences
Positive
- ✅ Security Compliance - Proper isolation of cryptographic operations
- ✅ Enclave Ready - Can deploy in Intel SGX, AMD SEV, or HSM
- ✅ Clear Boundaries - Well-defined service responsibilities
- ✅ Auditable - All validation operations in controlled service
- ✅ Scalable - Can scale validation independently of register operations
- ✅ Future-Proof - Aligns with planned Validator Service features
Negative
- Additional Service - One more service to deploy and manage
- Mitigation: Use Aspire for orchestration, service defaults for consistency
- Service Dependency - Register Service depends on Validator Service
- Mitigation: Well-defined API contract, resilience patterns
- Test Updates - Need to update integration tests
- Mitigation: Use in-memory implementations for unit tests
Neutral
- Code Movement - Requires moving classes and updating namespaces
- Documentation Updates - Need to update all architecture docs
- Learning Curve - Team needs to understand new service boundary
Implementation Plan
Phase 1: Project Creation (Immediate)
- Create
Sorcha.Validator.Coreclass library - Create
Sorcha.Validator.Modelsclass library (if needed) - Create
Sorcha.Validator.ServiceAPI project - Add projects to solution
Phase 2: Code Movement (Immediate)
- Move
DocketManager.cstoSorcha.Validator.Core/Managers/ - Move
ChainValidator.cstoSorcha.Validator.Core/Validators/ - Update namespaces
- Update dependencies
Phase 3: Test Updates (Immediate)
- Move
DocketManagerTests.csto new test project - Move
ChainValidatorTests.csto new test project - Update test dependencies
- Verify all tests pass
Phase 4: Documentation (Immediate)
- Update
UNIFIED-DESIGN-SUMMARY.md - Update
validator-service-design.md - Create this ADR
- Update development status
- Create learnings document
Phase 5: API Design (Next Sprint)
- Define Validator Service API contracts
- Implement validation endpoints
- Add Wallet Service integration
- Add Register Service integration
Compliance and Security Notes
Security Posture Improvements:
- Before: Validation logic in general-purpose library (Register.Core)
- After: Validation logic in secured service with controlled key access
Enclave Deployment Path:
- Development: Standard .NET runtime
- Staging: Azure Confidential Computing (AMD SEV-SNP)
- Production: Intel SGX enclaves or HSM integration
Audit Trail:
- All docket building operations logged
- All validation decisions recorded
- Cryptographic operations tracked
- Failed validations investigated
References
- Validator Service Design
- Validator Service Design
- Unified Design Summary
- Register Service Phase 1-2 Completion
Learnings Captured
This decision surfaced several important learnings:
- Security boundaries must be established early in service design
- Cryptographic operations require special architectural consideration
- Test-first development helped us discover the boundary violation
- Service decomposition should follow security requirements, not just functional grouping
See: Learnings Document