Secrets
SMTP passwords, API tokens, OAuth secrets… no longer need to sit in clear in APP_PARAMETERS, DEV_PARAMETERS or PREPROD_PARAMETERS, which travel with the project, the backups and every copy of the base. The parameter file holds a reference; the value lives in a per-server vault.
The reference
In a parameter file, a text value that is exactly pass.<name> is replaced at load time by the secret <name>. This applies to APP_PARAMETERS, WEB_PARAMETERS, PREPROD_PARAMETERS, DEV_PARAMETERS and DEV_PARAMETERS_*:
{ "vo_Param": { "vo_Mail": { "vt_Host": "smtp.example.com", "vt_User": "me", "vt_Password": "pass.smtp" } } }
- It is a JSON string:
"vt_Password": "pass.smtp". Unquoted,pass.smtpmakes the JSON invalid (the editor refuses to save). - The whole value must be the reference:
"x pass.smtp"or"pass.smtp "stay as they are. - The
pass.prefix is case-sensitive.<name>is 1 to 128 characters amongA-Z a-z 0-9 _ -(64 at most before BSPK Tools 21.6.124). - It works at any depth, in objects and in collections.
- Nothing changes for code that reads the parameters: it still reads
Storage.vo_Param.vo_Mail.vt_Passwordand gets the resolved value. - Unresolved reference (secret missing, or encrypted with another machine's key): the text
pass.<name>stays in place, andbspk.logrecords the unresolved references, with the file and the names, never a value. The admin screen also lists the missing secrets.
The value
- No length limit: only an empty value is refused. Long values are split into chunks (see below). Symbols and accented characters are kept intact.
- The input fields of the screen impose no maximum length.
Where the values live
| What | Where |
|---|---|
| The vault | Data/bspk-secrets.json of your application: out of git, not in the build, and left in place by the update tool (the data folder does not move) |
| The key | BSPK/bspk-secrets-key.pem in 4D's user preferences folder (on Windows, %APPDATA%\4D\BSPK\), that of the system user running 4D |
- Each value is encrypted with RSA-OAEP 2048 / SHA-256 (
4D.CryptoKey): UTF-8, then base64, split into 240-character chunks, each chunk encrypted, the chunks joined by a dot. - The key is created at the first write, and never regenerated if it is unreadable or has no private key: writes then fail.
- Losing the key means re-entering every secret. Back it up with the server configuration, never with the data.
- One vault per server: a copy of production data on a development machine carries the vault but not the key. References stay unresolved (and logged); each environment enters its own secrets.
BSPK_SECRET_RESOLVEruns on the server: a remote client reloading its parameters gets the values resolved by the server, as it used to get the clear file.
Managing secrets
In the browser: /bweb/parameters
The parameters page, reserved for system accounts (see Parameter files):
- a Secrets pane beside the editor. On a wide screen (1024 px and up), a Secrets button to the right of the file tabs shows or hides it, and the choice is remembered. On mobile, the pane is always shown below the editor;
- the list of names, never values: the reference, the state (readable or not with this machine's key), the last write. Per row: Copy (copies the reference
pass.<name>, never the value), Change, Delete (with confirmation); - + Add and Change open a small dialog. The name is read-only when changing. The value can be typed but is never shown again;
- references found in the open file without a secret are listed as buttons that open the dialog with the name pre-filled;
- in the editor, typing
"pass.suggests the existing names; - the "Loading rules" help recalls the
pass.<name>syntax.
In the 4D application: the launcher's Secrets button
For sites without BWEB, the launcher's Secrets button opens a dialog that lists, sets and removes secrets, executed on the server.
Guarantees on write
Before writing, the vault re-reads the value it has just encrypted and compares it character by character: a secret that cannot be read back never replaces the old one. Errors are translation keys, never a text that could carry the value.
In diagnostic outputs
No route returns a secret value. Reading Storage through the Claude API masks with *** the sensitive keys (passwords, tokens, keys…) and any value that equals a vault secret or contains one, whatever its key name: the resolved value lives in Storage under any name.
Good to know
- Moving a parameter file to another server moves the references, not the secrets: re-create them there (production, pre-production, each development machine).
- A reference without quotes breaks the JSON; with a trailing space it is no longer a reference.
- Copying the vault without the key is useless; copying the key is copying the secrets. Treat the
.pemfile like a password. - A name refused as "too long" on an installation older than 21.6.124 hits the old 64-character limit.
See also
- Parameter files: the files, the load order, the admin screen
- Claude API: reading
Storage - The Mail class:
vo_Mail.vt_Password, OAuth secrets - Updating an installation: the vault stays in the data folder

