<#7547 feat(runs): populate RunDetails.created_by ...
# flyte-github
a
#7547 feat(runs): populate RunDetails.created_by from forwarded auth headers Pull request opened by pingsutw Why are the changes needed? With auth at the load balancer (it validates the request and forwards the caller's identity), the runs service can record who ran a task.
RunDetails.action.metadata.executed_by
was never populated. What changes were proposed in this pull request? Capture the caller's identity at
CreateRun
and surface it on read as
ActionMetadata.executed_by
. The attribution is stored two ways, so it serves both display and querying: •
executed_by BYTEA
— the full serialized
common.EnrichedIdentity
(subject, plus name/email when the forwarded OIDC claims include them). Surfaced directly as
ActionMetadata.executed_by
for display. •
created_by TEXT
(indexed)
— the creator's OIDC subject (the same subject embedded in
executed_by
), stored as an indexed scalar so runs can be filtered/listed by owner. A serialized protobuf blob can't be indexed or
WHERE
-filtered; this mirrors how cloud attributes apps/workspace entities (an indexed
created_by
column). Added to
ActionColumnsSet
so it's filter/sort-able. Both are written at
CreateRun
from the same forwarded identity. •
identity.go
—
identityFromHeaders
builds the
EnrichedIdentity
from the auth headers the proxy forwards. Header names are configurable (
runs.identityHeaders
), defaulting to AWS ALB (
X-Amzn-Oidc-Data
claims JWT,
X-Amzn-Oidc-Identity
plain subject) and working behind oauth2-proxy/Traefik (`X-Auth-Request-User`/`-Email`); the
Authorization: Bearer
SDK/CLI path is always honored. JWTs are decoded, not re-verified (the proxy already validated them); base64url decode tolerates ALB's padded form. Gated by
runs.trustForwardedIdentityHeaders
(default on) — set false when the service can be reached directly, leaving attribution unset rather than trusting a spoofable header. •
identity_enricher.go
— on the Bearer (SDK/CLI) path the access token carries only the subject, so name/email are fetched from the IdP
userinfo
endpoint (resolved via OIDC discovery, cached, subject-verified). Best-effort: any timeout/error falls back to subject-only and never blocks run creation. Driven by `runs.authMetadata.externalAuthServerBaseUrl`; no-op when unset. The cookie path already carries claims in the data JWT, so it skips the lookup. • Read —
actionMetadataFromModel
deserializes
executed_by
into `ActionMetadata.executed_by`;
created_by
is the queryable mirror and isn't surfaced separately. How was this patch tested? Unit: header decode across proxy styles (ALB cookie/bearer/precedence/malformed, oauth2-proxy plain subject+email), base64 padding tolerance, enricher userinfo fetch + caching + error fallback,
executed_by
read transform, and a DB round-trip asserting
created_by
persists.
runs/{service,config,repository/...}
suites pass. Live on the
flyte-development
ALB cluster
(Okta): CLI (Bearer, userinfo-enriched) and console (cookie, claims from the data JWT) runs populate both columns; unauthenticated runs leave them unset. Labels • added Check all the applicable boxes • I updated the documentation accordingly. • All new and existing tests passed. • All commits are signed-off. flyteorg/flyte