Security variables
Tokens, encryption, outbound REST hosts, masking and the old VAULT_* settings
Change these to set your own token and encryption secrets, and to limit what forms may call and show.
Example
Your own secrets, REST calls limited to one API and an internal network, and one more masked key. In the compose project’s .env:
ACCESS_TOKEN_SECRET=change-me-to-a-long-random-string
ENCRYPTION_SECRET=change-me-to-32-random-characters
REST_ALLOWED_HOSTS=api.example.com,10.20.0.0/16
MASK_EXTRAVARS_REGEX=password|secret|token|apikey
Set ENCRYPTION_SECRET before the first credential is stored. From 7.3.0, setting or changing it re-encrypts every stored secret at the next start, with ENCRYPTION_SECRET_PREVIOUS naming the old key when it was your own, see Changing the encryption secret.
REST calls and jq
From 7.3.0 the REST helper functions (fn.fnRestBasic, fn.fnRestAdvanced, fn.fnRestJwt, fn.fnRestJwtSecure) check the certificate of the endpoint they call, like every other connection; up to 7.2.0 they never did. Three settings apply to them:
| Variable | Default | Effect |
|---|---|---|
REST_IGNORE_CERTS | 0 | 1 skips the certificate check: only for endpoints with a self-signed certificate |
REST_TIMEOUT_SECONDS | 60 | How long a REST call waits for an answer before it fails with a timeout |
JQ_TIMEOUT_SECONDS | 30 | How long a jq filter may run before it is stopped; jq output is also capped at 64 MB |
All three take effect when saved, without a restart. For an endpoint whose certificate is signed by a private CA, keep the check on and give Node.js that CA instead: set NODE_EXTRA_CA_CERTS to a PEM file holding it in the app’s environment, then restart the app.
Variables
Every variable of this group, with its type, default and description:
| Variable | Choices/Defaults | Comments |
|---|---|---|
| VAULT_ADDR string | HashiCorp Vault address (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store | |
| VAULT_TOKEN string Secret | HashiCorp Vault token (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store | |
| VAULT_NAMESPACE string | HashiCorp Vault namespace (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store | |
| VAULT_KV_VERSION number | Default: 2 | Vault KV secret engine version (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store |
| VAULT_DEFAULT_MOUNT string | Default: secret | Default Vault KV mount (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store |
| VAULT_CACHE_TTL_MS number | Default: 60000 | Vault read cache TTL (ms) (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store |
| VAULT_SKIP_VERIFY string | Default: false | Skip Vault TLS verification (deprecated)
Deprecated since 7, removed in 8. The first 7.x start that finds these variables imports them once as the secret store |
| ENTRA_AUTHORITY_URI string added in version 7.3.0 | Default: https://login.microsoftonline.com | Microsoft Entra ID sign-in authority
The Microsoft identity platform the server sends a Microsoft Entra ID sign-in to, with the tenant id of the provider after it ( |
| ENTRA_GRAPH_URI string added in version 7.3.0 | Default: https://graph.microsoft.com | Microsoft Graph API base URI
The Microsoft Graph endpoint the server calls at a Microsoft Entra ID login to read the user’s group membership ( |
| AZURE_AUTHORITY_URI string added in version 7.0.4 | Default: https://login.microsoftonline.com | Microsoft Entra ID sign-in authority (deprecated)
Deprecated: use |
| AZURE_GRAPH_URI string added in version 4.0.3 | Default: https://graph.microsoft.com | Azure Graph API base URI (deprecated)
Deprecated: use |
| REST_ALLOWED_HOSTS string added in version 6.0.0 | Default: | Allowed hosts for REST expressions
Comma-separated list of hostnames and/or CIDR ranges that REST helper functions ( When set, only these destinations are allowed; everything else is blocked. When unset, no allow-list is applied (default behaviour, all hosts allowed). Hostnames are matched case-insensitively against the URL host; CIDRs are matched against the IPs that the host resolves to (so an entry like Example: Caveat: this only protects the AnsibleForms Node.js process. Ansible playbooks run on the host directly and bypass this guard. |
| REST_DENIED_HOSTS string added in version 6.0.0 | Default: | Blocked hosts for REST expressions
Comma-separated list of hostnames and/or CIDR ranges that REST helper functions ( Wins over Hostnames are matched case-insensitively against the URL host; CIDRs are matched against the IPs that the host resolves to. Caveat: this only protects the AnsibleForms Node.js process. Ansible playbooks run on the host directly and bypass this guard. |
| REST_TIMEOUT_SECONDS number added in version 7.3.0 | Default: 60 | REST call timeout (seconds)
How long the REST helper functions ( Without a limit, an endpoint that never answers kept the request and the form field waiting forever. A value that is not a number above 0 falls back to the default. Takes effect when saved. |
| REST_IGNORE_CERTS boolean added in version 7.3.0 | Default: 0 | Ignore REST certificates
Whether the REST helper functions ( Until 7.3.0 they never checked it, so a man in the middle could read their tokens and answers. They now check it like every other connection: trust a private CA with NODE_EXTRA_CA_CERTS, or set this to 1 only for endpoints with a self-signed certificate. Takes effect when saved. |
| JQ_TIMEOUT_SECONDS number added in version 7.3.0 | Default: 30 | jq timeout (seconds)
How long a jq filter may run before the jq process is killed: A runaway filter (for example a recursive definition that never ends) used to keep a jq process spinning forever. jq output is also capped at 64 MB. A value that is not a number above 0 falls back to the default. Takes effect when saved. |
| EXPRESSION_SANITIZER string added in version 6.3.0 | Choices:
| Server expression sanitizer
Server expressions (fields of type
An unknown value falls back to |
| API_TOKEN_MAX_DAYS number added in version 7.0.0 | Default: 90 | API token maximum life (days)
A role with the Profile > API token makes one for any account. A local or LDAP user confirms their password ; a Microsoft Entra ID or OIDC user has none here, so the token is made from their session, which must have signed in at most 10 minutes before (the page sends them through the sign-in again otherwise). An API token cannot make another. Each token is listed on the profile and on the user’s page in Settings > Users (made, expires, last used), where the user or an admin revokes it. Blocking a user ends their tokens too. An SSO user’s token carries the roles of their last sign-in: a group change in the identity provider reaches it only when they sign in again and make a new one. |
| PASSWORD_MIN_LENGTH number added in version 7.0.0 | Default: 8 | Minimum password length
A local password set through the application - a new user, an admin setting it, a user changing their own - needs at least this many characters, and is neither the username nor the public default password. Length rather than composition rules: a long passphrase is strong and easy to remember. ADMIN_PASSWORD at the first start is not checked. Applied without a restart. |
| CONTENT_SECURITY_POLICY number added in version 7.0.0 | Default: 1 | Enforce the Content-Security-Policy
The web app is served with a Content-Security-Policy: scripts from the app itself only, so a script injected into a page does not run, and no other site may frame it. It allows what the app needs: local form expressions (evaluated in the browser), inline styles, images from any url (form and category images), and the code editor’s workers. With 0 it is sent as Content-Security-Policy-Report-Only: the browser’s console says what it would block, and nothing is blocked - for a setup that cannot work with it yet, a reverse proxy that injects its own script for example. |
| AUTH_RATE_LIMIT number added in version 7.0.0 | Default: 120 | Sign-in requests a minute from one address
A ceiling on the authentication endpoints - the login, the logout, the token refresh and the single sign-on callbacks - per client address and per app node: above it they answer 429 before any password or token is looked at. Generous, so that a person or a script never reaches it ; LOGIN_MAX_FAILURES is what stops a password from being guessed. Behind a reverse proxy, set TRUST_PROXY so the address is the client’s. Applied without a restart. |
| LOGIN_MAX_FAILURES number added in version 7.0.0 | Default: 5 | Failed sign-ins before an account locks
After this many failed logins in a row, an account (local or LDAP) is locked for LOGIN_LOCKOUT_MINUTES: every attempt is refused with status 429 before any password is checked, whether the account exists or not. A successful login clears the count, and so does an admin setting the user’s password. Counted in the database, so every app node sees the same attempts. 0 turns the lockout off. Applied without a restart. |
| LOGIN_MAX_FAILURES_PER_IP number added in version 7.0.0 | Default: 30 | Failed sign-ins from one address before it is held back
One address trying many accounts: after this many failed logins within LOGIN_LOCKOUT_MINUTES, every login from it is refused with status 429 until that window ends. Behind a reverse proxy, set TRUST_PROXY so the address is the client’s and not the proxy’s. 0 turns it off. Applied without a restart. |
| LOGIN_LOCKOUT_MINUTES number added in version 7.0.0 | Default: 15 | Account lockout (minutes)
How long an account stays locked after LOGIN_MAX_FAILURES failed logins, and the window in which the failures of an account and of an address are counted. 0 turns the lockout and the per-address limit off. Applied without a restart. |
| ACCESS_TOKEN_SECRET string Secret | Default: *** NOT REVEALED *** | Access token secret
AnsibleForm uses Basic Authentication as authentication mechanism. Not set: each start generates a random secret, so a restart ends every session and everyone logs in again. An app node ( |
| ACCESS_TOKEN_EXPIRATION string | Default: 30m | Access token expiration
A JWT (Json Web Token) is only valid for a certain amount of time. |
| ACCESS_TOKEN_REFRESH_EXPIRATION string | Default: 24h | Refresh token expiration
Once the access token is expired, and the client tries to connect to the server, the client hits a 401 error (unauthorized). The client application captures this error, and calls the refresh API with its refresh token. If the refresh token is valid, the client gets a new set of access and refresh tokens and retries the last unauthorized api call with the renew access token. |
| ACCESS_TOKEN_ISSUER string added in version 5.0.8 | Default: ansibleforms | Access token issuer
The issuer of the access token is the name of the application that issues the token. |
| ENCRYPTION_SECRET string Secret | Default: *** NOT REVEALED *** | Encryption secret
AnsibleForms encrypts the passwords and tokens it stores in the database with this secret. Set your own : without it they are encrypted with a default key that is public in the source code. The secret must be 32 characters long ; a shorter one is extended and a longer one cut. Setting it, or changing it, re-encrypts every stored secret with it on the next start, in one transaction, so none is lost : from the default key the first time, from ENCRYPTION_SECRET_PREVIOUS after that. Set the same value on every app node, the worker and every RTE that registers itself. |
| ENCRYPTION_SECRET_PREVIOUS string Secret added in version 7.3.0 | Default: | Previous encryption secret
When ENCRYPTION_SECRET changes from a key of your own to another, set this to the old one for one start : every stored secret is re-encrypted from it to the new ENCRYPTION_SECRET, then it is not used and can be removed. Not needed when ENCRYPTION_SECRET is set for the first time (the stored secrets are then re-encrypted from the default key). When the stored secrets were encrypted with a key that is neither, nothing is changed and the worker refuses to start, saying in the log which variable to set. |
| REGEX_FILTER_JOB_OUTPUT string | Default: \[low\] | Job output filter (regex)
Sometime, the job output is flooded with meaningless output, such as ‘Gathering Facts’, or ‘Includes’. You filter out these by add a piece of string in the taskname, i.e. |
| MASK_EXTRAVARS_REGEX string | Default: password|secret|token | Extravars to mask (regex)
When you have sensitive extravars, such as passwords, tokens, keys, credentials, you do not want these to be shown in clear text in the extravars section of a job. Since 6.4.1 the value of every |
| EXTRAVARS_USER_FIELDS string | Default: | User fields in the extravars
Every job carries the launching user as Leave it empty (the default) and the whole object is sent, exactly as in every release before this one. Set it to a comma separated list of top level keys, for example A single form can override this with its Note: the FAQ suggests asserting on |