Security
Security in Cognipeer has two parts:
- hardening the running system,
- and handling vulnerabilities responsibly in the public repository.
Public Vulnerability Reporting
Do not open public GitHub issues for security vulnerabilities.
Use GitHub's private vulnerability reporting flow for the repository when it is enabled. If private reporting is temporarily unavailable, contact the maintainers through private repository-owner channels instead of disclosing details publicly.
The root SECURITY.md file is the canonical policy.
Default Hardening Expectations
Before you run Cognipeer outside local development, do the following:
- set a strong
JWT_SECRET, - set
PROVIDER_ENCRYPTION_SECRETto its own random value of at least 32 characters, different fromJWT_SECRET(production refuses to start without it), - keep
.env.localand runtime secrets out of version control, - review CORS settings before exposing
/api/client/*endpoints to browsers, - use HTTPS and trusted ingress or reverse proxies, and list them in
TRUSTED_PROXIESso IP allowlists and IP rules see the real client address, - separate dev, staging, and production credentials.
Access Control
Every request of every workspace is decided by one policy engine: roles, group grants, project permissions and API token scopes are turned into allow and deny decisions by built-in policies, and custom policies add exceptions. Refusals carry a decision id you can replay in the IAM center, and the engine fails closed (503) rather than guessing. See Authorization (IAM), and for reading a refusal Troubleshooting and FAQ.
Outbound Requests and Runtime Settings
Calls that Cognipeer makes to addresses an organization configures pass through the outbound request policy: the provider endpoint checks described in Providers and the OUTBOUND_HTTP_* settings. The policy applies to model, embedding, image, speech and moderation provider calls, OCR, web search, crawler fetches and webhooks.
These environment variables tune it and related defaults. The full table is in Configuration.
| Variable | What it does |
|---|---|
PROVIDER_RUNTIME_GUARD | warn (default) or enforce. Whether a provider call at request time to an address the policy refuses is only logged (warn) or refused (enforce). Endpoints are checked when a provider is saved in both modes. |
CLIENT_API_IP_RATE_LIMIT_PER_MINUTE | Requests per minute one client address may make to /api/client/* and /api/public/* before authentication (0 = off). Set TRUSTED_PROXIES first when Cognipeer is behind a proxy. |
GUARDRAIL_DEFAULT_FAIL_MODE | auto (default) or open. With auto, new PII and prompt-shield guardrail presets fail closed; with open, every new guardrail fails open. |
MCP_STDIO_ENABLED | Whether MCP servers that run as a local subprocess (stdio) may be used. Enabled by default; set false to turn them off. |
Dependency and Image Remediation
Treat dependency and image remediation as a staged release workflow:
- Code dependencies: update direct and transitive runtime dependencies within supported version ranges, then verify document conversion, mail delivery, Fastify routes and the affected service contracts.
- Production dependency closure: keep build and test tooling out of the runner image. Before using a production-only install, move every runtime dependency, including TypeScript runtime tooling and Fastify plugins, into
dependencies. - Operating-system packages: rebuild from a current base image and apply available security package updates after all required OS packages are installed. Revalidate browser and process-launch capabilities.
- Runtime tool inventory: remove CLI tools from the runner image only after confirming that production workflows do not invoke them directly or indirectly.
- Workload separation: where browser automation has a materially different dependency footprint, evaluate a separate browser worker image instead of weakening the API image's runtime requirements.
- Verification and enforcement: rebuild both the Community and Enterprise images, scan their immutable local or registry digests, and switch to enforcement only after the approved policy reports no fixable blocking findings. Track vendor-unfixed findings separately; do not hide them behind permanent exceptions.
Secret Handling
- Commit only
.env.example. - Never commit
.env.local, cloud credentials, API keys, TLS private keys, or provider secrets. - Avoid logging request or response bodies unless you intentionally accept the sensitivity tradeoff.
- Prefer secret managers or platform-managed secret injection for production deployments.
Multi-Tenant Safety
Tenant isolation is a core security boundary.
- Always derive tenant identity from trusted auth context.
- Always switch to the correct tenant database before tenant-scoped operations.
- Never accept raw client-supplied tenant identifiers without server-side validation.
- Treat provider credentials and file storage metadata as tenant-scoped assets.
See Multi-Tenancy and Authentication.
Operational Checks
For self-hosted production deployments, verify at minimum:
/api/health/liveand/api/health/readyprobes,- structured logs without secret leakage,
- backup and restore for SQLite or MongoDB,
- dependency updates and vulnerability scanning,
- explicit incident-response ownership.
Public Repo Hygiene
When the repository is public:
- keep CI running on pull requests,
- use dependency update automation,
- keep issue templates and contribution rules visible,
- review deployment files before publishing infrastructure-specific details,
- treat docs as part of the release surface.

