security: Implement critical security fixes - #1
Merged
Conversation
- Add AES-256-GCM encryption for all secrets - Implement rate limiting with auth middleware - Restrict CORS to whitelist of allowed origins - Fix path traversal with robust validation - Use crypto.randomBytes() instead of Math.random() - Add command whitelist to shell tools - Restrict sandbox network to 'none' by default - Add HTTP URL whitelist and timeout Closes security vulnerabilities: CWE-312, CWE-79, CWE-22, CWE-346, CWE-338, CWE-306, CWE-78
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔒 CRITICAL SECURITY FIXES
This PR addresses 8 critical security vulnerabilities identified in the recent security audit.
✅ FIXED VULNERABILITIES
IMPLEMENTED FIXES
1. Secret Encryption (AES-256-GCM)
All secrets now encrypted. Format: encrypted:{iv}:{authTag}:{data}
2. Rate Limiting
Auth endpoints protected. 5 attempts → 15 min lockout.
3. CORS Whitelist
Explicit origin whitelist. No more * with credentials.
4. Path Traversal Prevention
path.relative() validation. Symlink resolution.
5. Cryptographic Randomness
crypto.randomBytes() instead of Math.random()
6. Command Whitelist
55 commands allowed. Dangerous commands blocked.
7. Network Restriction
Network mode: none by default in sandboxes.
8. HTTP URL Whitelist
6 domains only. HTTPS-only. 10s timeout.
📄 DOCS
⏭️ TODO (Future)