Skip to content

Security: corapoid/orphelix

SECURITY.md

Security Policy

πŸ” Security Overview

Orphelix implements enterprise-grade security with multi-layered protection:

  • βœ… 100% API Endpoint Coverage (77/77 endpoints secured)
  • βœ… AES-256-GCM Encryption for sensitive data at rest
  • βœ… SQL Injection Immune (100% prepared statements)
  • βœ… Rate Limiting (9 configurations for different endpoints)
  • βœ… Input Validation (Zod schemas, DNS-1123 compliance)
  • βœ… Security Headers (CSP, HSTS, X-Frame-Options)
  • βœ… 97% Security Test Coverage (229/236 tests passing)

Security Status: βœ… Production Ready Known Vulnerabilities: 0 Risk Level: 🟒 LOW

For detailed security implementation, see .ai-docs/SECURITY_REPORT.md


πŸ”‘ Authentication

GitHub OAuth (Required for Production Mode)

Purpose: User authentication to access real cluster data

Permissions:

  • read:user - Basic profile information

Setup:

GITHUB_ID=your_oauth_app_id
GITHUB_SECRET=your_oauth_app_secret

Without OAuth:

  • βœ… Demo mode works (no authentication needed)
  • ❌ Cannot access production mode

GitHub App (Optional for GitOps)

Purpose: Edit manifests and create pull requests

Permissions:

  • Contents: Read & Write
  • Pull Requests: Read & Write
  • Metadata: Read

Setup:

GITHUB_APP_ID=your_app_id
GITHUB_APP_CLIENT_ID=your_client_id
GITHUB_APP_CLIENT_SECRET=your_secret
GITHUB_APP_PRIVATE_KEY="-----BEGIN RSA PRIVATE KEY-----..."

Without GitHub App:

  • βœ… All monitoring features work
  • ❌ Cannot edit YAML manifests

What Do You Need?

Use Case GitHub OAuth GitHub App
Demo mode ❌ ❌
View real cluster βœ… ❌
GitOps workflow βœ… βœ…

πŸ›‘οΈ Security Features

Defense in Depth (5 Layers)

  1. Network & Infrastructure

    • HTTPS enforcement (production)
    • Security headers (CSP, HSTS, X-Frame-Options)
  2. API Gateway

    • Rate limiting (9 configurations)
    • Request validation
  3. Input Validation

    • Zod schemas
    • DNS-1123 compliance (Kubernetes names)
    • Path traversal prevention
  4. Business Logic

    • Prepared statements (SQL)
    • Parameterized queries
    • Error handling (no info disclosure)
  5. Data Protection

    • AES-256-GCM encryption
    • API key encryption at rest
    • HTTP-only cookies

Rate Limiting

Endpoint Type Limit Window
K8s List 120 req 60s
K8s Detail 60 req 60s
GitHub Files 60 req 60s
GitHub PRs 20 req 5 min
AI Queries 5 req 60s
Authentication 5 req 15 min

Encryption

Algorithm: AES-256-GCM (Authenticated Encryption) Key Derivation: scrypt Usage: API keys stored encrypted in SQLite database

Setup:

# Generate encryption key
openssl rand -base64 32

# Add to .env.local
ENCRYPTION_KEY=your_generated_key_here

πŸ”’ Data Storage & Privacy

What's Stored Locally

SQLite Database (orphelix.db):

  • Application settings
  • GitHub repository preferences
  • API keys (encrypted with AES-256-GCM)
  • UI state (pinned items, aliases)

HTTP-only Cookies:

  • GitHub OAuth session (30 days)
  • GitHub App token (8 hours, auto-refresh)

What's NOT Stored

  • ❌ Kubernetes credentials (uses kubeconfig)
  • ❌ Cluster data (fetched on-demand)
  • ❌ Pod logs (streamed, not persisted)
  • ❌ Secrets content (displayed but not saved)

Local-First Architecture

  • All cluster access via local kubeconfig
  • No cloud dependencies
  • Application runs entirely on your machine
  • Kubernetes credentials never leave your system

🚨 Reporting Security Issues

Responsible Disclosure

DO NOT open public issues for security vulnerabilities.

Report via:

What to include:

  • Description of the vulnerability
  • Steps to reproduce
  • Potential impact
  • Suggested fix (if any)

Response Time:

  • Initial response: 48 hours
  • Fix timeline: Best effort (open source)
  • Credit: We acknowledge security researchers

πŸ”§ Security Best Practices

Production Deployment

Required Environment Variables:

# Encryption
ENCRYPTION_KEY=<base64-key>

# GitHub OAuth
GITHUB_ID=<oauth-app-id>
GITHUB_SECRET=<oauth-secret>

# GitHub App (optional)
GITHUB_APP_ID=<app-id>
GITHUB_APP_CLIENT_ID=<client-id>
GITHUB_APP_CLIENT_SECRET=<secret>
GITHUB_APP_PRIVATE_KEY=<private-key>

# Node environment
NODE_ENV=production

Security Checklist:

  • Use HTTPS in production (Strict-Transport-Security enabled)
  • Set strong ENCRYPTION_KEY (32+ random bytes)
  • Verify security headers are active
  • Monitor rate limit violations
  • Regular dependency updates (npm audit)
  • Database file permissions: 0600
  • Regular backups of orphelix.db

Kubernetes Permissions

Minimum Required (Read-Only):

apiGroups: ["", "apps", "autoscaling", "batch", "networking.k8s.io"]
resources: ["*"]
verbs: ["get", "list", "watch"]

For Pod Restart Feature:

apiGroups: [""]
resources: ["pods"]
verbs: ["delete"]

Recommended: Use namespace-scoped RoleBinding instead of ClusterRoleBinding


πŸ“Š OWASP Top 10 Compliance

Risk Status Protection
A01 - Broken Access Control βœ… Rate limiting, validation
A02 - Cryptographic Failures βœ… AES-256-GCM, HTTPS
A03 - Injection βœ… Prepared statements, validation
A04 - Insecure Design βœ… Defense in depth
A05 - Security Misconfiguration βœ… Secure defaults, headers
A06 - Vulnerable Components ⚠️ Regular updates needed
A07 - Authentication Failures βœ… OAuth 2.0, rate limiting
A08 - Data Integrity Failures βœ… Auth tags, validation
A09 - Logging Failures βœ… Structured logging (Pino)
A10 - SSRF βœ… Input validation

πŸ” Security Testing

Frameworks: Vitest, Playwright Test Coverage: 97% (229/236 security tests)

Test Categories:

  • Encryption/decryption (21 tests)
  • Rate limiting (10 tests)
  • Input validation (29 tests)
  • SQL injection prevention (verified)
  • XSS prevention (CSP headers)
  • CSRF protection (SameSite cookies)

Run Security Tests:

npm test -- security
npm run test:coverage

πŸ“š Additional Resources


Document Version: 2.0 Last Updated: 2025-11-30 Security Review: Quarterly Classification: Public

There aren’t any published security advisories