-
Notifications
You must be signed in to change notification settings - Fork 796
Feat: User-level secrets store #217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: nightly
Are you sure you want to change the base?
Conversation
- Added UserSecretsStore durable object for secure secret storage and management - Implemented XChaCha20-Poly1305 encryption service for secure secret storage - Heirarchial key derivation
🔒 Previous Review (Outdated)All issues identified in this review have been addressed in subsequent commits. See latest review for current status. |
- Increased PBKDF2 iterations to 600k/100k for stronger key derivation - Added memory zeroing for plaintext bytes in encryption/decryption operations - Implemented promise-based locking for key rotation to prevent concurrent modifications - Added detailed security documentation for deterministic salt design and SQL injection prevention - Updated UserSecretsStore to wait for any in-progress key rotation before executing operations - Added comprehensive
|
Claude finished @AshishKumar4's task —— View job Code & Security Review CompleteRecommendation: ✅ APPROVE SummaryExcellent work! All 6 critical/high security issues from the initial review have been successfully resolved. This PR now implements a production-ready user secrets management system with outstanding security properties. Review OutcomesSecurity Issues - All Resolved ✓
Outstanding Item (Not a Blocker)
Key Improvements Since Initial ReviewSecurity Enhancements:
Testing:
Documentation:
Code Quality:
Architecture HighlightsCryptographic Design:
Durable Object Pattern:
RecommendationAPPROVE and merge. This PR demonstrates:
Follow-up Suggestions:
Outstanding work addressing all the security concerns! The improvements show deep understanding of both cryptographic best practices and Cloudflare Workers architecture. |
Code & Security Review (Re-review Complete)Recommendation: ✅ APPROVE SummaryAll 6 critical/high security issues from the initial review have been successfully resolved. This PR now implements a production-ready user secrets management system with excellent security properties. Previous Issues - All Resolved
Outstanding Items
Key ImprovementsSecurity:
Testing:
Documentation:
Code Quality:
RecommendationAPPROVE and merge. All security concerns have been thoroughly addressed. Consider planning feature flag implementation for the commented routes as a follow-up task. Excellent work on the security improvements! |
Summary
IMPORTANT: THIS PR IS NOT APPROVED YET FROM A SECURITY STANDPOINT. THIS IS NOT A RECOMMENDED WAY OF STORING USER SECRETS. USING ANY OF THE CODE RELATED WOULD BE THE LIABILITY OF THE DEVELOPER.
This PR implements a production-ready Durable Object-backed user secrets management system for secure storage and retrieval of sensitive credentials (API keys, tokens, passwords) on a per-user basis.
Changes
Core Infrastructure
worker/services/secrets/UserSecretsStore.ts) - One DO instance per user, managing secrets in SQLite with XChaCha20-Poly1305 encryptionworker/services/secrets/EncryptionService.ts) - Implements authenticated encryption with unique keys per secretworker/services/secrets/KeyDerivation.ts) - Hierarchical key derivation: Master Key → User Master Key → Data Encryption Keyworker/services/secrets/types.ts) - Type-safe interfaces for secrets operationsworker/services/secrets/constants.ts) - Cryptographic parameters and storage limitsAPI Layer
worker/api/controllers/user-secrets/controller.ts) - RPC wrapper for DO operationsworker/api/routes/userSecretsRoutes.ts) - REST API endpoints (currently commented out pending feature flag)Testing
test/worker/services/secrets/KeyDerivation.test.ts- 17 unit teststest/worker/services/secrets/EncryptionService.test.ts- 18 unit teststest/worker/services/secrets/UserSecretsStore.test.ts- 55+ integration testsDocumentation
Configuration
UserSecretsStoreDurable Object bindingSupporting Changes
cryptoUtils.tswith timing-safe comparison functionsArchitecture
Hierarchical Key Derivation:
Security Features:
Locking Mechanism:
waitForRotation()before executionMotivation
Provides users with a secure way to store sensitive credentials that can be used by generated applications. This Durable Object-based solution offers better security and scalability compared to the previous D1-based system.
Security Review
All critical security issues from initial review have been addressed:
Fixed Issues:
blockConcurrencyWhile()and promise-based lockingRemaining:
Breaking Changes
None - this is a new feature. The legacy D1-based secrets system remains available (also commented out).
Testing Instructions
This PR description was automatically generated by Claude Code