Security
Built-in security features that protect Tasked in production without additional configuration.
API Authentication
Tasked supports API key authentication to restrict access to all endpoints.
# Set via CLI flag
tasked-server serve --api-key "your-secret-key"
# Or via environment variable
TASKED_API_KEY="your-secret-key" tasked-server serve
When an API key is configured, all requests must include it in the Authorization header as a Bearer token or in the X-API-Key header.
- Constant-time comparison — API key validation uses constant-time comparison to prevent timing attacks.
- SSE connection cap — The number of concurrent SSE connections is capped to prevent resource exhaustion from long-lived connections.
Network Security
SSRF Protection
All HTTP executor requests are validated against a URL policy that blocks access to internal infrastructure.
- Private IP blocking — Requests to private and internal IP ranges are blocked by default:
10.0.0.0/8,172.16.0.0/12,192.168.0.0/16, loopback (127.0.0.0/8), and link-local (169.254.0.0/16). - DNS rebinding prevention — IP addresses are re-validated at connection time, not just at DNS resolution. This prevents attacks where a hostname resolves to a public IP during validation but a private IP at connection time.
- Redirect validation — Redirect targets are validated against the same SSRF policy, preventing redirects from bypassing URL restrictions.
TLS Enforcement
- Remote executor connections emit a warning when the endpoint does not use TLS.
- Production deployments should use TLS for all external communication, either via a reverse proxy or direct TLS termination.
Executor Security
Shell Executor
- Process cleanup on drop — Child processes are killed when the executor is dropped, preventing orphaned processes from accumulating.
- Per-task environment variables — Environment variables are configurable per-task for safe value interpolation.
- No shell injection — Commands are not passed through shell expansion by default, preventing shell injection attacks.
Container Executor
# Example container executor configuration
image_allowlist: ["python:3.12-slim", "node:20-alpine"]
network_disabled: true
volume_allowlist: ["/data/shared"]
max_output_bytes: 1048576
cpu_limit: 1.0
memory_limit: "256m"
- Image allowlist — Restricts which Docker images can be used, preventing execution of arbitrary or untrusted images.
- Network isolation — Containers can be configured with networking disabled, preventing access to the host network and external services.
- Volume allowlist — Controls which host paths can be mounted into containers, preventing access to sensitive host directories.
- Output size cap — Container output is capped to prevent memory exhaustion from excessive output.
- Default resource limits — CPU and memory limits are applied to all containers, preventing a single task from consuming all host resources.
HTTP Executor
- Response body size limits — Response bodies are capped to prevent memory exhaustion from unexpectedly large responses.
- SSRF validation — All request URLs are validated against the SSRF policy, including OAuth2 token endpoint URLs.
Rhai Sandbox (Conditions)
Rhai is used for evaluating task conditions. The engine runs in a hardened sandbox:
- Raw engine mode — No standard library functions are exposed to condition scripts, limiting the attack surface to only the variables and operators needed for condition evaluation.
- Wall-clock timeout — A timeout is enforced on condition evaluation to prevent infinite loops from blocking the scheduler.
- Call-depth cap — A maximum call depth is enforced to prevent stack overflow from deeply recursive scripts.
Response Limits
- The HTTP executor enforces response body size limits across all requests, including webhook callbacks and API calls.
- The container executor caps output size for both stdout and stderr.
- These limits prevent memory exhaustion from unexpectedly large responses or runaway processes.
Environment Isolation
- Queue-level secrets — Secrets defined at the queue level are resolved at dispatch time and never written to logs.
- Per-task scoping — Environment variables can be scoped to individual tasks, preventing unintended leakage between tasks in the same flow.
- Remote executor stripping — Sensitive fields are stripped from requests sent to remote executors, ensuring secrets do not leave the server.