# External secrets from Vault, Infisical and 1Password

URL: https://stack.logicaltech.it/docs/deploy/external-secrets/

Reference secrets kept in HashiCorp Vault, Infisical or 1Password Connect; LogiStack reads them at deploy time and never stores a copy.

If your company already keeps secrets in HashiCorp Vault, Infisical or 1Password, you can use them in LogiStack without copying them. You connect the secret manager once as a **secret provider**, then create secrets that point at a location in it with a `secret://` reference. Each deployment reads the current value from the provider. LogiStack stores the reference, never the value.

External secrets behave like the other [secrets](./environment-variables.mdx): you define them at the organization, a folder, a project, an environment or a service, and a service gets one only when its **Environment** tab references it.

## Supported providers [#supported-providers]

| Provider | Authentication | Reference format |
| --- | --- | --- |
| HashiCorp Vault (KV version 2) | A token, plus a namespace on Vault Enterprise or HCP | `secret://<name>/<mount>/<path>#<field>` |
| Infisical (cloud or self-hosted) | A machine identity with Universal Auth (client ID and client secret) on one project | `secret://<name>/<environment>[/<folder>…]#<secret name>` |
| 1Password | A 1Password Connect server and its access token | `secret://<name>/<vault>/<item>#<field>` |

`<name>` is the name you give the provider in LogiStack. Vault, item and field names can contain spaces: encode them as `%20`, for example `secret://op-prod/Production/Stripe%20live#secret%20key`.

Give each credential read access only, and only to the paths you plan to reference.

A [plugin](../plugins/index.mdx) can add other secret managers. They appear in the same wizard with the plugin's name as a badge, and use `secret://<name>/<path…>#<key>` references.

## Connect a provider [#connect-a-provider]

<Steps>
<Step>

### Open Secret providers [#open-secret-providers]

Select **Integrations** › **Secret providers**, then **Add provider**.

![The Secret providers page listing vault-prod, a HashiCorp Vault provider at vault.logical.internal used by one secret](/screens/secret-providers.webp)

</Step>
<Step>

### Choose where your secrets live [#choose-where-your-secrets-live]

Select **HashiCorp Vault**, **Infisical** or **1Password**, then **Continue**.

![The first step of the Add a secret provider wizard, with HashiCorp Vault, Infisical and 1Password to choose from](/screens/secret-provider-new.webp)

</Step>
<Step>

### Enter the credentials [#enter-the-credentials]

Fill in the fields for the provider:

- **Vault**: the address, such as `https://vault.example.com:8200`, and a token whose policy can read the KV paths you will reference. Use a periodic token so it does not expire.
- **Infisical**: the address (keep the default for Infisical Cloud), the machine identity's client ID and client secret, and the project ID from the project's settings. Add the identity to the project with read access.
- **1Password**: the address of your Connect server and a Connect access token with read access to the vaults you need.

Credentials are encrypted at rest and never shown again.

</Step>
<Step>

### Test the connection [#test-the-connection]

Select **Test connection**. LogiStack signs in with the credentials and checks the project or token is usable. It reads no secret. You can continue only after the test passes.

</Step>
<Step>

### Name it [#name-it]

Enter a short name such as `vault-prod`, with lowercase letters, digits and dashes. References start with this name, so keep it stable.

</Step>
<Step>

### Add it [#add-it]

Review the summary and select **Add provider**.

</Step>
</Steps>

## Reference an external secret [#reference-an-external-secret]

You can create an external secret in two ways.

**From Secrets & variables.** Open **Settings** › **Secrets & variables** (or a project's **Secrets & variables**), select **Add secret**, then **From a provider**. Enter the key and the reference, for example:

```text
secret://vault-prod/secret/app/db#password
```

Then reference the secret from each service's **Environment** tab, as with any other secret.

**On one service.** In a service's **Environment** tab, type the reference as a variable's value. LogiStack turns it into a secret owned by that service and references it.

LogiStack checks the reference when you save it: the provider must exist and the path must match its format. It does not read the value until a deployment needs it.

## What happens at deploy time [#what-happens-at-deploy-time]

1. Before it changes anything in Docker, the deployment reads every external secret the service references from its provider.
2. If any read fails, the deployment fails with a message that names each variable and the reason, such as `DB_USER (secret://vault-prod/secret/app/db#user): vault read: no field "user" at secret/app/db`. The running version keeps serving.
3. If every read succeeds, the values are injected into the containers like other secrets and masked in the deployment log.

Values stay in the worker's memory. Postgres holds the reference, the time of the last read and its error, and an encrypted hash of the value. The hash lets LogiStack notice a change without keeping the value.

## Changes in the provider [#changes-in-the-provider]

Every 15 minutes, the worker reads the external secrets that services reference. When a value changed since a service's last deployment, the service header shows **Review changes** with that variable listed, as for any [pending change](./deployments.mdx). Redeploy to pick up the new value. The containers keep the old value until then.

If a periodic read fails, the secret shows a warning icon next to its reference in **Secrets & variables**. Hover it to see the error.

## Check that it worked [#check-that-it-worked]

- On **Integrations** › **Secret providers**, select **Test** next to the provider. A toast confirms it signed in.
- Deploy a service that references the secret. The deployment succeeds, and `env` in the service's terminal shows the variable.

## Common problems [#common-problems]

<Accordions>
<Accordion title="only https URLs are allowed">
LogiStack talks to providers over https. Plain http is allowed only to a private address (such as a Vault on the same network), and only after an instance owner turns on private hosts in **Settings** › **General**.
</Accordion>
<Accordion title="resolves to a private address">
The provider's address points at a private network. An instance owner can allow private hosts in **Settings** › **General**.
</Accordion>
<Accordion title="HTTP 403 when testing or deploying">
The token or identity cannot read that path. For Vault, check the token's policy grants `read` on `<mount>/data/<path>`. For Infisical, add the identity to the project. For 1Password, give the Connect token access to the vault.
</Accordion>
<Accordion title='no secret provider named "…"'>
The name after `secret://` does not match any provider. Names are case-sensitive and use lowercase letters, digits and dashes.
</Accordion>
<Accordion title="Can I see the value in LogiStack?">
No. **Reveal** and **History** are not available for external secrets: open the value in your secret manager. Change it there, then redeploy.
</Accordion>
<Accordion title="Can I remove a provider?">
Only when no secret reads from it. Delete those secrets, or edit their reference to point at another provider, first.
</Accordion>
</Accordions>

## With the API [#with-the-api]

Provider routes are under `/api/secret-providers` (list, test, create, update, delete); the MCP server exposes the same operations as tools. Create an external secret by sending `reference` instead of `value`:

```bash title="Create an organization secret read from Vault"
curl -X POST https://logistack.example.com/api/secrets \
  -H "Authorization: Bearer $LOGISTACK_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "scope": "organization",
    "scopeId": "org_…",
    "key": "DB_PASSWORD",
    "reference": "secret://vault-prod/secret/app/db#password"
  }'
```
