# Credential Protection

Source: https://runvero.dev/docs/secrets-bolt/
Documentation index: https://runvero.dev/llms.txt

Exposing raw API keys (OpenAI, GitHub, Slack, Stripe) inside guest environment variables lets a prompt-injected tool or dependency read and exfiltrate the secret to any reachable endpoint or log output.

## Host-Side Credential Brokering

RunVero keeps secret material in the host control plane rather than handing raw credentials to the WebAssembly guest:

1. **Host-Side Secret Store:** Real secret values reside in host memory (loaded from environment variables, files, or RunVero Cloud's KMS-encrypted vault).
2. **Per-Execution Placeholders (`rvsec_...`) & `signing-only` Keys:** Guests receive a per-execution opaque placeholder token (`rvsec_...`), or—for HMAC webhook/API signing—a `signing-only` secret whose raw bytes are never injected into any wire field.
3. **Action- & Placement-Bound Substitution:** When the guest initiates an outbound HTTP request to an allowed destination, the host egress hook checks:
   - Destination binding (`--bind-secret` / `bind_to`),
   - Task-grant credential scope (`allowed_credentials`, when task grants are enabled),
   - Explicit request placement (`Authorization: Bearer`, custom header, query parameter, JSON body pointer, or `signing-only` HMAC via `x-runvero-sign-secret`), and
   - Revocation status before substituting the real credential on the wire.
4. **Response & Log Redaction:** Before HTTP responses reach the guest—and before tool outputs, errors, or audit records leave the host—`Redactor` scrubs exact configured secret strings (4 bytes or longer) and common credential token prefixes back to `[REDACTED:...]`.

```text
[ Agent / Tool Input ] ──> Never needs raw credential
                                │
[ WASI Guest Sandbox ] ──> Sees only rvsec_<per-run-token> (or signing-only ID)
                                │
[ Host Egress Hook   ] ──> Checks destination + task grant + header/query/body placement
                                │
[ Bound Destination  ] ──> Receives real credential over vetted TLS connection
```

## Operational Limits to Understand

- **Require explicit placement in production:** Legacy destination-only bindings without `--secret-placement` (or `--require-secret-placement`) allow a placeholder anywhere in a request to its bound host. Configure explicit header, query, body, or `signing-only` placement so prompt-injected guests cannot smuggle a header token into a request body, issue comment, or URL path.
- **Allowed-destination scope:** If a destination is permitted and a credential placement matches, the upstream API still decides what that credential can do. Combine credential placement with task-scoped action grants ([Security & Trust Model](https://runvero.dev/docs/security)) for multi-endpoint APIs.
- **Cloud revocation cache window:** RunVero Cloud encrypts secrets using AWS KMS envelope encryption and caches decrypted metadata on workers for up to **30 seconds**; revoking or rotating a secret takes effect across warm workers once that TTL elapses.
- **Redaction boundaries:** String redaction catches exact configured secrets (`>= 4` bytes) and known token prefixes, not arbitrary guest-side encodings or transformations—which is why keeping raw secret bytes out of guest memory is the primary control.
