# Environment variables

Describes Keryn 0.5.2 and keryn-rules 0.8.0.

> Every environment variable the keryn command reads, with its default.

Source: https://keryn.dev/docs/reference/environment/

Flags win over these. The same data is in [/cli/reference.json](https://keryn.dev/cli/reference.json), which also lists every flag with its default.

| Variable | Meaning | Default |
|---|---|---|
| `KERYN_REVIEW_TOKEN` | Read-only GitHub review token for trusted pull-request approval checks when a release signature is required. Never put it in candidate code. | GITHUB_TOKEN when available; otherwise host approval cannot be established |
| `KERYN_ENFORCED_BASE` | Trusted CI fallback commit SHA for PR policy enforcement when provider base metadata is unavailable; fetch this commit before scanning. Set in the trusted job, never from candidate content. | provider pull-request base metadata or the fetched target branch |
| `KERYN_PR_AUTHOR` | Trusted CI identity of the pull-request author, used to reject self-approval. Set only from trusted job metadata. | GitHub pull_request.user.login when available; otherwise unset |
| `KERYN_DEBUG` | Print the stack of an internal error. | unset |
| `KERYN_CONFIG_DIR` | Where keryn login keeps the device key, the device token, the cached entitlement and an offline licence (each file mode 0600). | $XDG_CONFIG_HOME/keryn, else ~/.config/keryn (Windows: %APPDATA%\keryn) |
| `KERYN_SERVER` | The Keryn service keryn login signs in to. | https://api.keryn.app |
| `KERYN_TOKEN` | Non-interactive sign-in for CI: a service-account token an organization administrator issued in Account > Developers. Used instead of a stored keryn login (an offline licence still comes first); never written to disk or printed. Store it as a CI secret. | unset |
| `KERYN_LICENCE_FILE` | An offline licence file to use instead of the installed one. | licence.kl in the config directory |
| `KERYN_MACHINE_ID` | Development builds only: a stand-in machine identity for tests. Release builds ignore it and read the operating system (Linux /etc/machine-id, macOS IOPlatformUUID, Windows MachineGuid); only a hash is used. | unset |
| `KERYN_ENTITLEMENT_DEV_KEYS` | Development builds only: extra entitlement verifying keys (JSON). Release builds ignore it. | unset |
| `KERYN_NO_CACHE` | Set to 1 to skip the rescan cache for the run (same as --no-cache). | unset |
| `KERYN_OWNERSHIP_DIR` | Trusted local ownership issuer state directory; contains a private signing key, not project input. | $XDG_STATE_HOME/keryn/ownership, else ~/.local/state/keryn/ownership |
| `KERYN_CACHE_DIR` | Where the rescan cache lives. | the platform cache directory (see keryn cache path) |
| `KERYN_CACHE_MAX_MB` | Size cap of the rescan cache; least recently used files are deleted past it. | 512 |
| `KERYN_DEEP_TIMEOUT_MS` | Time limit of cross-file analysis, in milliseconds (--deep-timeout sets seconds). | 300000 |
| `SOURCE_DATE_EPOCH` | Unix seconds used as the timestamp when --timestamp is not given, for reproducible output. | a fixed 1970 timestamp |
| `KERYN_NATIVE` | Path to the keryn-native binary that runs the Workbench commands. An empty value disables it. | searched on PATH and next to keryn |
| `KERYN_MCP_GUARD` | Path to the keryn-mcp-guard binary used by keryn mcp guard. | searched on PATH and next to keryn |
| `KERYN_DOCS_PACK` | Directory of another offline docs pack in the same format, read by keryn docs. | the pack inside this CLI |
| `KERYN_RUNTIME_PACK` | Directory of another unpacked Keryn Runtime release, used by keryn runtime in place of the agent inside this CLI. | the agent inside this CLI |
| `KERYN_NDAY` | Set to 0 to turn known-fix matching off in keryn scan. | on (enabled) |
| `KERYN_REGISTRY_USERNAME` | With keryn sca image --pull: the user name for the registry. Sent with KERYN_REGISTRY_PASSWORD to the token endpoint the registry advertises, or to the registry on a Basic challenge. Never written to an output. | none: an anonymous pull |
| `KERYN_REGISTRY_PASSWORD` | With keryn sca image --pull: the password or access token that goes with KERYN_REGISTRY_USERNAME. Never written to an output. | none |
| `KERYN_REGISTRY_TOKEN` | With keryn sca image --pull: a bearer token for the registry, used as is (for example one from a cloud provider's own login command). Never written to an output. | none |
| `KERYN_SCA_DB` | Directory of the offline advisory snapshot that keryn sca db update installs and keryn scan and keryn sca image read. The value off makes scans ignore an installed snapshot. | the user data directory: &lt;data dir>/keryn/sca-db |
| `KERYN_NDAY_DB` | Directory with the known-fix database (manifest.json and signatures.v1.jsonl). | the database the known-fix updater (keryn-native) installed, else the one packaged with the build |
| `KERYN_NDAY_ALLOW_UNSIGNED` | Set to 1 to load an unsigned known-fix database in this CLI. Development only; a warning is printed. | unset (unsigned databases are refused) |
| `KERYN_CORE_WASM` | Path to keryn-wasm-core.wasm when running from a checkout. | the workspace build output |
| `GITHUB_TOKEN` | Token for keryn decide export --github. There is no flag for it. | unset |
| `GITLAB_TOKEN` | Token for keryn decide export --gitlab. There is no flag for it. | unset |
| `CI` | When set, keryn decide sign refuses: a person signs a release, never a pipeline. | unset |
