Skip to content

E21-32: the executor's login is held to the chart's workspace namespace, which the pod must share - #2196

Merged
kunwarshivam merged 38 commits into
mainfrom
claude/v2-vault-exec-namespace-impl
Oct 23, 2026
Merged

kunwarshivam merged 38 commits into
mainfrom
claude/v2-vault-exec-namespace-impl

Conversation

@kunwarshivam

@kunwarshivam kunwarshivam commented Oct 22, 2026 •

Copy link
Copy Markdown
Owner

Story

E21-32, the vault (claim #1442). This is the implementation half of the DEC-77 pair whose tests are #2194, and it is stacked on that PR. Beyond #2194, the test file only loses its 1 #[ignore] line, and the Unimplemented code goes.

  • workspace_namespace(configured, projected):
    • an absent or empty configured is workspace_namespace_missing, and projected is never called;
    • an unreadable pod namespace is vault_credentials_unreadable;
    • a different one is workspace_namespace_mismatch;
    • otherwise it answers the configured namespace.
  • main.rs: the executor's paper start (leased_broker) passes MANDATE_WORKSPACE_NAMESPACE and the downward API's namespace reader to it. The answer is the namespace the Kubernetes login's verdict holds the vault's service_account_namespace to (E21-32 PRV-2c-2b: the exchange takes its own code, and a Kubernetes login is held to the workspace's namespace (DEC-2061) #2095).

Only the paper broker reaches this code. A --broker fixture executor returns before it, and that includes every executor pod the deployment manager makes today, so they and the cell's executor drill are unchanged, and this PR need not wait for K2. Only an alpaca-paper executor needs K2 (lane D1, E21-33: the executor's <hex> account, the vault-token volume and MANDATE_WORKSPACE_NAMESPACE) to log in. Until K2 lands, such an executor fails closed at start, workspace_namespace_missing.

Spec clause → test

The same table as #2194; the test now runs and passes.

Dependencies

#2194, and through it #2095.

Journal events added

None.

Not done

Nothing in this pair.

Decisions needed

None.

Safety checklist (safety-critical changes)

  • No floats in money or quantity paths
  • No clock reads or randomness in the core
  • No unwrap, expect, or panics on trading paths
  • Ordering: inputs processed in journal order (n/a)
  • Replay: same inputs give identical outputs (n/a)
  • No secrets or trading content in logs or notifications
  • No x-planned or (planned: ...) marker added

Checks

  • fmt and clippy -D warnings. mandate-executord: 110 passed.
  • cargo xtask ci mutants on the diff: 15 mutants, 14 caught, 1 unviable, 0 missed.
  • Review agent report attached

🤖 Generated with Claude Code

https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF

claude added 30 commits October 19, 2026 16:54
…s policy and its role requests, tests pending (DEC-2060)

Reserves DEC-2060. Each per-connection process logs in with Kubernetes auth as
the ServiceAccount named by its connection id's hex; one templated policy per
kind reads the path from the login's own ServiceAccount name, so the dedicated
provisioner only ever creates a role bound to exactly that ServiceAccount, every
other parameter pinned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…s policy and its role requests (DEC-2060)

Implements the stubs and deletes the pending markers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…s ServiceAccount named x and the hex (DEC-2060)

A separate exchange namespace would leave its pods outside the workspace's
default deny, egress policies and admission pin. A second spike on OpenBao
2.7.1 showed a literal x before the template within one path segment works:
the executor, SA <hex>, reads connections/x<hex>/token, which the exchange, SA
x<hex>, writes; each role binds its one SA, and an even-length hex name is never
an odd-length x name.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
… hex (DEC-2060)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…espace is the workspace's (DEC-2060)

So OpenBaoConfig names every mount the login and the provisioner use, from one
place, and no second layout can disagree with it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
# Conflicts:
#	crates/mandate-vault/src/kubernetes.rs
#	crates/mandate-vault/src/tests/kubernetes.rs
…n's reader, tests pending (DEC-2060)

The contract agreed with lane LV: OpenBaoSource::login_kubernetes(config,
identity, jwt, now) for a connection's executor or token exchange, and
mounted::read_service_account_token(dir) with SERVICE_ACCOUNT_TOKEN_DIR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…nctions, tests pending (DEC-2060)

So the role and ServiceAccount checks are tested and mutated without a cluster.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…n's reader (DEC-2060)

Implements the stubs and deletes the pending markers. read_mounted and the
token reader share one bounded, link-safe read, differing only in the mode bits
they refuse and their bound.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…nd the cross-contract tests, pending (DEC-2060)

kv_path and openbao_policy become fallible so kv_path can place a
connection's entries through connection_segment, a stub here. The pending
tests pin the segment, roles named by their ServiceAccount (OpenBao folds
role and policy names to lowercase), every role parameter required, a
malformed accessor refused, and a cross-contract test: each kind's policy
with its bound ServiceAccount put in is exactly the policy written from
kv_path, over ids that collide under a raw or case-folding layout. The
process-name test reads processes.json. DEC-2060 is written in full.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…d by their ServiceAccount (DEC-2060)

Merges PRV-1a's pending tests and implements them: connection_segment is
x and the id's hex, and kv_path stores every connection's code and token
under it, so the templated policies reach exactly what every writer and
reader uses. service_account_name gives the exchange that same segment.
Roles are named by the ServiceAccount, since OpenBao folds role names to
lowercase. The provisioner's policy requires all eight parameters, and
an accessor that is not one plain segment is refused. The cell's vault
drill reads the stored segments, written out by hand.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…ceAccount, tests pending (DEC-2060)

OpenBao folds role names to lowercase, so PRV-1 names each role by its
ServiceAccount; the login's path and its verdict follow, with an Ab case.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…ceAccount (DEC-2060)

Merges PRV-2a; kubernetes_login_path gives the ServiceAccount name as the
role, and the verdict follows it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…oyment manager makes the ServiceAccounts

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…d a missing role is its own refusal, tests pending (DEC-2060)

SourceError::RoleMissing (role_missing, not an outage) lets the token
exchange's login wait for a role the provisioner has not made yet, as
agreed with lane D1; kubernetes_login_refusal is that mapping, a stub.
provision takes an optional KubernetesAuth and, given one, sets up both
Kubernetes mounts and their templated policies through stubs
kubernetes_mount_requests, mount_accessor and provision_kubernetes. A
server test pins the result on the dev server, a missing role included.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…d a missing role is its own refusal (DEC-2060)

provision, given a KubernetesAuth, enables each Kubernetes mount the
vault's sys/auth does not list, points it at the API server, and writes
each kind's templated policy keyed by its mount's accessor. A Kubernetes
login reads a refusal's body only to tell RoleMissing from the rest, and
wipes it like every other body.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…'s code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
# Conflicts:
#	crates/mandate-vault/src/kubernetes.rs
#	crates/mandate-vault/src/openbao.rs
#	crates/mandate-vault/src/tests/kubernetes.rs
#	crates/mandate-vault/src/tests/openbao.rs
…ogin is held to the workspace's namespace, tests pending (DEC-2061)

Access::Take is a new access that only a connection's token exchange holds,
on its own connection's code, granted only by its Kubernetes-auth templated
policy as update without create; the AppRole policies never grant it.
login_kubernetes gains namespace, checked by kubernetes_namespace_verdict
(a stub), and read_service_account_namespace (a stub) reads the downward
API's namespace beside the projected token. DEC-2061 is written in full
and infrastructure §5.2's token-exchange row names the take. Three tests
that widen implemented tables are behaviour-only rows until PRV-2c-2b.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…or its Kubernetes login

login_kubernetes now takes the workspace's namespace; #2009's executor
reads it from the projected volume with read_service_account_namespace,
so no pod names its own namespace in its arguments.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
… and read the executor's namespace before it dials

The pending gate names a test by its path inside its file, so each row's
test is the bare function name. The executor reads its namespace before
vault_login, as LV asked, so an unreadable one is
vault_credentials_unreadable and nothing dials without it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…not never update at all

The connection manager's AppRole grant paths rightly carry update, so the
check is over the KV data paths only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…ogin is held to the workspace's namespace (DEC-2061)

allows grants Access::Take to a connection's token exchange on its own
code, and the exchange's templated policy gives that code read and
update, never create. read_service_account_namespace reads the projected
namespace by the token's rules and holds it to a label;
kubernetes_namespace_verdict accepts only the workspace's namespace. The
three behaviour-only rows go.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
# Conflicts:
#	crates/mandate-vault/src/tests/openbao.rs
#	crates/mandate-vault/src/tests/openbao_server.rs
…ce, which the pod must share, tests pending

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…ce, which the pod must share

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01B5V2t72QcDywyLPViJtmFF
…namespace-impl

# Conflicts:
#	crates/mandate-executord/src/main.rs
@kunwarshivam
kunwarshivam marked this pull request as ready for review October 23, 2026 07:05
@kunwarshivam
kunwarshivam merged commit 40d4447 into main Oct 23, 2026
35 checks passed
@kunwarshivam
kunwarshivam deleted the claude/v2-vault-exec-namespace-impl branch October 23, 2026 07:05
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.

2 participants