Skip to content

RUN: brokered credentials can ride a named header (#374) - #380

Merged
sathish-mg merged 1 commit into
mainfrom
feat/374-credential-header
Oct 4, 2026
Merged

sathish-mg merged 1 commit into
mainfrom
feat/374-credential-header

Conversation

@sathish-mg

Copy link
Copy Markdown
Contributor

Closes #374.

What

A credential source may be prefixed header:<Name>= to send its value in that header instead of Authorization: Bearer:

--credential 'vendor=header:X-Api-Key=cmd:cat /run/secrets/vendor-key'
--credential 'vendor=header:X-Api-Key=VENDOR_KEY'                 # env, read once
--credential 'vendor=header:apikey=vault:secret/data/vendor#key'  # Vault/OpenBao

The same string works on the CLI (run start, run resume, trigger run, $AREEV_RUN_CREDENTIAL) and in the Node and Python credentials arguments and trigger credential maps, because they all share one parser (CredentialSource::from_spec). Bearer specs are unchanged.

How

  • CredentialSource::Command/Vault gain header: Option<String>. A static env source becomes Credential::Header. resolve_credential builds whichever form the source selects. TTL, re-minting on 401, @principal binding and env withholding are unchanged.
  • The header name is checked at parse time. It must be an RFC 9110 token, so empty names and CR/LF are refused. It may not be broker-owned (Authorization, Cookie, Host, Proxy-Authorization) or message-framing (Content-Length, Transfer-Encoding, Connection, TE, Trailer, Upgrade, Keep-Alive, Expect). Selecting a header twice is refused.
  • The broker already handled Credential::Header in dispatch, cross-origin redirect stripping, reflected-value scrubbing and guest-header collision (RUN-E022). This change makes it reachable from the public spec.
  • Hardening: an env-sourced value with a control character is now refused, matching what minted values already got.
  • The CLI's secret-withholding choke point looks at the source behind a header: selector, via the new CredentialSource::source_spec.

Tests

  • areev-run/tests/egress_tests.rs: grammar for every source plus each refusal. End to end against a loopback upstream: the key arrives only in X-Api-Key with no Authorization, a guest X-API-KEY gets 403, and the key never appears in an upstream failure, the call record or a refusal. Also: a cross-origin redirect drops the header, and a minted value containing CR/LF is refused by credential name.
  • Node (smoke.mjs) and Python (test_egress.py): a declared capability tool behind a human gate. The run parks, the key file is rotated, and resume runs. The upstream gets only the current key, only in X-Api-Key. The module's environment, tool result and journal never contain either key. The guest collision is refused and journaled, and bad header names are refused before anything is journaled. The Node test adds a CLI run resume leg.
  • Local results: cargo test -p areev-run (all pass), cargo test -p areev -p areev-trigger (no failures), full Node smoke 99/99, pytest 181 passed / 1 skipped (Postgres tests deselected), clippy -D warnings clean, repo_stats --check and check_versions pass.

Docs

docs/run.md (a new section with a complete Node, Python and CLI example), docs/security-model.md, the CLI USAGE, binding error strings, and CHANGELOG.md. index.d.ts is unchanged because no signatures changed.

🤖 Generated with Claude Code

A credential source may now be prefixed header:<Name>= to send its value
as that header instead of Authorization: Bearer:

  --credential 'vendor=header:X-Api-Key=cmd:cat /run/secrets/key'

It wraps env, cmd: and vault: sources and keeps their TTL, re-minting,
owner binding and withholding. One parser serves the CLI (run start/resume,
trigger run) and the Node/Python credentials arguments. The header name is
checked at parse time: an RFC 9110 token (so no CR/LF), not broker-owned,
not one that frames the message. Dispatch, redirect confinement,
reflected-value scrubbing and guest-collision refusal already handled
Credential::Header. An env-sourced value holding a control character is now
refused, as a minted one already was.

Tests: spec grammar and refusals, an end-to-end broker test against a
loopback upstream (key only in X-Api-Key, guest collision refused, absent
from call records and refusals), cross-origin redirect, and CR/LF in a
minted value. Node and Python binding tests park a run, rotate the key,
resume, and assert the upstream got the current key only in X-Api-Key. The
Node test also has a CLI resume leg.

Closes #374

Co-Authored-By: Claude <noreply@anthropic.com>
@sathish-mg
sathish-mg requested a review from a team as a code owner October 4, 2026 16:09
@sathish-mg
sathish-mg merged commit 007f2f7 into main Oct 4, 2026
19 checks passed
@sathish-mg sathish-mg mentioned this pull request Oct 5, 2026
@sathish-mg
sathish-mg deleted the feat/374-credential-header branch October 22, 2026 18:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow run broker credential sources to select a named secret header

1 participant