Skip to main content
Glama
orneryd

M.I.M.I.R - Multi-agent Intelligent Memory & Insight Repository

by orneryd
README.mdβ€’5.16 kB
# Security Guide **Comprehensive security features to protect your NornicDB deployment.** ## πŸš€ Quick Start NornicDB v1.0.0 includes **automatic security protection** on all HTTP endpoints. No configuration required for basic protection. ```bash # Production mode (default) - strict security NORNICDB_ENV=production # Development mode - relaxed for local development NORNICDB_ENV=development ``` ## πŸ“š Documentation - **[HTTP Security Implementation](http-security.md)** - Complete implementation details - **[Query Cache Security](query-cache-security.md)** - Query analysis and caching security model - **[LLM & AST Security](llm-ast-security.md)** - Safe patterns for LLM integration and plugin security - **[Cluster Security](../operations/cluster-security.md)** - Multi-node authentication - **[Compliance Guide](../compliance/)** - GDPR, HIPAA, SOC2 ## πŸ”’ Security Features ### HTTP Security Middleware ⭐ NEW in v1.0.0 All HTTP endpoints are automatically protected against: | Attack Type | Protection | Status | | ---------------------- | ---------------------------------------------- | --------- | | **CSRF** | Token validation, injection prevention | βœ… Active | | **SSRF** | Private IP blocking, metadata service blocking | βœ… Active | | **XSS** | Script tag filtering, protocol validation | βœ… Active | | **Header Injection** | CRLF/null byte filtering | βœ… Active | | **Protocol Smuggling** | file://, gopher://, ftp:// blocked | βœ… Active | ### Query Analysis Security The query cache system uses conservative keyword detection: | Concern | Status | Notes | | ------------------------------ | ------------- | ---------------------------------- | | **Write ops hidden as reads** | βœ… Protected | Not possible in valid Cypher | | **Cache poisoning** | βœ… Protected | Keys include query + parameters | | **Read ops marked as writes** | ⚑ Accepted | Performance impact only, not security | See **[Query Cache Security](query-cache-security.md)** for full details. ### Authentication & Authorization - **JWT Authentication** - Stateless token-based auth - **RBAC** - Role-based access control - **API Keys** - Service-to-service authentication ### Data Protection - **Field-Level Encryption** - AES-256-GCM encryption - **TLS/HTTPS** - Required in production mode - **Audit Logging** - Complete operation history ## πŸ›‘οΈ Attack Prevention ### SSRF Protection Automatically blocks requests to: ``` ❌ Private IPs (10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16) ❌ Localhost (127.0.0.0/8) - in production ❌ Link-local (169.254.0.0/16) ❌ AWS/Azure/GCP metadata services ❌ Dangerous protocols (file://, gopher://, ftp://) ``` ### Token Validation Automatically validates: ``` βœ… Bearer tokens in Authorization header βœ… Query parameter tokens (SSE/WebSocket) βœ… OAuth state parameters βœ… Callback/redirect URLs ``` ## πŸ”§ Configuration ### Environment Variables ```bash # Production mode (strict) - DEFAULT NORNICDB_ENV=production # Development mode (allows localhost) NORNICDB_ENV=development # Allow HTTP (not recommended for production) NORNICDB_ALLOW_HTTP=true ``` ### Production vs Development | Feature | Production | Development | | ----------------------- | ---------- | ----------- | | Block localhost | βœ… Yes | ❌ No | | Require HTTPS | βœ… Yes | ❌ No | | Block private IPs | βœ… Yes | βœ… Yes | | Block metadata services | βœ… Yes | βœ… Yes | ## πŸ“– Usage Examples ### Automatic Protection (Default) ```go // No code changes needed - middleware is active! // All endpoints automatically protected server := nornicdb.NewServer() server.Start() // Security middleware included ``` ### Manual Validation (Optional) ```go import "github.com/orneryd/nornicdb/pkg/security" // Validate external URLs before making requests if err := security.ValidateURL(webhookURL, false, false); err != nil { return fmt.Errorf("invalid webhook: %w", err) } // Validate tokens before processing if err := security.ValidateToken(apiKey); err != nil { return fmt.Errorf("invalid token: %w", err) } ``` ## πŸ“Š Test Coverage - **19 unit tests** covering 30+ attack scenarios - **8 integration tests** with full HTTP stack - **Performance:** < 10Β΅s overhead per request ## πŸ”— See Also - **[HTTP Security Implementation](http-security.md)** - Full technical details - **[Compliance Guide](../compliance/)** - Regulatory compliance - **[Operations Security](../operations/cluster-security.md)** - Cluster authentication - **[OWASP SSRF Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)** - **[OWASP CSRF Cheat Sheet](https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html)** --- **Secure your deployment** β†’ **[Implementation Details](http-security.md)**

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/orneryd/Mimir'

If you have feedback or need assistance with the MCP directory API, please join our Discord server