Skip to content

A secret is a write-only value, such as an API key. Your VM sends requests without the key, and the key vault adds it only to requests for the exact host in your rule.

The vault encrypts the value and keeps it write-only. Every answer and the dashboard show the name, version and description, never the value. A name is unique in its project.

  1. Open Secrets.
  2. Select Create secret.
  3. Enter openai in Name.
  4. Enter your key in Value.
  5. Enter Team OpenAI key in Description.
  6. Select Create secret.

A secret belongs to the project in its create body, default when omitted. A VM or profile can reference only a secret of its own project.

A rule is saved with the VM. It names one exact HTTPS host and one of a header or a placeholder, plus the secret. The value reaches only the nodes that serve a VM with a rule for it. The openai preset fills the domain, header, prefix and format, so you choose only the secret.

A rule names the secret by secret_id, the id in the create answer. The samples use sec_6f1c0f0e8a; use the id of your own secret.

  1. Open SVMs.

  2. Select Create SVM.

  3. Enter worker in Name.

  4. Select Create SVM.

  5. Select worker in the table to open it.

  6. Select the Security tab.

  7. Select Use a secret under Secrets.

  8. Choose openai in Secret.

  9. Choose OpenAI in Service.

  10. Select Add secret.

  11. Open SVMs, select Open terminal on worker, and run:

    Terminal window
    curl -sS -o /dev/null -w '%{http_code}\n' https://api.openai.com/v1/models
    Output
    401

OpenAI answers 401 because the test value is not a working key. The request carried it, and the VM never held it.

Keep a credential in a secret, not in env. A command in the VM can print its environment variables.

The catalog gives the exact domain, header, prefix and format for common providers, and each id is the value that --inject takes. It is not a destination allowlist, and a later edit to a preset never changes an existing VM. The dashboard shows the same catalog under Service in the Use a secret sheet.

Terminal window
curl -sS "https://api.slashinfra.com/secret-injection-presets" \
-H "Authorization: Bearer $SI_API_KEY" | python3 -m json.tool
Output
[
{
"id": "openai",
"service": "OpenAI",
"rules": [
{
"domain": "api.openai.com",
"header": "authorization",
"value_prefix": "Bearer ",
"value_format": "raw"
}
]
},
...
]

For a service without a preset, name the domain, header, prefix and format yourself. Slack uses slack.com, the authorization header and the Bearer prefix. Create the secret with your Slack token first, on Secrets with Create secret or with the command below.

Terminal window
printf '%s' "$SLACK_TOKEN" | si org secret create slack --description 'Team Slack token'
Output
slack

The API samples use sec_7a2b3c4d5e; use the id of your slack secret.

  1. Open SVMs.
  2. Select Create SVM.
  3. Enter slack-worker in Name.
  4. Select Create SVM.
  5. Select slack-worker in the table to open it.
  6. Select the Security tab.
  7. Select Use a secret under Secrets.
  8. Choose slack in Secret.
  9. Choose Custom in Service.
  10. Enter slack.com in Host.
  11. Choose Bearer token header in Send as.
  12. Select Add secret.
  13. Open SVMs, select Open terminal on slack-worker, and run:
Terminal window
curl -sS https://slack.com/api/auth.test
Output
{"ok":false,"error":"invalid_auth"}

Slack answers invalid_auth because the test value is not a working token. The request carried it.

The CLI has no flag for a placeholder or for a custom basic_x_access_token rule. Use the API for those; a preset can still add a basic_x_access_token rule.

A profile holds the same secret_injections list. A VM created with the profile copies the list at creation, and a later edit affects only new VMs. The CLI has no flag to add a rule to a profile, so use the dashboard or the API.

  1. Open Workload profiles.
  2. Select Create profile.
  3. Enter ai-workers in Name.
  4. Select Use a secret under Secrets.
  5. Choose openai in Secret.
  6. Choose OpenAI in Service.
  7. Select Add secret.
  8. Select Create profile.

List returns the metadata of every secret in one project, by name, with its version and description. The value is never part of an answer.

  1. Open Secrets.
  2. The table lists every secret of the project with Name, Version and Updated. A description appears under its name.

The description is a note for your team. A change to it keeps the value, the version and every rule. Empty text clears it. The audit row is secret.update and omits the text.

  1. Open Secrets.
  2. Select More actions on openai, then Edit description.
  3. Enter OpenAI key for agents in Description.
  4. Select Save.

A replace stores the new value as the next version. Every node that serves a VM with a rule for the secret must cache it before the answer. If a node does not answer in time, the request returns 503 secret_pending and keeps the new version, so send the same request again. A node that misses the value stops injecting the old one.

  1. Open Secrets.
  2. Select the replace icon on the openai row, labelled Replace secret openai.
  3. Enter the new key in Value.
  4. Select Replace value.

Delete removes the value and its metadata, and it cannot be undone. A secret that a VM or profile still references answers 409 secret_in_use, so remove the rules first. A rule that names a deleted secret can never be created.

  1. Open SVMs.
  2. Select More actions on worker, then Delete.
  3. Select More actions on slack-worker, then Delete.
  4. Open Workload profiles.
  5. Select More actions on ai-workers, then Delete.
  6. Open Secrets.
  7. Select More actions on openai, then Delete.
  8. Select More actions on slack, then Delete.

--inject PRESET:SECRET expands a preset into its rules. --inject-rule DOMAIN:HEADER:SECRET[:PREFIX] sends one raw rule. The secret_injections rows are the rule fields of POST /svms and of a profile.

Field Type Default Allowed values What it changes
name (<NAME>) string Required 1 to 32 lowercase letters, digits and hyphens, starting with a letter; unique in the project The secret name.
value (standard input) string Required At least 1 character The secret value. It is write-only and never returned.
project (--project) string default A project name, or its proj_ id The project that holds the secret.
description (--description) string or null Empty At most 200 code points, no control character; empty clears it An optional note for your team, never the value.
ref (<SECRET>) string Required A name, or its sec_ id; an id resolves in every project The secret that describe, replace or delete acts on.
secret_injections (--inject, --inject-rule) array Empty An array of rules; a given list replaces the stored list whole The HTTPS rules saved with the VM or profile.
secret_injections[].domain string Required One exact hostname; no wildcard The HTTPS host that gets the value.
secret_injections[].secret_id string Required A sec_ id, or connection:<id> The secret or connection that the rule injects. The CLI flags take a secret name or id.
secret_injections[].header string One of header or placeholder A lowercase token, except host, content-length, transfer-encoding, connection, upgrade, te, trailer, cookie and proxy-* The request header that carries the value.
secret_injections[].placeholder string One of header or placeholder ^__[A-Z0-9_]{8,60}__$ A token in the path or query that the vault replaces. The CLI has no flag for it.
secret_injections[].value_prefix string Empty No CR, LF or NUL; ignored by basic_x_access_token The text before a raw value, such as Bearer .
secret_injections[].value_format string raw raw or basic_x_access_token raw sends the prefix and value; basic_x_access_token sends the Basic credential that git uses.

Scroll horizontally to see all columns.

Code When Fix
invalid_name Create sends a name that breaks the rule in Options. Send 1 to 32 lowercase letters, digits or hyphens, with a letter first.
invalid_value Create or replace sends an empty value. Send a non-empty value on standard input.
invalid_description Create or describe sends more than 200 code points or a control character. Shorten it and remove control characters.
name_taken Create uses a name another secret of the project has. Choose another name.
secret_not_found Describe, replace or delete names no secret in the project, or a VM or profile rule names a secret of another project. Check the name or id, and the project.
secret_in_use Delete names a secret that a VM or profile references; describe or replace names a database-managed db: secret. Remove the rules that name it; a db: secret belongs to its database.
secret_pending Replace stored the new version but a node did not cache it in time. Send the same request again; the new version stays.
invalid_injection A VM or profile rule has a bad domain, header, placeholder or format, or not exactly one of header and placeholder. Send one exact host and one of a header or placeholder.
unknown_secret A VM or profile rule names a secret id that no secret of the organization has. List the project’s secrets and use the id.
secret_unavailable A request through the key vault names a host whose secret was deleted or is not ready. Check the rule and replace or remove the secret.

Scroll horizontally to see all columns.

Errors that any request can return are in the error catalog.

Operation Who can Key action
Create a secret Any member secret:write
List secrets Any member secret:read
Change the description Any member secret:write
Replace the value Any member secret:write
Delete a secret Any member secret:delete
List the presets Any member None
Use a secret in a VM Any member svm:write
Save rules in a profile Any member profile:write

Scroll horizontally to see all columns.

  • A name has 1 to 32 lowercase letters, digits and hyphens and starts with a letter.
  • A description has at most 200 code points and no control character.
  • A value has at least one character; an empty value is refused.
  • A rule names one exact HTTPS host; a wildcard is refused.
  • A rule has a header or a placeholder, not both.
  • A placeholder is __, 8 to 60 uppercase letters, digits or underscores, and __.
  • A header cannot be host, content-length, transfer-encoding, connection, upgrade, te, trailer, cookie or proxy-*.
  • No two rules share a domain and header, or a domain and placeholder.
  • Only HTTPS on port 443 gets the key. Plain HTTP, other ports and Tailscale traffic do not.
  • A client that pins a provider’s certificate or public key cannot use a secret on port 443.
  • A secret that a VM or profile references cannot be deleted; remove the rules first.
  • Every replacement makes one new version; nodes must cache it before the answer. A 503 secret_pending keeps the new version.

The full list is in Limits.