Skip to navigation

Secret Injector plugin

The Secret Injector plugin adds a secret to the request that the upstream receives, as a header or a query parameter. The data plane fetches the secret from a vault on every request, so secret values never appear in the plugin configuration. The plugin can also remove a header or query parameter that the client sent. Secret Injector is a Preview plugin, so the data plane must allow Preview plugins.

Where it runs

ProtocolsHTTP and LLM routes. On MCP routes, only requests that the gateway forwards as plain HTTP. Tool calls, tool lists, and session setup that the gateway makes itself don’t get injected values.
Scope kindsservice, route
PhaseRequest

On LLM routes, a header that the connection’s own credential writes overwrites an injected header of the same name.

Configuration

injections
array of objectsRequired

The changes to make, in order. Must not be empty.

injections[].target
stringRequired

header or query.

injections[].name
stringRequired

The header or query parameter name.

injections[].mode
stringDefaults to set

set replaces any value that the client sent. add keeps the client’s value and adds another. delete removes the header or parameter, and needs no source.

injections[].source.vault_id
string

The vault that holds the secret. Required for set and add.

injections[].source.value_ref
string

The reference to the secret in the vault. Required for set and add.

injections[].source.property
string

The field to read from a structured secret.

injections[].source.version
string

The secret version to read.

injections[].value_template
stringDefaults to The secret value

A template that must contain {{secret}}, for example Bearer {{secret}}.

injections[].on_missing
stringDefaults to fail

What to do when the secret can’t be read. fail breaks the plugin. With the default fail_closed, the request ends with 502. skip leaves out this injection and applies the rest.

An injection that contains the secret itself, in a value, secret, or secret_ref field, is rejected. An instance with an invalid configuration never runs, and every request that it applies to gets 502.

Example

{
"name": "partner-api-key",
"plugin_id": "secret-injector",
"scope": { "kind": "service", "name": "partner-api" },
"config": {
"injections": [
{
"target": "header",
"name": "Authorization",
"value_template": "Bearer {{secret}}",
"source": { "vault_id": "my-vault", "value_ref": "partner/api-key" }
},
{ "target": "header", "name": "X-Debug", "mode": "delete" }
]
}
}