feat: OIDC client auth should accept a refreshable token source (callable or file) — a caller that computes its own token can only pass a static string
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 52/100
- Tipo di issue
- Funzionalità
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- python
- Ambito
- authentication, backend
Direzione di ricerca
Inizia con OidcAuthClientManager.get_token(), _validate_credentials() e _fetch_token_from_idp(), quindi traccia le chiamate da GrpcClientAuthHeaderInterceptor e HttpSessionManager. Chiarisci quale fonte aggiornabile proposta rientra nell’ambito, mantieni la mutua esclusività e verifica che la fonte selezionata venga riletta o invocata per ogni richiesta senza introdurre regressioni nel comportamento di autenticazione esistente.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is your feature request related to a problem? Please describe.
OIDC access tokens are short-lived by design. No identity provider issues one that
outlives a long-running process, and for machine identities the client-credentials
flow issues no refresh token at all — the caller is expected to hold a credential
and request a fresh token whenever it needs one. Every provider SDK is built
around that: you keep a credential object and call it per use, and it caches and
renews underneath.
Feast's client auth is almost aligned with this. get_token() is called on
every request — GrpcClientAuthHeaderInterceptor._append_auth_header_metadata
calls get_auth_token() per RPC, and HttpSessionManager.get_session() refreshes
the Authorization header per call — and three of the four sources in
OidcAuthClientManager.get_token() genuinely re-read each time:
token_env_var→os.getenv(...)on every callFEAST_OIDC_TOKEN→ same_read_sa_token()→ re-opens/var/run/secrets/kubernetes.io/serviceaccount/tokenon every call, which is what makes it survive kubelet's rotation of that file
The exception is token, an Optional[str] on OidcClientAuthConfig. It is the
only source available to a caller that obtains the token in process — from a
provider SDK, a credential object, a token-exchange call — and it is the one
source that cannot change. A store built with it holds that exact string for its
lifetime, so the process starts failing with 401s at expiry and has no way to hand
Feast a new value. The per-call re-read that makes the other sources work is
wasted on it.
So the shape of the gap is: Feast supports refresh only for token sources it
knows how to poll. A caller that knows how to mint a valid token has no way to
pass that capability in, only a snapshot of its output. The mutual-exclusivity
check in _validate_credentials makes this explicit — token, token_env_var
and the client-credentials group are the complete set of choices.
Two consequences we hit in practice:
-
Long-lived clients. Our only workaround is to discard and rebuild the entire
FeatureStoreper call, purely so our own token acquisition re-runs. That
throws away store construction every time, and it is not viable at all for a
long-lived server process that holds a store. -
Federated / workload identity. Any client-assertion flow (RFC 7523) exchanges
a rotating, projected credential for an access token, with no client secret
involved.client_secrettherefore does not apply, andtokencannot express
a value that changes. This is why our UI component ends up monkeypatching
get_token()outright — there is no configuration that expresses "call this to
get a token."
Describe the solution you'd like
A refreshable token source for in-process callers. In rough order of how cheap
they are:
-
A
token_filefield, read on eachget_token()call. This is a
generalisation of_read_sa_token(), which already does exactly this for one
hardcoded path — the behaviour is proven in the codebase, it just isn't
available for any other file. It covers every projected-credential and
sidecar-written-token setup declaratively, with no code and no new concepts. -
An optional callable, e.g.
token_provider: Callable[[], str], set
programmatically, whichget_token()invokes when present. Sinceget_token()
is already called per request, this needs no transport changes, and it hands
the refresh problem to the party that can actually solve it — the caller, who
owns the credential. This subsumes every provider-specific case at once and
would let Feast stop growing per-flow configuration. -
Optionally, the client-assertion grant in
_fetch_token_from_idp: a
client_assertion_fileposted asclient_assertionwith
client_assertion_type=urn:ietf:params:oauth:client-assertion-type:jwt-bearer.
This makes the common secretless machine-identity case work with configuration
alone, rather than requiring (2).
(1) and (2) are additive and independent; either one on its own resolves the
blocker.
Describe alternatives you've considered
- Request a longer-lived token from the provider. Where a provider allows the
access-token lifetime to be raised at all, the ceiling is still far short of a
process that runs for days, and raising it widens the exposure of a leaked
token. This trades a security property for a library limitation. - Rebuild the store per call. What we do. Correct, but it discards store
construction on every use and does not work for a long-lived process. - Write the token into an environment variable before each call. Would work,
sincetoken_env_varis re-read — but it means mutating global process state
from library code, and coordinating that mutation with every caller and thread. - Point
token_fileat a file we write ourselves. Not currently possible; only
the hardcoded Kubernetes SA path is read. This is what suggestion (1) unblocks. - Subclass
OidcAuthClientManager.AuthenticationClientManagerFactory
selects the manager fromauth_config.type, a
Literal["oidc", "kubernetes", "no_auth"], so a custom manager cannot be
selected. - Monkeypatch
get_token(). What we currently do for our UI component, via a
sitecustomize.pymounted onPYTHONPATHin the container. It works and is
plainly not something we want to maintain.
Additional context
Version 0.64.0; the three credential shapes are identical on 0.65.0, the latest
release. We run against Azure Entra with OIDC auth on the registry, online and
offline servers. Callers are Kubernetes pods using workload identity plus
developer machines, so nothing in the deployment holds a static token — but the
constraint is not Azure-specific. The same problem applies to any caller using a
provider SDK, and the Kubernetes SA token would have it too if
_read_sa_token() did not already re-read the file.
Happy to contribute (1) and (2) — both are small, and _validate_credentials is
an obvious place to slot additional sources into the existing mutual-exclusivity
check.
- Lingua principale
- Python
- Stelle
- 7.4k
- Fork
- 1.5k
- Merge medio
- 2g 6h
- PR unite (30g)
- 107
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di feast-dev/feast
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
I maintainer di solito rispondono entro 1 giorno
-
BigQuery data quality monitoring fails: PRIMARY KEY placed outside the column list in monitoring table DDLForse già presa @liron-velocity l’ha presa 50 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
get_online_features silently drops a join key value when it shares a name with an OnDemandFeatureView's RequestSource fieldForse già presa @OHMFOHS l’ha presa 99 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
kind/bug priority/p2
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
feast-dev/feast#6778 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di feast-dev/feast
Issue simili
-
Public benchmark import end-to-end test fails when the test stack's worker runs the parity jobApertaaccepted
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
future-agi/future-agi#6392 ·
I maintainer di solito rispondono entro 1 giorno
-
memmapped_arange ignores the start value and drops the last point above the memmap thresholdForse già presa @prathameshfuke l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
StingraySoftware/HENDRICS#213 ·
-
Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 2 giorni
-
bot-triaged module: decompositions module: edge cases module: int overflow module: primTorch oncall: pt2 triage review
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno