> This page is for Remediation Orchestrator.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.nvidia.com/remediation-orchestrator/llms.txt.

# Managing Secrets

> Configure and use secrets without exposing their values in Remediation Orchestrator workflows

Remediation Orchestrator workflows must never contain secret values. A deployment delivers
values onto each worker as environment variables or local files; Remediation Orchestrator
configuration maps them to stable names; and a module resolves those names
only inside the activity that needs them. Temporal workflow history records
the secret name, not its value.

Remediation Orchestrator does not connect to a secrets manager from a script. How you place
values on the worker is deployment-specific — for example
[HashiCorp Vault](https://developer.hashicorp.com/vault/docs/install) with the
[External Secrets Operator](https://external-secrets.io/latest/introduction/getting-started/),
or a JSON file mounted onto the worker for local use.

With the Helm charts, the operator places values on the worker pods through the
application chart's `extraEnv`, `extraEnvFrom`, `extraVolumes` and `extraVolumeMounts`,
and supplies the TOML mapping through its configuration
([Helm configuration](/remediation-orchestrator/deployment/helm/reference/application-chart#configuration-and-scripts),
[important values](/remediation-orchestrator/deployment/helm/reference/application-chart#important-values)). The charts
do not install a secrets manager: the referenced Kubernetes Secrets must already exist or
be synchronized by your own tooling. This guide owns placeholder resolution and rotation.

## Placeholders

| Placeholder | Where | When it resolves | Result |
| --- | --- | --- | --- |
| `{env:VAR}` | Remediation Orchestrator TOML | Config load / worker start | The environment-variable value |
| `{file:/path}` | Remediation Orchestrator TOML | Config load / worker start | The trimmed contents of that file |
| `{jsonfile:/path:field}` | Remediation Orchestrator TOML | Config load / worker start | The string value of `field` in the JSON object |
| `{jsonfile_as_file:/path:field}` | Remediation Orchestrator TOML | Config load / worker start | A path to a newly written file that contains that field |
| `{secret:NAME}` | Module inputs that document support | Inside the Temporal activity | History sees the secret **name** only |

TOML placeholders belong in configuration only. In scripts, pass
`{secret:NAME}` to modules that support secrets.

<Note>
Writing `"{secret:NAME}"` in a normal Starlark string does nothing — Remediation Orchestrator
will not replace it with the secret. Pass it only through a supported module
argument (for example SSH `env` or an HTTP header) and the module will fill in the
real value inside the activity.
</Note>

## Setup

1. Place the value on every Remediation Orchestrator worker that can run the activity, as an
   environment variable or a local file. Grant access only to the workload
   identity and workers that need it.
2. Map that source to a Remediation Orchestrator secret name in the top-level `[secrets]`
   section of the Remediation Orchestrator TOML configuration, or use a placeholder directly in
   a module setting that needs the value at startup (for example a certificate
   path).

```toml
[secrets]
# The value is injected by the deployment; do not put the token in this file.
issue_tracker_token = "{env:ISSUE_TRACKER_TOKEN}"
```

Placeholders are resolved when Remediation Orchestrator loads its configuration. If a
referenced environment variable, file, or JSON field is absent, configuration
loading fails rather than silently using an empty value.

After changing the source or the `[secrets]` mapping, restart or redeploy
Remediation Orchestrator workers so they reload configuration. Changing the source value alone
does not update an already-running worker.

Use a descriptive secret name that is safe to appear in workflow history and
logs. The script-facing name is a stable contract; the environment variable or
file path is a deployment detail.

### Environment variables

`{env:VARIABLE_NAME}` reads an environment variable. The name must use
uppercase letters, digits, and underscores.

### Local JSON files

`{jsonfile:/path/to/secrets.json:field}` reads a **top-level string field**
from a JSON object on disk. This is useful when a deployment or local setup
mounts several secrets in one file instead of one environment variable each.

The file must be a JSON object whose values are strings:

```json
{
  "issue_tracker_token": "the-token-value",
  "svc-maestro-ssh.privatekey": "-----BEGIN OPENSSH PRIVATE KEY-----\n..."
}
```

```toml
[secrets]
issue_tracker_token = "{jsonfile:/etc/secrets/maestro.json:issue_tracker_token}"
```

The path and field are separated by the **last** colon, so field names may
contain dots (`cert.pem`). Nested objects, arrays, and non-string values are
not supported.

Use `{jsonfile:...}` when the configuration field should become the secret
string (tokens, passwords, `[secrets]` mappings). Use
`{jsonfile_as_file:/path/to/secrets.json:field}` when a module expects a
**filesystem path** (SSH identity files, TLS certificates). Remediation Orchestrator writes the
field to a mode `0600` file under `$TMPDIR/maestro-config-secrets/` and
substitutes that path:

```toml
[modules.ssh.client_options.default]
identity_file = "{jsonfile_as_file:/etc/secrets/maestro.json:svc-maestro-ssh.privatekey}"
```

`{file:/path/to/secret}` is the whole-file equivalent of `{jsonfile:...}`: it
substitutes the trimmed contents of a plaintext file.

## Usage in script workflows

The module passes the secret name to its activity and resolves the value only
in the activity runtime; the plaintext value is not added to Temporal workflow
history.

### Pass a secret to an SSH command

The [ssh](/remediation-orchestrator/reference/starlark/modules/ssh) module accepts `{secret:NAME}`
in `env` map values. The **entire** value must be the placeholder — not part of
a larger string. This example maps the Remediation Orchestrator secret to the remote process's
`SERVICE_TOKEN` environment variable:

```starlark
result = ssh.bash(
    host,
    "service-check --authenticated",
    env={
        "SERVICE_TOKEN": "{secret:issue_tracker_token}",
    },
)
```

Do not interpolate the secret into the command string. Passing it through the
activity's environment avoids placing it in the workflow argument or history.
The remote command must also avoid printing the value or exposing it in its own
logs.

### Add a secret to an HTTP header

The [http](/remediation-orchestrator/reference/starlark/modules/http) module expands `{secret:NAME}`
anywhere in a header value inside the activity. This example sends the Remediation Orchestrator
secret as a Bearer token in the `Authorization` header:

```starlark
response = http.get(
    "https://service.example.com/v1/status",
    headers={
        "Authorization": "Bearer {secret:issue_tracker_token}",
    },
)
```

### Authenticate HTTP with an OAuth2 profile

This path is separate from `[secrets]` / `{secret:NAME}`. Configure a named
OAuth2 client-credentials profile under `[modules.http.auth.<name>]`, keep the
client secret in the environment with `{env:...}`, and pass the **profile name**
as `auth` from Starlark. The bearer token is minted inside the activity and
never enters workflow history.

```toml
[modules.http]

[modules.http.auth.artifact-service]
token_url = "https://login.example.com/oauth2/token"
client_id = "maestro-artifact-client"
client_secret = "{env:ARTIFACT_CLIENT_SECRET}"
scope = "artifacts.read"
allowed_url_prefixes = ["https://artifacts.example.com/"]
```

```starlark
artifact = http.file(
    "https://artifacts.example.com/diagnostics/report.tar.gz",
    name="report.tar.gz",
    auth="artifact-service",
)
```

`http.file` has no `headers` argument, so it cannot take `{secret:NAME}` that
way — use `auth` for a profile, or use `http.get` / related calls when you need
header placeholders. Omit `auth` for unauthenticated downloads. `http.get` /
`post` / `put` / `patch` / `upload` accept the same `auth` profile name.

By default the client ID and secret are sent to `token_url` in the form body.
If the token endpoint wants HTTP basic auth instead, set `auth_style = "header"`
on the profile. The accepted values are `"params"` (the default) and `"header"`.

For streaming and attaching files, see
[Handling Files](/remediation-orchestrator/guides/file-handling).

### Migrate Slack webhook destinations

Slack webhook sends require an exact match against a URL configured in the
tenant's `[modules.slack].default` or `[modules.slack.channels]`. Scripts
that pass an unconfigured HTTP(S) URL as `channel` now receive a validation
error before an HTTP request is made. Redirects from configured webhooks are
also rejected.

Move the destination into trusted tenant configuration and use a channel alias
from the script:

```toml
[modules.slack.channels]
alerts = "{env:SLACK_ALERTS_WEBHOOK_URL}"
```

```starlark
slack.send_message("Health check complete", channel="alerts")
```

Raw URLs that exactly match a configured destination continue to work, as do
Slack API channel IDs when a bot token is configured. Webhook URLs contain
credentials; keep them out of script source and application logs.

This restriction applies to the Slack module. The generic HTTP module still
allows arbitrary destinations for requests without an authentication profile,
subject to network controls. Auth-profile URL restrictions protect that
profile's credentials; they do not establish a global outbound-request policy.

## Rotate a secret

Rotate the value in your secrets manager, update the projected environment
variable or JSON file, and roll out Remediation Orchestrator workers so they start with the new
source and reload TOML. Verify with a narrowly scoped workflow that confirms
authentication without returning or logging the credential.

For a safe rotation:

1. Create the replacement secret in the secrets manager and update the
   environment-variable projection or JSON file on the worker.
2. If the external service supports overlap, keep the previous credential valid
   until the Remediation Orchestrator rollout and verification complete.
3. Restart or redeploy Remediation Orchestrator workers. Statically loaded modules use secrets
   resolved at startup, so changing the source value alone does not update an
   already-running worker.
4. Run a least-privileged verification workflow, then revoke the old credential
   and remove its access.

Keep the Remediation Orchestrator secret name stable during a normal value rotation. Scripts can
continue using `{secret:issue_tracker_token}` while only its source-backed
value changes. Rename the secret only when deliberately changing the script
contract, and update all affected configurations and workflows together.

## Rules for safe handling

**Do**

- Store secret values in a secrets manager (or equivalent), never in TOML,
  Starlark, source control, test fixtures, or shell history. A local JSON or
  plaintext file on the worker is a delivery mechanism, not a substitute for
  keeping values out of the repository.
- Use `{env:...}`, `{file:...}`, `{jsonfile:...}`, and `{jsonfile_as_file:...}`
  only in configuration, and `{secret:...}` only in a supporting module input.
- Return only non-sensitive results such as status codes and IDs from workflows
  and activities.
- Restrict secret access by workload identity, deployment, and activity need.

**Do not**

- Log headers, environment maps, command lines, error objects, or HTTP bodies
  that might contain a secret.
- Put a secret value into workflow inputs, return values, signals, queries,
  logs, or any variable you plan to print or return.