Skip to content

Let the engine gateway read its identity map from a Secret - #202

Merged
imaustink merged 1 commit into
mainfrom
feat/engine-static-identities-from-secret
Aug 7, 2026
Merged

Let the engine gateway read its identity map from a Secret#202
imaustink merged 1 commit into
mainfrom
feat/engine-static-identities-from-secret

Conversation

@DavidNic11

Copy link
Copy Markdown
Collaborator

What & why

The engine gateway's identity map is keyed by the bearer token, so
gateway.identity.staticIdentities can only be set by writing live credentials
into a values file. For anyone who keeps release config in version control that
is not a weaker option, it is an unusable one.

What is left is defaultSubject/defaultRoles — which grants those roles to
anything that can reach the Service. That is the choice this chart currently
forces, and it is the wrong one to force.

staticIdentitiesExistingSecret holds the same JSON under a Secret key and
takes precedence over the plain value.

Same shape agent-orchestrator already uses

This is not a new pattern. agent-orchestrator solved the identical problem
with config.staticIdentitiesExistingSecret +
staticIdentitiesExistingSecretKey, and this mirrors it down to the default key
name (AGENT_STATIC_IDENTITIES) and the if secret / else if value precedence.
Two subcharts, one concern, one way to configure it.

A sharp edge, now written down

defaultSubject reads like a default for tokenless callers. It is also the
fallback for unrecognised ones — StaticResolver.Resolve returns the
fallback on a map miss, not nil. So a gateway with a default set never denies on
identity alone, and a typo'd or rotated token silently keeps working with the
default's roles instead of failing.

That is worth knowing before someone sets a default "just in case", so the
values comment now says it.

Verification

Rendered all four states:

staticIdentitiesExistingSecret staticIdentities Result
set unset secretKeyRef
set set Secret wins; the plain token appears nowhere in the output (grepped)
unset set unchanged from before this PR
unset unset no STATIC_IDENTITIES var at all

Backwards compatible: existing installs that set the plain value render exactly
as they did.

Versions

temporal-engine 0.1.1 → 0.2.0, umbrella 0.4.0 → 0.5.0. Additive only — no
existing values change meaning.

🤖 Generated with Claude Code

The gateway's identity map is keyed BY the bearer token, so `staticIdentities`
can only be set by writing live credentials into a values file. For anyone
keeping release config in version control that is not a weaker option, it is an
unusable one — which leaves `defaultSubject`/`defaultRoles` as the only
practical way to give the hop an identity, and that grants those roles to
anything able to reach the Service.

`staticIdentitiesExistingSecret` holds the same JSON under a Secret key and
takes precedence, so the tokens stay out of the values file while everything
else stays in it. This is the shape agent-orchestrator already uses for its own
identity map (`config.staticIdentitiesExistingSecret`), down to the default key
name, so the two subcharts now configure the same concern the same way.

Also documents a sharp edge that was previously unstated: `defaultSubject` is a
fallback for *unresolved* tokens, not just absent ones. `StaticResolver.Resolve`
returns the fallback on a map miss, so a gateway with a default set never denies
on identity alone — an unrecognised token is silently as good as no token.

Verified by rendering all four states:
- Secret set: renders a secretKeyRef.
- Both set: the Secret wins and the plain token does not appear anywhere in the
  output.
- Plain value only: unchanged from before.
- Neither: no STATIC_IDENTITIES var at all.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

@imaustink imaustink left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚢

@imaustink
imaustink merged commit 349a29b into main Aug 7, 2026
6 checks passed
@imaustink
imaustink deleted the feat/engine-static-identities-from-secret branch August 7, 2026 18:48
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