Skip to main content
Cognee exposes several environment variables that let you harden a self-hosted deployment for production use. Some controls are enforced by default, while others remain permissive for local development, so you should review each setting before exposing Cognee to untrusted users or networks.

Security Controls

Require authentication for all API requests

ENABLE_BACKEND_ACCESS_CONTROL is the canonical posture switch; REQUIRE_AUTHENTICATION is an optional override on the auth requirement alone.When neither variable is set, the default is multi-tenant mode with authentication required.
At startup, Cognee logs an auth posture: ... line summarizing the resolved decision and the reason (default, inherited from ENABLE_BACKEND_ACCESS_CONTROL, explicit REQUIRE_AUTHENTICATION, or forced on by multi-tenant mode). Use this log line to verify what is actually in effect after deployment.
If ENABLE_BACKEND_ACCESS_CONTROL=true (the default), authentication is enforced automatically regardless of the value of REQUIRE_AUTHENTICATION. Setting REQUIRE_AUTHENTICATION=false in this mode is ignored and a warning is logged at startup.

JWT token settings

There is no fixed default. When the variable is unset or blank, Cognee generates a random secret once per process instead of falling back to a shared, publicly known value. A generated secret is known only to that process, so tokens signed with it stop verifying after a restart and are rejected by every other process. Any deployment running more than one process — uvicorn workers, several replicas, or separate API and worker processes — must set the variable explicitly to the same securely generated value everywhere, and never commit the real value to version control.FASTAPI_USERS_JWT_SECRET must be the same across all instances (e.g., all Kubernetes pods) so that a token issued by one pod is accepted by another.The two sibling token secrets behave identically, and are also generated per process when unset:
With those unset, password reset links and email verification links stop working when the server restarts.
At startup, the API server logs a warning for each of these three variables it had to generate a secret for, naming the variable and what stops working without it. Startup is silent on this when all three are set. Only the server reports it — SDK, CLI and MCP usage never verifies tokens.
JWT_LIFETIME_SECONDS controls how long a bearer token or cookie remains valid before the user must log in again.AUTH_TOKEN_COOKIE_SECURE sets the Secure attribute on the auth cookie that POST /api/v1/auth/login writes. With Secure set, browsers send the cookie over https only:
The only accepted values are true and false (case-insensitive). Any other value raises an error at import, so the server does not start. Set it to true on any deployment served over TLS, including one behind a TLS-terminating proxy. Cognee sees plain http behind such a proxy, so it cannot work this out on its own. Leave it false only for http://localhost, because browsers will not store a Secure cookie from a plain-http origin.

Session revocation on password change

Each session token is bound to the password it was issued under. When a user’s password changes, every token issued before the change is rejected, including the one that made the change. This applies to the session cookie and to the Authorization: Bearer token alike, since /api/v1/auth/login returns the same token for both. All sessions are signed out immediately, including the current one, and the user signs in again to get a working token. API keys sent as X-Api-Key are not bound to the password and keep working after a change. A sign-in that upgrades the stored password hash format has the same effect, signing out the user’s other sessions.The token carries a fingerprint keyed with FASTAPI_USERS_JWT_SECRET, not the password hash itself, so a decoded token does not reveal the hash. Rotating FASTAPI_USERS_JWT_SECRET still invalidates every token, as before.Logging out only clears the cookie. The logout response deletes it with the same path, domain, Secure, HttpOnly and SameSite attributes it was set with, so the browser also drops a Secure cookie. A copied token stays valid until it expires or the password changes.Upgrading: tokens issued by earlier versions have no password fingerprint and are rejected, so every signed-in user has to sign in again once after the upgrade. Plan the rollout and tell your users before you deploy.When the API server rejects a token because it predates session revocation or because the password changed after it was issued, it logs the user id and the reason at info level. Check these lines when a client suddenly gets 401 responses; expired or invalid tokens are rejected without a log line.

Default user credentials

When an operation runs without an explicit authenticated user, Cognee falls back to a built-in default user — created on first use as a superuser. This happens for SDK/library calls, and for HTTP requests when authentication is off (single-user mode). Configure its credentials with:
The default user has no password unless you set one. With DEFAULT_USER_PASSWORD unset, the account is created password-less: SDK, CLI, and the API’s own user resolution still use it (none of them authenticate as it), but POST /api/v1/auth/login rejects every password for it. There is no built-in fallback password — earlier releases used the literal default_password, which gave every install a superuser with publicly known credentials.DEFAULT_USER_PASSWORD is applied once. When the API server starts with it set, it creates the default user if needed and gives a password-less default user that password. It never changes a password the account already has: if the value does not match the stored password, the server logs a warning and leaves the account alone — change an existing password through the API instead (log in as the account, then PATCH /api/v1/users/me with a new password; see Deploy REST API Server). When the variable is unset, the server does not create the default user at startup and logs a warning that no default-user login is configured.The local stacks supply a password for you: cognee-cli -ui (which binds the backend to localhost) and docker-compose.yml both set DEFAULT_USER_PASSWORD=default_password unless you provide your own value, so the UI login works out of the box. Do not reuse that value on a server reachable from a network — set a strong one before the first start. Leaving the variable unset avoids a default-user login only when you start the API server directly; cognee-cli -ui and docker-compose.yml both fill in default_password when it is unset.
Upgrading: an existing default user keeps the password it already has, including the old default_password. The upgrade does not remove that known credential, and setting DEFAULT_USER_PASSWORD to a new value will not replace it, so on any server reachable from a network, change it through the API. A fresh database gets a password-less default user, so if you still want a default-user login there, set DEFAULT_USER_PASSWORD on the server.
When ENABLE_BACKEND_ACCESS_CONTROL=true, HTTP endpoints require an authenticated user, so the default user is not used to serve unauthenticated requests — but SDK calls still fall back to it. DEFAULT_USER_EMAIL only takes effect before the default user is first created; changing it later does not rename an existing user. See Users for the full permission model.

API Key Storage

When false, API keys are stored as plaintext in the relational database. When true, each key is hashed with SHA-256 before storage. The raw key is shown to the user only once at creation time and cannot be recovered afterward.
Migration note: Enabling HASH_API_KEY on a running system that already has plaintext API keys stored will break those existing keys immediately — the lookup hashes the incoming value and finds no match. You must either delete and re-issue all existing keys, or run a one-off migration to SHA-256-hash the existing api_key column values.

Encrypting Neo4j Credentials

When using the neo4j_aura_dev or neo4j_community dataset database handler for multi-user mode, Cognee stores per-dataset Neo4j connection info in the relational database — for neo4j_aura_dev the provisioned Aura instance, for neo4j_community the per-dataset Docker container. The stored database password is encrypted with Fernet symmetric encryption; both handlers derive the encryption key from the same NEO4J_ENCRYPTION_KEY:
The default value "test_key" is intentionally insecure. Replace it with a long random string in any environment that stores real Neo4j credentials.
The Aura API credentials used to create or delete instances (NEO4J_CLIENT_ID, NEO4J_CLIENT_SECRET, and NEO4J_TENANT_ID) are read from environment variables when needed and are not stored in the relational database by this handler.

Encrypting Integration Credentials

Third-party OAuth integrations (Slack, GitHub, Linear, Google Drive, Gmail, Google Calendar, and Notion) store their tokens in the relational integration_credentials table. The token payload is encrypted with AES-256-GCM under a fresh random 96-bit nonce per write; only non-secret metadata — the workspace label, Slack team and enterprise ids, the bot and installing member’s user ids, the granted OAuth scopes, the allowed-channel list, the saved sync or resource selection, per-run sync counts, Slack’s sync bookkeeping (the forget-unavailable-channels setting, uninstall and deletion timestamps, and the channel ids and message timestamps of threads marked for re-reading or messages taken out of memory), and the Notion bot id and workspace icon — is stored in the clear.Keys are configured as a keyring — a set of 32-byte keys, each addressed by a short key id — so that keys can be rotated without re-encrypting existing rows:
There is no default key and no derived fallback: if neither variable is set, or a key does not decode to exactly 32 bytes, credential writes fail with a RuntimeError rather than producing ciphertext nobody can decrypt later. Generate a key with:
Rotation. Add the new key to INTEGRATION_CREDENTIALS_KEYS alongside the old one under a new id, then point INTEGRATION_CREDENTIALS_ACTIVE_KEY_ID at it. Every row records the key id it was written with, so existing rows keep decrypting under their original key; reconnecting an integration rewrites its row under the active key. Remove an old key from the ring only once no row still references it.Revocation. Disconnecting an integration marks the stored credential revoked and makes a best-effort call to the provider’s revoke endpoint. When a set ALLOW_HTTP_REQUESTS disables outbound HTTP, that call is skipped and the response carries remoteRevokeSkipped: true (see Integrations). Provider-side removal has the same effect: for Slack, an app_uninstalled or tokens_revoked event deactivates the stored installation, so no usable token survives an uninstall.

File Encryption

Cognee can encrypt the files it writes under DATA_ROOT_DIRECTORY itself, in addition to whatever your disk, volume or object store provides. It is off by default:
Each file is sealed with AES-256-GCM under its own random 256-bit data key. A key provider wraps that data key and stores it in the file header, so the key-encryption key is never written to disk.What is encrypted. Every object under DATA_ROOT_DIRECTORY: ingested originals and the text loaders derive from them, including per-dataset data directories, and the ontologies uploaded through POST /api/v1/ontologies with their per-user index, on local disk or S3. Nothing else is. Files Cognee references in place instead of copying, such as a local path or an s3:// URL passed to add(), stay as they are. SYSTEM_ROOT_DIRECTORY (the embedded SQLite, LanceDB and Ladybug files), the cache and logs are not sealed. The graph, vector and relational stores and the session cache aren’t covered either, so they still rely on backend or volume encryption at rest.Local keys. Generate a key with:
Data keys are wrapped with AES key wrap (RFC 3394) under the active key. To rotate, add a new key to FILE_ENCRYPTION_KEYS under a new id and point FILE_ENCRYPTION_ACTIVE_KEY_ID at it. Each file records the key id it was written under, so existing files keep decrypting under their original key. Remove an old key only once no file still uses it.
AWS KMS. With aws_kms, Cognee never holds a key-encryption key. Each file’s data key comes from KMS GenerateDataKey and is unwrapped by Decrypt. Both calls carry the encryption context cognee:purpose=file-storage. The provider needs boto3 (pip install "cognee[aws]"), and the runtime role must be allowed kms:GenerateDataKey and kms:Decrypt on the key. The file header records the key ARN KMS answered with, not the alias, so repointing an alias doesn’t break existing files.
Custom providers. To use another key management service, register a factory before the first file is stored. It receives the file encryption config, and any extra FILE_ENCRYPTION_* variables you set are available on it:
A provider has a name and implements generate_data_key(), which returns a DataKey(plaintext, wrapped, key_id), and unwrap_data_key(wrapped, key_id).Existing files. Turning encryption on does not rewrite files that are already stored. Plaintext files stay readable and are sealed the next time they are written, for example when the document is added again. There is no bulk re-encryption tool. Turning encryption off again doesn’t unseal anything: with FILE_ENCRYPTION_ENABLED=false, sealed files are read back as ciphertext, so keep the layer on with its keys while sealed files remain.Reading files back. Ingestion, loaders and GET /api/v1/datasets/{dataset_id}/data/{data_id}/raw decrypt transparently, so the raw-data endpoint still returns the original bytes. Loaders open files by path, so while one runs, a sealed file is unsealed into a temporary file readable only by the Cognee process user, which is deleted when the loader finishes. Put the system temp directory on an encrypted volume if that matters to you.Errors. The configuration is checked the first time Cognee stores or opens a file under DATA_ROOT_DIRECTORY, not at import. A missing or malformed key, an active key id that isn’t in the ring, an unknown provider, a missing FILE_ENCRYPTION_KMS_KEY_ID or missing boto3 raises FileEncryptionConfigurationError. The error message says how to fix it. Reading a file whose key id is no longer in the ring, or whose envelope is corrupt or tampered with, raises FileDecryptionError. A refused KMS Decrypt surfaces as botocore’s ClientError with AWS’s own error code, such as AccessDeniedException.

Local File System Access

ACCEPT_LOCAL_FILE_PATH decides whether a path the caller passes may be read with the Cognee process’s own access. That covers local files and directories (for example /etc/passwd), file:// URIs, and s3:// objects and prefixes, which Cognee reads with its own AWS credentials. The setting has three states:Left unset, the answer depends on who is calling. The SDK, the CLI and an MCP server over stdio run on the caller’s own machine, so paths are accepted there. An API request, or an MCP tool call served over sse or streamable http, names a file on the server, so it is refused, whatever address the server binds to. An explicit value applies to every surface. Set ACCEPT_LOCAL_FILE_PATH=true only when HTTP callers are trusted to read the server’s files, for example a local server that shares the caller’s checkout.A refused path raises IngestionError with HTTP status 403, before anything is read. Directories and s3:// prefixes are refused before they are listed. The message names the setting that refused the path:
The first message is for an API request with the setting unset. The second is for an explicit false. Releases before 1.6.7 returned 415 with Local files are not accepted. instead. Over HTTP, POST /api/v1/remember with content_type="code" refuses a local repository path with 400 and asks for a git URL instead.Cognee’s own storage gets no exemption: a caller’s path into the data root is refused like any other path. The only paths that skip the check are the document files of a repository that Cognee cloned itself from a URL, since the caller named the URL, not the paths. Uploads, raw text and web URLs are not affected, because they are stored first and loaded from Cognee’s own copy.When paths are refused, a string’s shape decides what it is, and Cognee never looks it up on disk, so no reply reveals whether a path exists. A web URL or a database connection string goes on to its own check. A server path is refused with 403 whether or not it exists: a file:// or s3:// URL, or a string that is only a path, meaning one token that starts with a root, ~, ./, ../ or a drive and holds a separator after its first character (/etc/passwd, ~/x, C:\data), or a hidden file at the root (/.env). Anything else is stored as literal text, for example /start, CI/CD, docs/../x or /remember to call Bob. Earlier releases stored a path-only string that named no existing file as text. When paths are accepted, nothing changes: a string that does not point to an existing file is still ingested as text.

Allowed local roots

Alongside ACCEPT_LOCAL_FILE_PATH, you can confine every local path Cognee dereferences to a set of allowed roots. With paths accepted, a plain path string outside every root is treated as text, so it is never refused or read; a file:// URI outside every root is refused instead. A path inside a root still has to pass ACCEPT_LOCAL_FILE_PATH:
The allowlist is opt-in. When the variable is unset — the default — there is no root restriction at all: any local path is readable, subject only to ACCEPT_LOCAL_FILE_PATH. That is what lets a local install ingest a repository or document tree from wherever it happens to live on the machine. Set this variable on any deployment reachable by untrusted callers; leaving it unset there with ACCEPT_LOCAL_FILE_PATH=true means an authenticated caller can name any path the Cognee process can read.When it is set, its entries are the allowed roots, separated by the platform path separator (: on Linux/macOS, ; on Windows). Cognee’s own DATA_ROOT_DIRECTORY, SYSTEM_ROOT_DIRECTORY, cache, log, and repository-clone (COGNEE_REPOS_DIR) directories are always appended to that list, so a restrictive value cannot lock Cognee out of its own storage. The clone root has to be on the list because a cloned repository’s document files (README, docs) are ingested by path exactly like a local project’s, and pass through this same check.Paths are canonicalized with realpath before the containment check, so a symlink inside an allowed root that points outside it is rejected rather than followed. Once the variable is set, a path outside every allowed root raises:
On the ordinary add() / remember() ingestion path with paths accepted, a path-looking string outside the allowed roots is never read from disk — it falls through and is ingested as plain text instead (with paths refused, a path-only string is refused before the roots are checked, as described above), though an explicit file:// URI raises IngestionError with the same message rather than falling through. Callers that read a file explicitly, such as the memory-migration sources, surface the error directly. A local repository path handed to the code-graph pipeline reports the same rejection as a CodeRepositoryError instead:
The MCP server in API mode applies the same checks before it reads a local path named in a data string and uploads it to the backend. Because the file is opened on the MCP host, the checks use the MCP process’s own environment, not the backend’s: an allowed path is uploaded as the file, a path outside COGNEE_ALLOWED_LOCAL_FILE_ROOTS is uploaded as plain text, and with paths refused the call fails with IngestionError and nothing is sent. Paths are refused there with ACCEPT_LOCAL_FILE_PATH=false, and also when it is unset and the MCP server runs over sse or streamable http, since its callers are then network callers. Set both variables on the MCP host as well as on the backend; setting them only on the backend does not stop the MCP host from reading its own files.

Presort scan roots

Folder presort is the one path that does not inherit the permissive default above. A scan opens every candidate file in a folder to hash it and sample it for personal data, so it always requires a bounded root set — even when COGNEE_ALLOWED_LOCAL_FILE_ROOTS is unset.When the variable is set, its entries are the permitted roots, exactly as for ordinary ingestion. When it is unset, presort falls back to its own bounded default instead of “anywhere”:
  • the current working directory
  • the system temporary directory
  • Cognee’s own DATA_ROOT_DIRECTORY, SYSTEM_ROOT_DIRECTORY, cache, log, and repository-clone roots
Paths are canonicalized with realpath before the containment check, so a symlink pointing out of a permitted root is rejected rather than followed. A folder outside every permitted root is refused rather than falling through to text ingestion — the scan raises ValueError: Path is outside the allowed local file roots. Add the folder to COGNEE_ALLOWED_LOCAL_FILE_ROOTS (os.pathsep-separated list) to allow it, or use the CLI's --allow-root flag. The same check guards reading a saved *.presort.json report back in, which surfaces the shorter ValueError: Local file path is outside allowed roots.The CLI’s --allow-root flag is the explicit opt-in for a folder outside those roots:
--allow-root appends the folder you named to COGNEE_ALLOWED_LOCAL_FILE_ROOTS for the lifetime of that command, which widens what presort — and everything else running in that process — may read from disk. On a shared or untrusted machine, prefer setting COGNEE_ALLOWED_LOCAL_FILE_ROOTS deliberately to the exact folders you intend to scan.
Presort scanning is read-only: it never moves, renames, or deletes anything in the folder. Personal-data findings in the report are stored redacted (j***@example.com); the raw matched values are never written into the report.

Outbound HTTP Requests (SSRF Protection)

When Cognee ingests an http(s) URL (via add() → save_data_item_to_storage) or crawls a page, it fetches that URL server-side. To prevent Server-Side Request Forgery (SSRF, CWE-918), every user-supplied outbound URL is now validated before any request is made.ALLOW_HTTP_REQUESTS gates outbound URL fetching and remote repository cloning. Its default depends on where the call comes from:An API server that should ingest web URLs or clone repositories needs the opt-in in its own environment:
A typo fails closed: ALLOW_HTTP_REQUESTS=ture disables fetching on every surface instead of enabling it. A blank value (an empty .env line, or a compose ${ALLOW_HTTP_REQUESTS} with no host value) counts as unset.Connectors keep working while the setting is unset, on the API too — see Integrations. The setting does not affect LLM or embedding provider calls, plain text, or file uploads.
This table describes cognee 1.6.8 and later. In cognee 1.6.7 and earlier, an unset ALLOW_HTTP_REQUESTS allows URL fetching and repository cloning on every surface, the API included. Only false, 0, no or off disables them, and any other value, a misspelling included, enables them. To keep an API server on those releases from fetching URLs and cloning repositories, set ALLOW_HTTP_REQUESTS=false.
When outbound requests are allowed, each URL still passes through these checks before it is fetched:
  • Scheme — only http and https are permitted. Other schemes (e.g. ftp://, gopher://) are rejected.
  • Host — the URL must contain a host, and that host must resolve. Hostless or unresolvable URLs are rejected.
  • Resolved address — the host is resolved and every resolved IP is checked. The request is blocked if any address is loopback, private, link-local, reserved, multicast, unspecified, or IPv6 site-local. This blocks internal and cloud-metadata targets such as 127.0.0.1, ::1, 169.254.169.254, 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. IP-literal URLs (e.g. http://[::1]) are validated directly, so DNS-rebinding and IP-literal bypasses are also caught.
To keep public URLs from redirecting the server to an internal address, the crawler’s HTTP client runs with follow_redirects=False — redirects are not followed automatically.A GitHub/GitLab repository URL is fetched server-side too, by git rather than by the HTTP client: add() and remember() shallow-clone it into COGNEE_REPOS_DIR (default ~/.cognee/repos) and index it as a code graph. Cloning follows the same ALLOW_HTTP_REQUESTS rule (a disabled clone is refused with HTTP 403: SSRFProtectionError from add() and remember(), CodeRepositoryError from remember(..., content_type="code")), and the clone URL clears the same outbound checks as any other http(s) ingestion. Git LFS is disabled for every git command Cognee runs, so LFS files stay small pointer files and are never downloaded. On a deployment reachable by untrusted callers, size the disk behind COGNEE_REPOS_DIR for the clones it will accumulate — they are kept and reused across calls, not deleted after ingestion.
A blocked or disabled request raises SSRFProtectionError (an HTTP 403 CogneeValidationError) instead of silently fetching the internal target. When fetching is disabled, the message names the setting:
add() and remember() check their inputs for URLs before any work starts, so a call with run_in_background=True is refused in its response instead of starting a run that fails later. If fetching is enabled and you still see a 403, check that the URL is a public http(s) address that resolves to a routable IP.

Integrations (OAuth connectors)

The built-in connectors (Slack, GitHub, Notion, Linear, Gmail, Google Drive, Google Calendar) call their providers over HTTPS, so ALLOW_HTTP_REQUESTS governs them too, with one difference from URL ingestion: an unset or blank value leaves connectors working on every surface, API included, because a connector only reaches its provider’s fixed hosts and no caller chooses where the server connects. Only a set value that disables outbound HTTP (false, or anything other than true, 1, yes or on) stops them:
  • POST /api/v1/integrations/{provider}/authorize, POST /api/v1/integrations/{provider}/sync and the resource pickers (GET /api/v1/integrations/{provider}/resources, /folders, /labels) answer 503, with a detail message that names the setting.
  • Every provider call is refused before a connection is opened, and a sync started by a webhook, the sync scheduler or the resume worker is refused before anything is fetched and recorded as a failed run.
  • DELETE /api/v1/integrations/{provider}/connection still revokes the connection locally but skips the provider-side token revoke and returns remoteRevokeSkipped: true. The token then stays live at the provider until it expires or the app is removed there.
add() over a dlt connector source from the SDK does not go through this check. Connector HTTP calls never follow redirects: a 3xx answer from a provider fails the call instead of re-sending its credentials to another host.

Database Connection-String Ingestion

A database connection string passed as data (postgresql://, postgres://, mysql://, mysql+pymysql://, sqlite:///, mssql://, oracle://) is opened by the Cognee process, from the server’s network position. A caller who can name a database can read any database the server can reach. ALLOW_DATABASE_INGESTION controls who may do this:cognee-cli --api-url and the MCP server in API mode do not open the database themselves: they upload the connection string to the API server as a text document, so it is ingested as text rather than read as a database.
API deployments that accepted connection strings before this setting existed now refuse them until you set ALLOW_DATABASE_INGESTION=true. Enable it only when every API caller is trusted.
Whatever the setting, connection strings that point at Cognee’s own storage are refused:
  • SQLite files inside Cognee’s data, system, cache, log or repository-clone roots, or at its configured database paths (SqliteSourceRefused). Paths are resolved with realpath, so a symlink into those roots is refused too.
  • Strings that carry one of Cognee’s own database username/password pairs (from the relational, vector, graph and cache settings), whatever host they name (DatabaseSourceRefused).
  • Hosts that resolve to one of Cognee’s database servers on the same port (DatabaseSourceRefused). Loopback addresses, 0.0.0.0/::, IPv4-mapped IPv6 addresses and the addresses this machine’s hostname resolves to all count as this machine. The check compares servers, not database names, because the per-dataset Postgres handlers keep every dataset’s database on one server.
The address check is best-effort. It cannot know every address of this machine or of the database host. For example, on Debian-family hosts the hostname resolves only to 127.0.1.1, and behind DB_HOST=host.docker.internal the host’s LAN address is not visible. If you enable the switch, also make sure Cognee’s databases require a password and restrict network egress.Connection strings must also meet these rules (otherwise 422):
  • A sqlite:/// path must name an existing regular file, because the driver would otherwise create it. The path may not carry the uri option, and it must be inside COGNEE_ALLOWED_LOCAL_FILE_ROOTS when that is set (SqliteSourceRefused).
  • A network connection string must name its server as the URL host, that host must resolve, and the string may carry only the sslmode, connect_timeout, application_name and charset options (DatabaseSourceRefused).
  • When the driver fails to connect, the response gives only the exception class (DatabaseSourceUnreachable). The full error is written to the server log.

Cypher Query Access

Raw Cypher search is off by default. While it is off, SearchType.CYPHER (raw Cypher queries against the graph database) and SearchType.NATURAL_LANGUAGE (natural language translated to Cypher, then executed) are rejected with SearchTypeDisabledError (HTTP 403 over the API, with the fix in the response’s remediation field; a subclass of UnsupportedSearchTypeError in the SDK), and the server logs a warning. While the flag is off, a FEELING_LUCKY search never selects either type: if the LLM proposes one, the search runs RAG_COMPLETION instead. To enable both types:
Raw Cypher lets any user with read access run arbitrary queries against the graph database, up to remote code execution on the server. Enable it only when every user of the deployment is trusted.

Search History Retention

By default, every search() and recall() is saved as plaintext question and answer rows in the relational database. Answers can quote chunk text, so this history can hold the content of your documents. Set the variable to false where query and answer text must not be kept:
Cognee reads the variable on every call, not once at import, so changing it in a running process takes effect on the next search. While it is off, no history rows are written.Turning the switch off does not remove rows that were already written. Deleting the data does:
  • forget(dataset=...) removes every user’s rows recorded for that dataset, since the dataset is gone for everyone it was shared with. Every other dataset delete does the same: datasets.empty_dataset(), datasets.delete_all() and datasets.delete_data(..., delete_dataset_if_empty=True) when it drops the emptied dataset.
  • forget(everything=True) removes those rows for each dataset it deletes, shared ones included, plus every row the caller owns.
  • forget(data_id=...) leaves history in place, because rows are recorded per dataset, not per document. Answers that quoted the document stay until a dataset or everything forget.
These purges run whatever the switch is set to. Each one runs before the dataset it covers is deleted, and a failed purge fails the call with that dataset still in place, so you can retry it.Some rows have no dataset: rows written before cognee 1.5.0, and rows from a search over several datasets with backend access control off. A dataset delete does not match them. forget(everything=True) removes only the caller’s own, so other users’ rows without a dataset stay.

Dataset & Multi-User Isolation

When enabled, Cognee creates isolated storage per user + dataset combination and enforces permission checks on every read and write operation. This is the primary control for preventing cross-tenant data leakage in multi-user deployments.Database support requirements:If you configure an unsupported backend (e.g., Qdrant, Weaviate), disable access control to avoid runtime errors:
Setting ENABLE_BACKEND_ACCESS_CONTROL=false alone also disables the auth requirement (single-user mode). You only need to add REQUIRE_AUTHENTICATION if you want to override that default — for example, REQUIRE_AUTHENTICATION=true to keep auth on for a single-user deployment behind a shared token.See Dataset Database Handlers for the full list of supported handlers.
When running Cognee locally for development or testing, you can disable authentication so that API calls succeed without a bearer token. Setting the single posture switch is enough:
With ENABLE_BACKEND_ACCESS_CONTROL=false and REQUIRE_AUTHENTICATION unset, REQUIRE_AUTHENTICATION inherits from the posture switch and the auth requirement is turned off automatically. (Previously, both variables had to be set to false independently; that is no longer required.)These values are read once when the server process starts, so you must restart the server after changing them. Check the auth posture: ... line in the startup logs to confirm the resolved decision.When authentication is disabled, unauthenticated requests are automatically served under a built-in default user (default_user@example.com). The relational database must be initialized before the first request so that this default user can be looked up or created.Troubleshooting 401 errors after setting the variables
Only use ENABLE_BACKEND_ACCESS_CONTROL=false in local or trusted environments unless you have another protection layer in place. It disables multi-user isolation, and it also disables the HTTP auth requirement unless you explicitly set REQUIRE_AUTHENTICATION=true.

Telemetry

Cognee, whether used as the Python library, the REST API server or the MCP server, sends anonymous usage telemetry by default. It records which operations run and with which settings, never the contents of your documents, queries, prompts or answers. To turn it off, set TELEMETRY_DISABLED in .env or the process environment:
Cognee checks only whether the variable is set, so any non-empty value turns telemetry off, false included. To keep telemetry on, leave the variable unset. Telemetry is also off when ENV is dev or test. During dlt ingestion (connectors, database and CSV sources), TELEMETRY_DISABLED also turns off the telemetry dlt sends to dltHub, by setting RUNTIME__DLTHUB_TELEMETRY=false in the process environment unless it’s already set. ENV set to dev or test doesn’t do this; only TELEMETRY_DISABLED does. That applies to the whole process, including your own dlt pipelines. If your process used dlt before Cognee’s first dlt call, dlt’s telemetry has already started, so set RUNTIME__DLTHUB_TELEMETRY=false yourself. Cognee also sets LOAD__DELETE_COMPLETED_JOBS=true by default, so dlt doesn’t keep a copy of loaded rows in its completed load packages. See Cleaning up dlt’s staging data. What an event contains. Events go to Cognee’s analytics endpoint, https://test.prometh.ai. Each one carries:
  • The event name, such as cognee.remember, cognee.recall, a pipeline task starting, completing or erroring, or a REST endpoint being called, plus the date, the exact time the event happened (event_time, an ISO 8601 UTC timestamp), the Cognee version and TELEMETRY_ORIGIN.
  • Settings of the operation: for example the search type, top_k, the length of the query (not its text), and the configured LLM and embedding provider and model. A model given as a local file path is reported as local_path.
  • Identifiers: two random IDs Cognee generates on first use (stored in .anon_id in the install directory and in ~/.cognee/.persistent_id), the Cognee user and tenant UUIDs, and a one-way hash of LLM_API_KEY. The key itself is never sent. Every event also says whether the caller is an agent (is_agent), meaning a child user with its own API key, such as a provisioned Claude Code or MCP plugin. For an agent, the user UUID is the agent’s own, agent_owner_id is the owning user’s UUID, and agent_plugin is the plugin key, or custom for an agent not named after a known plugin. The agent’s name is never sent.
  • While the process is connected to an instance with serve() and the instance reported a tenant: connected_tenant_id, the tenant UUID the instance’s /api/v1/users/me returned for the API key, and connected_host. A *.cognee.ai host is sent as is. Any other host is sent only as localhost (for localhost, 127.0.0.1 or ::1) or self_hosted, so self-hosted hostnames and URL paths are never sent, and neither is the instance API key. Both fields are read from the active connection in memory: they are absent after disconnect() and in a process that never called serve(), even when a saved connection exists on disk.
  • For REST API errors: the exception type, status code and route template, never the error message or the resolved path.
How events are sent. Events are queued and posted in batches from a background thread: up to 100 events or 64 KiB per request, sent within about 2 seconds of the first queued event. While the endpoint can’t be reached, the queue holds at most 10,000 events or 1 MiB and drops the oldest first. An event over 16 KiB is dropped. Network errors and 5xx responses are retried, a 4xx drops the batch, and a telemetry failure never affects the operation that sent it. Whatever is still queued is sent when the process exits or the API server shuts down, waiting at most one request timeout (TELEMETRY_REQUEST_TIMEOUT, 5 seconds by default), so a process that is killed outright can lose its last couple of seconds of events. Names you choose. Dataset names, session IDs and URLs are replaced by a fingerprint before they leave the process. Dataset UUIDs are sent unchanged. A few REST API events send names as typed: node set names on POST /v1/remember, POST /v1/add and PATCH /v1/update, tenant and role names when you create them, and uploaded file names on POST /v1/llm/infer-schema. Turn telemetry off if those names are sensitive. Cognee Cloud events. The lists above describe every origin except cloud. With TELEMETRY_ORIGIN=cloud, which Cognee Cloud sets, events follow a versioned, metadata-only contract: only listed events are sent, and only with the fields each event declares. A field that is not declared or fails its check is removed, and any failure while applying the contract drops the event without affecting the operation. Cloud events carry no random install IDs (anonymous_id is sent empty), no API key hash, no connected_* fields and no fingerprints of dataset names, session IDs or database URLs. They are identified by the user and tenant UUIDs and the agent fields, which only Cognee sets, and every event carries schema_version. The full list of events and fields is in the cloud telemetry contract. Fully private deployments. Telemetry is separate from OpenTelemetry tracing, which is off by default and exports only to a backend you configure. Turning telemetry off doesn’t keep your data on the machine: your LLM and embedding providers still receive the text Cognee processes. To run without any external service, use local models as described in Local Setup and Local Ollama, and set TELEMETRY_DISABLED=true.

Security Updates & Vulnerability Reporting

The authoritative policy is SECURITY.md in the Cognee repository. This section summarizes what it means for a self-hosted deployment. Supported versions. Security fixes ship only in the latest release on PyPI, Docker Hub and GitHub Releases. Fixes are not backported to older minor versions, so keep your deployment on the latest release to receive them. Reporting a vulnerability. Do not open a public GitHub issue. Report it through either channel: Good-faith research is covered by the policy’s safe-harbour terms. Reports are acknowledged within 2 business days and triaged within 5, with status updates at least every 10 business days while a fix is in progress. Fix windows are counted from the day the report is confirmed and depend on CVSS v3.1 severity: 7 days for Critical, 30 for High, 60 for Medium and 90 for Low. 90 days is the ceiling for any severity. A fix is a release or, where a release is not yet possible, a documented mitigation that removes the exposure. Getting notified of security releases. Each confirmed vulnerability gets a GitHub Security Advisory with a CVE, and the release that fixes it has a Security section in its notes. Upgrading is your responsibility when you self-host. These channels fire in this order:
  1. Security advisories. Watch the repository with Watch → Custom → Security alerts. Published advisories also feed the GitHub Advisory Database, so Dependabot and pip-audit flag the vulnerable version in your own project.
  2. Releases. Subscribe with Watch → Custom → Releases.
  3. Discord. Releases are announced in the Cognee Discord release channel.
  4. Direct email. Customers with a support or enterprise agreement are notified at the contact on their agreement.
Scope. The policy covers the cognee package, the official Docker images and the release process. It does not cover vulnerabilities in LLM, embedding or database providers, your own infrastructure, or cognee-community adapters. It also excludes findings that need a deliberately insecure configuration, such as ENABLE_BACKEND_ACCESS_CONTROL=false on a network-exposed server or raw Cypher left enabled for untrusted users, and scanner reports with no demonstrated impact.

Permissions Setup

Enable dataset isolation and access control

Multi-User Mode

Understand multi-tenant architecture