Security

Overview

Neotask एक security-first architecture के साथ designed है। Gateway default रूप से localhost से bind होता है, सभी sensitive data encrypted at rest होता है, और agent execution isolated containers में sandboxed हो सकती है।

Network Security

Loopback by Default

Gateway केवल 127.0.0.1 (localhost) पर listen करता है जब तक आप explicitly binding mode न बदलें। Default रूप से कोई external network exposure नहीं।

Authentication

सभी WebSocket connections को authentication आवश्यक है:

  • Token auth — Bearer token (UUID या custom string)
  • Password auth — Bcrypt-hashed password
  • Trusted proxy — Reverse proxies से Pre-authenticated headers
  • Local trust — Loopback connections implicitly trusted हैं

Remote Access Security

Remote access के लिए, recommended approach Tailscale VPN या SSH tunneling है — कभी भी Gateway को directly internet पर expose न करें।

Device Pairing

Pairing कैसे काम करता है

Gateway से connect होने वाला प्रत्येक client paired होना चाहिए:

  1. Device अपनी identity present करता है (fingerprint + public key)
  2. Gateway एक pairing challenge (nonce) issue करता है
  3. Device nonce को अपनी private key से sign करता है
  4. आप UI के माध्यम से device approve करते हैं
  5. Gateway future connections के लिए device token issue करता है

Trust Model

  • Local devices (loopback) सुविधा के लिए auto-approved होते हैं
  • Non-local devices को explicit approval आवश्यक है
  • Device tokens locally stored होते हैं और reconnect पर reuse होते हैं
  • Devices को किसी भी समय revoke किया जा सकता है

Encryption

Data at Rest

  • AES-256-GCM — सभी tokens, secrets, और API keys encrypted at rest हैं
  • Machine-derived keys — Encryption keys device identity से scrypt के माध्यम से derived
  • No plaintext storage — Tokens कभी plaintext में store नहीं होते

Data in Transit

  • TLS — API communication के लिए HTTPS
  • WSS — Gateway connections के लिए WebSocket Secure (Tailscale Serve या reverse proxy उपयोग करते समय)
  • HMAC signing — Nonce और timestamp के साथ Request integrity

Sandboxing

Docker-Based Isolation

Agent command execution Docker containers में sandboxed हो सकती है:

  • Per-agent profiles — प्रत्येक agent का अपना sandbox configuration हो सकता है
  • Resource limits — Configurable CPU, memory, और timeout limits
  • Network isolation — Containers network-isolated हो सकते हैं
  • Filesystem confinement — Agents केवल अपने workspace access करते हैं
  • Custom images — Specific tools installed के साथ pre-built images उपयोग करें

Sandbox Scopes

Scopeविवरण
Per-sessionप्रत्येक session के लिए Fresh container
Per-agentPer agent Persistent container
SharedAgents में Shared container

Workspace Access

Sandboxed agents अपनी workspace directory (container में mounted) access कर सकते हैं लेकिन अपने workspace के बाहर host filesystem access नहीं कर सकते।

Exec Approvals

Control करें कि agents nodes और Gateway host पर कौन से commands execute कर सकते हैं:

Modes

Modeविवरण
Allowlistकेवल pre-approved commands execute होते हैं
AskUnknown commands user approval के लिए prompt करते हैं
Fullकोई restrictions नहीं (सावधानी के साथ उपयोग करें)

Per-Node Configuration

प्रत्येक node (macOS, headless host) का अपना exec approval configuration है, locally stored। आप specific binaries allow कर सकते हैं (जैसे /usr/bin/docker, /usr/local/bin/terraform) जबकि बाकी सब block कर सकते हैं।

Elevated Mode

कुछ operations को directly Gateway host पर run करने की आवश्यकता होती है (sandbox में नहीं)। Elevated mode है:

  • Agent config में explicit permission द्वारा gated
  • केवल Gateway host पर available
  • Default रूप से disabled
  • Logging के माध्यम से auditable

Security Audit

Built-in security audit check करता है:

  • Configuration file permissions (600 होने चाहिए)
  • Session file permissions
  • Node.js version (security patches)
  • Plaintext secret detection
  • Plugin allowlist validation
  • Open network interface audit
  • Auth configuration completeness

Permission दिए जाने पर Audit कई issues automatically fix कर सकता है।

Best Practices

  1. Gateway को loopback पर रखें — Remote access के लिए Tailscale या SSH उपयोग करें
  2. Sandboxing enable करें — Docker containers में agent commands run करें
  3. Exec allowlists उपयोग करें — Restrict करें कि agents nodes पर कौन से commands run कर सकते हैं
  4. Auth tokens set करें — loopback के लिए भी हमेशा token auth configure करें
  5. Agent permissions review करें — जहां possible minimal tool profiles उपयोग करें
  6. Neotask updated रखें — Updates में security patches शामिल हैं
  7. नियमित audit करें — Misconfigurations catch करने के लिए security audits run करें
  8. Plugin loading restrict करें — केवल trusted plugins install करें