Path: redb-tsak/SECURITY.md Snapshot: redb-tsak, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages. License: Apache-2.0. Repository: https://github.com/redbase-app/redb-tsak Page: https://redbase.app/src/dev-2026-12-06/redb-tsak/SECURITY.md ---- # Security Policy — redb.Tsak ## Supported Versions | Version | Supported | |---------|-----------| | 1.0.0-preview.1 | Yes | Older versions do not receive security fixes. Upgrade to the latest release. --- ## Reporting a Vulnerability **Do not open a public GitHub issue for security vulnerabilities.** Report privately to: **support@redbase.app** Include in your report: - Package and version (`tsak --version`) - Deployment mode: `InMemory`, `Redb:Postgres`, `Redb:MSSql`, Cluster - Detailed description of the vulnerability - Steps to reproduce - Potential impact assessment - Your suggested fix (optional but appreciated) You will receive an acknowledgment within 2 business days. We aim to publish a fix and disclose the issue within 30 days. --- ## Scope This policy covers the following packages and components: | Project | Area | |---------|------| | `redb.Tsak.Core` | Authentication, API key store, cluster coordination, module isolation | | `redb.Tsak.Worker` | REST API, config handling, hosted service startup | | `redb.Tsak.Contracts` | Wire DTOs, input validation | | `redb.Tsak.Client` | HTTP client, credential handling | | `redb.Tsak.CLI` | CLI credential storage, `--key` flag handling | | `redb.Tsak.Web` | Web dashboard authentication, session management | --- ## Security Architecture ### API Authentication Tsak uses API Key authentication with HMAC-SHA256 hashing. - Raw keys are **never stored** — only `SHA-256(key)` is persisted - Key comparison uses `CryptographicOperations.FixedTimeEquals` to prevent timing attacks - Keys are transmitted via `Authorization: Bearer ` or `X-Api-Key: ` header - The `_system` context exposes the REST API and cannot be stopped or removed by any key, including admin keys ### Key Store - **InMemory mode**: keys are loaded from `Tsak:Auth:Keys` in `appsettings.json` at startup and are read-only at runtime - **Redb mode**: `RedbApiKeyStore` stores keys in the redb store — supports create, list, and revoke at runtime - 5-minute TTL cache reduces DB reads without significantly widening the revocation window ### Cluster Security - Leader election uses a distributed lock with epoch fencing — stale leaders cannot issue commands after losing election - Heartbeat-based dead-node detection prevents zombie nodes from holding locks indefinitely - Inter-node communication uses the same API Key authentication as external clients - Cluster state (topology, assignments) is stored in the redb store — access requires DB credentials ### Module Isolation - Each module is loaded in its own `AssemblyLoadContext` — a compromised module cannot directly access another module's types - `Collectible` ALC mode is **disabled by default**: an unload releases a module only when nothing outside it refers to it, and a library with a static cache of the module's types can keep it in memory. Tsak checks the unload and counts what stays (README, "Module contexts in memory"); unloading is a memory matter, not an isolation boundary - Modules are loaded from the `Tsak:Modules:AssemblyPaths` directories — **restrict write access** to these directories in production - Tsak does not sandbox module code — a module with malicious code runs with the same OS privileges as the Tsak process ### Configuration and Secrets - `Tsak:Auth:Secret` (JWT signing key) and connection strings must never be committed to source control - Use environment variable overrides or a secrets manager in production - See DEPLOYMENT_SECRETS.md for the complete secrets management guide --- ## Security Notes for Operators ### What the published image ships with The image starts with one command and therefore with no secrets of its own: packaging strips the development secret, and **`Tsak:Auth:Enabled` is off** — with authentication on and no secret the worker refuses to start. Until you change it, the management API on `9090` answers **without a key** (stop contexts, upload modules, issue keys, dump config), and it binds every interface of the container. The node says so at every start: ``` SECURITY: the Tsak management API is bound to a non-loopback address (0.0.0.0:9090) with authentication DISABLED. Anyone who can reach this port gets full unauthenticated admin ... ``` That is fine on a laptop and wrong on a network. Before the port faces anyone else: turn authentication on with your own secret (below), publish the port to `127.0.0.1` or a private network, and change the dashboard's `admin` / `admin`. A worker you run yourself, outside a container, binds loopback by default and is not exposed until you set `Tsak:Api:Host`. ### Harden the REST API in Production ```json { "Tsak": { "Auth": { "Enabled": true, "Secret": "", "Keys": [] } } } ``` - Always set `Tsak:Auth:Enabled = true` in production - Use a randomly generated `Secret` of at least 32 characters - Pre-seed keys via config only for bootstrap — manage keys at runtime via API - Assign minimal roles — `viewer` for monitoring systems, `operator` for day-to-day operations, `admin` only where keys, users, module removal or the cluster are managed ### Protect the Module Directory ```bash # Linux: restrict Libs/ to the tsak service account chown -R tsak:tsak /opt/tsak/Libs chmod -R 750 /opt/tsak/Libs ``` Unauthorized writes to `Libs/` can result in arbitrary code execution inside the Tsak process. ### TLS Tsak Worker's built-in API (`port 9090`) is HTTP only. In production: - Place a reverse proxy (nginx, Caddy, Traefik) in front and terminate TLS there - OR configure Kestrel TLS directly: ```json { "Kestrel": { "Endpoints": { "Https": { "Url": "https://0.0.0.0:9443", "Certificate": { "Path": "/certs/tsak.pfx", "Password": "..." } } } } } ``` ### Cluster Communication - All inter-node calls go through the REST API — secure it with API keys and TLS - Do not expose `port 9090` to the public internet — use a private network or VPN for cluster node communication - Rotate the `NodeId` if a node is decommissioned to prevent stale node resurrection ### Web Dashboard (`redb.Tsak.Web`) - The dashboard uses in-memory session authentication — sessions do not survive a server restart - Set strong `AdminLogin` / `AdminPassword` credentials; do not use defaults in production - In cluster mode, dashboard credentials are validated against the redb-backed user store — manage users via the Auth page - The dashboard communicates with worker nodes over HTTP — secure that channel with TLS ### Dependency Modules - Tsak executes module code with the same OS privileges as the host process — audit third-party modules before deployment - Pin module versions in `manifest.json` — Tsak's hot-reload will apply any updated DLL found in `Libs/` - Monitor the `WatchdogService` — unexpected module restarts may indicate a module crash-looping on bad input