diff --git a/docs/ADRs/0136-runner-secrets-through-one-stored-secret.md b/docs/ADRs/0136-runner-secrets-through-one-stored-secret.md index e9724998a8..b8a102fe83 100644 --- a/docs/ADRs/0136-runner-secrets-through-one-stored-secret.md +++ b/docs/ADRs/0136-runner-secrets-through-one-stored-secret.md @@ -110,6 +110,9 @@ that receives a value can still leak it. settling #6359, ends the interim role; the stored secret stays as the fallback for workflows that cannot use GitHub OIDC or a WIF provider with the user's secret manager. +- [ADR 0155](0155-configure-vault-backed-runner-secrets.md) decides Vault-backed + source selection for selected long-lived Fullsend runner secrets. It does not + settle the separate custom BYOA secret-handling question tracked in #6359. - An OpenShell provider is not that successor: credential drivers keep copies of values the gateway is given, without reading existing backend secrets ([OpenShell #1931](https://github.com/NVIDIA/OpenShell/issues/1931)), and a diff --git a/docs/ADRs/0155-configure-vault-backed-runner-secrets.md b/docs/ADRs/0155-configure-vault-backed-runner-secrets.md new file mode 100644 index 0000000000..7edcc00bbe --- /dev/null +++ b/docs/ADRs/0155-configure-vault-backed-runner-secrets.md @@ -0,0 +1,214 @@ +--- +title: "155. Select native or Vault sources for runner secrets" +status: Accepted +relates_to: + - agent-infrastructure + - security-threat-model +topics: + - secrets + - configuration + - workload-identity +--- + +# 155. Select native or Vault sources for runner secrets + +Date: 2026-11-03 + +## Status + +Accepted + +## Context + +Fullsend reads selected long-lived credentials in the runner process, including +Jira credentials, OTLP collector headers, and the optional GitHub bundle for +host-side scripts. Today these values come from forge-native secrets or +variables, or from the local process environment. Jira runner-secret examples +are described in [ADR 0024](0024-harness-definitions.md); OpenTelemetry +settings are in [ADR 0050](0050-distributed-tracing-instrumentation.md). +[ADR 0136](0136-runner-secrets-through-one-stored-secret.md) records the +GitHub bundle and anticipates an external secret manager accessed with the +job's OIDC identity. + +Copying a long-lived value into each repository's forge secret store is +unnecessary when the organization already operates a central secret manager. +Repository-shared configuration also needs to select different Vault paths for +different target repositories. This ADR aims to let trusted runner code resolve +selected user-managed secrets from HashiCorp Vault through workload identity, +while retaining native delivery by default and keeping resolved values out of +agent sandboxes. + +## Options + +1. **Keep forge-native storage only.** This preserves the current delivery + model, but each repository must continue to maintain its own copy of every + selected long-lived value. +2. **Choose one secret store for an installation.** This simplifies + configuration, but forces all secrets into one backend even when some + should remain forge-native. +3. **Define named connections to secret stores and select one for each + secret.** This lets multiple secrets reuse one Vault endpoint and + authentication setup, while a shared configuration layer can route + selected values to Vault and leave the rest on the existing native source. + +## Decision + +We adopt named connections to secret stores in layered configuration. Each +connection names a service kind and its connection settings; a secret selects +the named connection it uses. This lets multiple secrets share one Vault +configuration without adding a long-lived Vault credential to a forge. + +The top-level `connections` mapping names reusable connections to secret +services. Each entry has a required `kind` that identifies the service. The +top-level `secrets` mapping names a registered Fullsend runner secret and +selects a connection. A Vault configuration has this shape: + +```yaml +connections: + vault: + kind: vault + vault_address: https://vault.example.com + vault_auth_path: jwt + vault_role: fullsend-runner + vault_audience: https://fullsend.sh/vault + +secrets: + JIRA_TOKEN: + connection: vault + vault_secrets: + - kv/data/fullsend/repositories/{{repo.host}}/{{repo.full_name}}/jira + - kv/data/fullsend/organizations/{{repo.host}}/{{org}}/shared/jira +``` + +- A connection name, such as `vault`, is an arbitrary alias. Each declared + connection must specify `kind`; there is no default and Fullsend does not + infer it from the connection name. `kind` identifies the secret service and + how Fullsend connects to it. V1 defines `kind: vault`; unknown or missing + kinds fail closed. Additional kinds can be added without changing the + `secrets` shape. `native` is a reserved built-in connection name and cannot + be declared under `connections`. +- `vault_address` is required for a Vault connection, is the Vault API base + URL, and must use HTTPS. `vault_namespace` is optional and selects a Vault + Enterprise namespace. `vault_auth_path` is optional and defaults to `jwt`; + it names the mount path of the JWT auth method, without the `auth/` prefix. + `vault_role` defaults to `fullsend-runner`, and `vault_audience` defaults to + `https://fullsend.sh/vault`. These defaults may be overridden for a Vault + deployment that uses different names or audiences. Vault-specific connection + fields are valid only when `kind: vault`. +- `secrets..connection` selects a named entry from `connections`. If it + is omitted, the secret continues to use the forge-native source. The + built-in connection name `native` may be used to select that source + explicitly; it does not need a declaration under `connections`. + References to undeclared connection names are configuration errors. +- `vault_secrets` is valid only when the selected connection has `kind: vault` + and must be a non-empty ordered list of Vault KV v2 API read paths, relative + to `/v1/` and including the mount's `/data/` segment (see the + [KV v2 read API](https://developer.hashicorp.com/vault/api-docs/secret/kv/kv-v2#read-secret-version)). + Fullsend reads the latest version and takes the field named for the configured + Fullsend secret from the response's `data.data` map, such as `JIRA_TOKEN`. +- Fullsend requests the job's OIDC token for `vault_audience` and submits it to + the configured JWT auth mount and role (including the default role when + omitted). The audience must match a `bound_audiences` value on that Vault + role. The role must be configured in Vault to bind the expected issuer and + trusted repository/workflow identity, and to issue a short-lived token + limited to the required secret paths. The defaults do not grant access; + Vault's role and policy remain the authorization boundary. +- Fullsend tries candidates in order. A missing path, a path denied by the + Vault policy, or a record without the named field advances to the next + candidate. The first readable candidate containing a non-empty string wins. + Vault authentication, transport, and server errors fail the resolution + immediately. If no candidate supplies a value, the run fails; it does not + fall back to the forge-native value. +- Configuration layers merge `connections` by connection name and `secrets` + by secret name. A more-specific definition replaces the entire matching + entry; fields within that entry and Vault candidate lists are not merged. + This keeps connection identity and secret-path precedence explicit. +- Connection definitions and secret entries must come from trusted + configuration revisions. This includes each secret's `connection` selection + and complete ordered `vault_secrets` list. A PR-head or event-provided layer + cannot define or override these entries, including by removing a trusted + Vault selection or omitting its `connection` to restore the native default. + A more-specific layer may replace an entry only when that layer is trusted. + Fullsend rejects an untrusted override before using the job's OIDC token. + +Service-specific endpoint and authentication fields live on the connection; +secret locators, such as `vault_secrets`, live on each secret entry. Future +secret services can add their own connection kinds and fields without +changing the top-level `connections` and `secrets` shape. Connection settings +include the Vault address, so the job's bearer OIDC token is never sent to an +address selected by untrusted PR-head or event-provided configuration. The +Vault address must also pass deployment egress policy. Fullsend requests a +short-lived Vault token for the current invocation, reads the configured +values, and neither persists that token nor caches values between +invocations. There is no static `VAULT_TOKEN` or AppRole-secret fallback. + +Vault paths may use `{{forge}}`, `{{repo.host}}`, `{{repo.owner}}`, +`{{repo.name}}`, `{{repo.full_name}}`, and `{{org}}`. `repo.owner` is the +canonical owner or top-level namespace; `repo.full_name` is the canonical +namespace/project path, including nested GitLab groups; `org` is available +only when the target belongs to an organization or group. Repository-isolated +paths must include both `repo.host` and `repo.full_name`, preserving every +nested namespace segment. Organization-shared paths use a separate +`organizations/` prefix so they cannot collide with repository paths or a +repository named `shared`. Values come from the trusted target-repository +context, not PR-head or event-supplied repository names. `forge`, `repo.host`, +`repo.owner`, `repo.name`, and `org` each form one path component. Fullsend +splits `repo.full_name` on `/` and handles each namespace/project component +separately, preserving nested groups. Every component must be non-empty, must +not be `.` or `..`, and must not contain `/`, `\`, or control characters. +Fullsend encodes each validated component using path-segment semantics and +joins the encoded components; it never inserts raw template values into the +Vault request URL. After expansion, Fullsend validates the complete relative +KV v2 API path: it has no leading `/`, scheme, authority, query, fragment, +empty component, `.` or `..` component, or path escape. Unknown or unavailable +variables and invalid paths fail closed before Vault access. The variable +syntax is reserved for path interpolation and is distinct from shell +environment expansion. + +The initial Vault-eligible set is user-managed runner secrets whose lifecycle +Fullsend does not create or rotate: `JIRA_TOKEN`, +`OTEL_EXPORTER_OTLP_HEADERS`, `OTEL_EXPORTER_OTLP_TRACES_HEADERS`, and +`FULLSEND_GITHUB_RUNNER_SECRETS`. The bundle retains the host-side-only, +reference-only rules in ADR 0136 and ADR 0145. Forge CLI authentication such as +`GH_TOKEN` and `GITLAB_TOKEN` remains explicit operator authentication outside +this per-repository configuration. Installer-managed GitLab role, dispatch, +webhook, and trigger credentials remain native in this decision: their +creation and rotation require a write and ownership contract with the selected +secret store. + +Fetched values are scoped to their registered Fullsend consumers. They are not +written into config files, logs, or the agent sandbox. A Vault lookup failure +for a configured Vault source is a hard error rather than a reason to use a +different credential source. + +## Forge scope + +The configuration and connection-selection contract is forge-neutral. Vault +resolution via WIF is supported for GitHub Actions and GitLab CI, using each +platform's job-issued OIDC token and a Vault JWT role configured for that +issuer. The job token's audience must match the configured value; the +Fullsend audience is the default. GitLab workflows must declare an ID token +with the selected audience, because Fullsend cannot change the audience of an +already-issued token. Forgejo uses `native` when a secret omits its +connection or selects `native`; an explicit Vault selection fails closed until +Fullsend has a trusted Forgejo job OIDC token integration. Local runs likewise +use `native` only when no Vault connection is selected. An explicit Vault +selection without a supported WIF identity fails before any native credential +is read. Local runs do not accept a static Vault token as a fallback. + +## Consequences + +- Operators can reuse named connections across runner secrets and + use shared, repository-templated configuration to select per-repository + paths. +- Forge-native storage remains the default, and an explicitly selected Vault + source fails closed rather than silently using a stale native value. +- Vault-backed names in this decision are read-only and user-managed; + installer-generated GitLab credentials stay native until secret-store writes and + their rotation lifecycle are decided. +- Vault availability and WIF policy become run prerequisites for entries that + select Vault, while secret values and Vault tokens are not persisted between + runs. +- New secret services can be added as connection `kind` values with + service-specific configuration; each requires its own authentication, + access-policy, and failure-semantics decision. diff --git a/docs/architecture.md b/docs/architecture.md index b23239a26e..7f8477fbae 100644 --- a/docs/architecture.md +++ b/docs/architecture.md @@ -145,24 +145,42 @@ repo baseline and overrides) published as generated, tag-pinned JSON Schemas enforced by an always-on golden test ([ADR 0146](ADRs/0146-sandbox-environment-contract-manifest.md); [contract](normative/sandbox-env/v1/README.md)). -- Runner secrets on GitHub (interim until external secret manager support - or #6359 settles the long-term route, then kept as the fallback for - workflows without GitHub OIDC or WIF; integrations fullsend owns keep their - own named secrets): user secrets - reach host-side scripts through one - optional stored secret, `FULLSEND_GITHUB_RUNNER_SECRETS` (a JSON object of name → - value), staged by the composite action in a mode 0600 file that - `fullsend run` deletes after reading, and filtered by the resolved - `env.runner`. The bundle is never in the environment of `fullsend run` or - its children. `fullsend run` refuses runner-owned names, values too short - to redact, and references from `env.sandbox`, provider credentials, - expanded `host_files`, and overlays guarded by anything other than - `runtime.forge` or `config` (interim until ADR 0112's guarded-field check). - GitLab is unchanged: one masked CI/CD variable per secret, none of these - rules ([ADR 0136](ADRs/0136-runner-secrets-through-one-stored-secret.md)). - The refusal does not consult the credential deny-list that the - `env.sandbox` gate also checks +- Runner secrets on GitHub: the user-managed bundle is an interim native source + for custom host-side scripts until Vault-backed resolution is implemented. + Native remains the default when no Vault connection is selected, including + workflows without GitHub OIDC/WIF. Fullsend-owned integrations keep their own + named secrets, and the broader BYOA custom-secret question remains tracked in + #6359. User secrets reach host-side scripts through one optional stored + secret, `FULLSEND_GITHUB_RUNNER_SECRETS` (a JSON object of name → value), + staged by the composite action in a mode 0600 file that `fullsend run` + deletes after reading, and filtered by the resolved `env.runner`. The bundle + is never in the environment of `fullsend run` or its children. `fullsend run` + refuses runner-owned names, values too short to redact, and references from + `env.sandbox`, provider credentials, expanded `host_files`, and overlays + guarded by anything other than `runtime.forge` or `config` (interim until + ADR 0112's guarded-field check). GitLab is unchanged: one masked CI/CD + variable per secret, none of these rules + ([ADR 0136](ADRs/0136-runner-secrets-through-one-stored-secret.md)). The + refusal does not consult the credential deny-list that the `env.sandbox` + gate also checks ([ADR 0145](ADRs/0145-keep-credential-deny-list-out-of-runner-secret-refusal.md)). +- External source selection for user-managed runner secrets (target state; not + yet implemented): named connections under `connections` define service kinds + and settings, while `secrets` entries select a connection (native when + omitted). A Vault connection has an address and JWT role/audience, defaulting + to `fullsend-runner` and `https://fullsend.sh/vault`; secret paths are ordered + and templated from trusted repository context. Connection definitions and + secret entries, including source selection and path order, must come from + trusted configuration revisions; PR-head and event-provided config cannot + define or override these entries, including removing a trusted Vault + selection or omitting its `connection` to restore native. Fullsend validates + and encodes every path component and validates the completed relative KV API + path before access. Vault access uses job OIDC/WIF. Native remains the + default only when no Vault connection is selected; + an explicit Vault selection fails closed when WIF or Vault resolution is + unavailable. Installer-managed GitLab credentials remain native until Vault + write and rotation behavior is decided + ([ADR 0155](ADRs/0155-configure-vault-backed-runner-secrets.md)). - Agent configuration env vars: behavioral knobs use `{AGENT}_{SETTING_NAME}` naming (e.g., `REVIEW_SEVERITY_THRESHOLD`), delivered via `env.runner` and `env.sandbox` in the harness YAML. Each agent documents its config vars in diff --git a/docs/problems/agent-infrastructure.md b/docs/problems/agent-infrastructure.md index ef5cfc305d..9cafb20949 100644 --- a/docs/problems/agent-infrastructure.md +++ b/docs/problems/agent-infrastructure.md @@ -123,7 +123,31 @@ Many fullsend scenarios skew toward **ephemeral, task-scoped** execution (triage ## Open questions - What is the right level of isolation per agent (process, container, microVM, separate cluster)? -- How do we provide agents with “resources to do their work” (clone, tools, APIs) without over-privileging them or creating a single high-value target? (Credential access decided in [ADR 0017](../ADRs/0017-credential-isolation-for-sandboxed-agents.md), with [ADR 0092](../ADRs/0092-openai-wif-credential-delivery.md) as the first inference credential delivered entirely through a gateway provider, and [ADR 0137](../ADRs/0137-inference-gateway-credential-route.md) routing inference through an LLM gateway that accepts the job's OIDC token so the forge stores no reusable provider key ([ADR 0138](../ADRs/0138-inference-gateway-api-key-credential-mode.md) adds an opt-in API-key mode for gateways that cannot trust forge OIDC, at the cost of a long-lived secret); tool access restrictions decided in [ADR 0027](../ADRs/0027-allowed-and-disallowed-tools-for-agents.md); cross-org public GitHub Packages access decided in [ADR 0114](../ADRs/0114-github-packages-via-host-bound-workflow-token-provider.md); user secrets for host-side scripts on GitHub decided in [ADR 0136](../ADRs/0136-runner-secrets-through-one-stored-secret.md); the sandbox environment the runner provides — which env vars it injects, per runtime, and which keys it reserves from harness override — is now published as a generated, machine-checkable contract ([ADR 0146](../ADRs/0146-sandbox-environment-contract-manifest.md)); Jira access with either a bot account or an Atlassian-managed service account, through an API URL separate from the site URL, decided in [ADR 0156](../ADRs/0156-separate-jira-api-url-from-site-url.md); other resource access remains open.) +- How do we provide agents with “resources to do their work” (clone, tools, + APIs) without over-privileging them or creating a single high-value target? + Credential access is decided in [ADR 0017](../ADRs/0017-credential-isolation-for-sandboxed-agents.md), + with [ADR 0092](../ADRs/0092-openai-wif-credential-delivery.md) as the first + inference credential delivered entirely through a gateway provider and + [ADR 0137](../ADRs/0137-inference-gateway-credential-route.md) routing + inference through an LLM gateway that accepts the job's OIDC token so the + forge stores no reusable provider key. [ADR 0138](../ADRs/0138-inference-gateway-api-key-credential-mode.md) + adds an opt-in API-key mode for gateways that cannot trust forge OIDC, at the + cost of a long-lived secret. Tool access restrictions are decided in + [ADR 0027](../ADRs/0027-allowed-and-disallowed-tools-for-agents.md), and + cross-org public GitHub Packages access in + [ADR 0114](../ADRs/0114-github-packages-via-host-bound-workflow-token-provider.md). + User-managed secrets for host-side scripts on GitHub are decided in + [ADR 0136](../ADRs/0136-runner-secrets-through-one-stored-secret.md), with + source selection for selected runner secrets in + [ADR 0155](../ADRs/0155-configure-vault-backed-runner-secrets.md). The + runner's sandbox environment — its injected env vars, per-runtime values, + and keys reserved from harness override — is published as a generated, + machine-checkable contract in + [ADR 0146](../ADRs/0146-sandbox-environment-contract-manifest.md). Jira + access for bot and Atlassian-managed service accounts uses the separate API + URL decided in + [ADR 0156](../ADRs/0156-separate-jira-api-url-from-site-url.md). Other + agent resource access remains open. - Do we need a dedicated “agent runner” image or environment with a known, auditable tool set? - ~~How do we preserve end-to-end traceability for event-driven agent dispatch in GitHub Actions?~~ Decided in [ADR 0041](../ADRs/0041-synchronous-workflow-call-event-dispatch.md) (synchronous `workflow_call` dispatch for the event path). - How do we compare 3rd party vs internal vs build-our-own on concrete criteria: cost, time to first agent, compliance, and alignment with our security and coordination model? diff --git a/docs/problems/security-threat-model.md b/docs/problems/security-threat-model.md index 686af0ac5d..e161245033 100644 --- a/docs/problems/security-threat-model.md +++ b/docs/problems/security-threat-model.md @@ -107,7 +107,7 @@ In fullsend's architecture, this is mitigated by several design decisions: agent source arrived through an event or an API ([ADR 0133](../ADRs/0133-actor-attributed-data-security-boundary.md)). - How do we handle the case where legitimate code contains text that looks like prompt injection? (e.g., a test for prompt injection defenses) -- What's the blast radius if an injection succeeds? How do we limit it? (Credential exposure mitigated by keeping credentials out of sandboxes entirely — see [ADR 0017](../ADRs/0017-credential-isolation-for-sandboxed-agents.md); model-provider credentials for runtimes that need one follow the same rule through a run-scoped provider and a placeholder the agent never resolves — see [ADR 0092](../ADRs/0092-openai-wif-credential-delivery.md) and, for codex, [ADR 0099](../ADRs/0099-codex-agent-runtime.md); an inference gateway that accepts the job's OIDC token keeps reusable provider keys off the forge, though the gateway itself becomes a concentrated risk — see [ADR 0137](../ADRs/0137-inference-gateway-credential-route.md); a gateway that cannot trust forge OIDC can instead take an opt-in API key, which relies on a long-lived secret held by the forge — see [ADR 0138](../ADRs/0138-inference-gateway-api-key-credential-mode.md); the Actions workflow token used for GitHub Packages has its *placeholder* bound the same way, resolving only at the two registry hosts; but a value recovered through the registry's error echo is the job's own `GITHUB_TOKEN` and is replayable against whatever hosts the running role's forge profile already allows — read-write for `coder` — see [ADR 0114](../ADRs/0114-github-packages-via-host-bound-workflow-token-provider.md). Tool access limited by `permissions.deny` hard-blocks — see [ADR 0027](../ADRs/0027-allowed-and-disallowed-tools-for-agents.md). User secrets reach only host-side scripts that reference them, never the sandbox — see [ADR 0136](../ADRs/0136-runner-secrets-through-one-stored-secret.md). Other blast radius dimensions remain open.) +- What's the blast radius if an injection succeeds? How do we limit it? (Credential exposure mitigated by keeping credentials out of sandboxes entirely — see [ADR 0017](../ADRs/0017-credential-isolation-for-sandboxed-agents.md); model-provider credentials for runtimes that need one follow the same rule through a run-scoped provider and a placeholder the agent never resolves — see [ADR 0092](../ADRs/0092-openai-wif-credential-delivery.md) and, for codex, [ADR 0099](../ADRs/0099-codex-agent-runtime.md); an inference gateway that accepts the job's OIDC token keeps reusable provider keys off the forge, though the gateway itself becomes a concentrated risk — see [ADR 0137](../ADRs/0137-inference-gateway-credential-route.md); a gateway that cannot trust forge OIDC can instead take an opt-in API key, which relies on a long-lived secret held by the forge — see [ADR 0138](../ADRs/0138-inference-gateway-api-key-credential-mode.md); the Actions workflow token used for GitHub Packages has its *placeholder* bound the same way, resolving only at the two registry hosts; but a value recovered through the registry's error echo is the job's own `GITHUB_TOKEN` and is replayable against whatever hosts the running role's forge profile already allows — read-write for `coder` — see [ADR 0114](../ADRs/0114-github-packages-via-host-bound-workflow-token-provider.md). Tool access limited by `permissions.deny` hard-blocks — see [ADR 0027](../ADRs/0027-allowed-and-disallowed-tools-for-agents.md). User secrets reach only host-side scripts that reference them, never the sandbox — see [ADR 0136](../ADRs/0136-runner-secrets-through-one-stored-secret.md); selected runner secrets can be sourced from Vault through job WIF without changing that boundary; only trusted configuration defines connections and each secret's source and ordered paths, and PR-head or event-provided config cannot override them. Fullsend validates each interpolated path component and the completed relative KV path before Vault access — see [ADR 0155](../ADRs/0155-configure-vault-backed-runner-secrets.md). Other blast radius dimensions remain open.) - Should agents operate on Unicode-normalized text with non-rendering characters stripped, or on raw text with a separate detection pass? ([ADR 0133](../ADRs/0133-actor-attributed-data-security-boundary.md) decides that model-bound source content is the filtered representation and that raw text is never exposed; strip versus detect-and-preserve remains deferred to the versioned content-filter contract.) - How do we handle invisible Unicode in code itself (source files, not just metadata)? Some non-rendering characters are legitimate in string literals for internationalization. What heuristics distinguish malicious use from legitimate use? [ADR 0133](../ADRs/0133-actor-attributed-data-security-boundary.md) defines the source-content boundary; code-content handling remains open.