Verify tokens with one shared verifier in every service

Aperta
#9,486 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
scala, typescript

Direzione di ricerca

Start by reading the shared filter in common/auth and the agent service token handling described alongside #9043; then trace which services still register local filters, including the notebook migration service and the Dropwizard 1.3 services. The issue is done when all services use the shared verifier and the agent rejects bad signatures; key-pair signing depends on the discussion decision.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Task Summary

Every service checks the same session token, but not with the same code. Five Dropwizard 4 services register the shared filter from common/auth, notebook-migration-service registers its own copy (#5982), the Dashboard Service and the computing unit use another filter on Dropwizard 1.3 (#5428), and the agent service decodes the token without checking its signature until #9043 lands. All of them rely on one HS256 secret, which both signs and verifies, so every service that checks a token could also issue one. As the agent service, and later an MCP endpoint, start checking tokens too, the rules should be written once, and signing should stay with the issuer.

This task makes token verification one set of rules, implemented once per language and used everywhere a request arrives.

Before
flowchart LR
  req["A request<br/>with a session token"]
  v1["Five Dropwizard 4 services<br/>shared filter in common/auth"]
  v2["Notebook migration service<br/>its own copy of the filter"]
  v3["Dashboard Service, computing unit<br/>another filter, Dropwizard 1.3"]
  v4["Agent service<br/>decodes, no signature check"]
  req --> v1
  req --> v2
  req --> v3
  req --> v4
After

With the key pair of discussion point 1:

flowchart TB
  iss["Issuer<br/>signs with the private key"]
  cl["Browser, agent, MCP client"]
  jvm["Every JVM service<br/>one filter in common/auth"]
  ts["Agent service, MCP endpoint<br/>one TypeScript module, same rules"]
  iss -- "token" --> cl
  cl -- "bearer token" --> jvm
  cl -- "bearer token" --> ts
  iss -. "public key" .-> jvm
  iss -. "public key" .-> ts
Scope
  1. One verifier on the JVM. Every Dropwizard service registers the filter in common/auth. This finishes #5428, after the Dropwizard 4 upgrade in #5423, and #5982.
  2. The same rules in TypeScript. The agent service, and later the MCP endpoint, check tokens with one module that applies the same algorithm, claims, expiry and clock skew as the JVM filter. #9043 adds the first check.
  3. One scheme in the contract. The bearer scheme is declared once in the contract of #9485, so every generated client sends the token the same way.
  4. A key pair, if agreed. The issuer signs with a private key, and every verifier checks with the public key.

This task does not decide who may do what, which is #9488. It adds no identity provider or sign-in method (#7513), and the agent's own access rules stay in #5268 and #5561.

Discussion Points
  1. A key pair now or later. RS256 or ES256 now, with a window in which both old and new tokens are accepted so that no one is signed out; or HS256 until an identity provider is discussed. An identity provider would need the same verifiers, so the key pair is not wasted work.
  2. How verifiers get the public key. A JWKS endpoint on the issuer, which allows keys to be rotated, or the key in each service's configuration.
  3. Which places sign. Four places sign tokens today: the Dashboard Service at sign-in, the Computing Unit Managing Service for a unit, the Access Control Service for a mount, and the computing unit when it exports a result to a dataset. Each either keeps the private key or asks the issuer for a token.

Done when every service verifies tokens through the shared code, the agent service rejects a token with a bad signature, and, if a key pair is agreed, only the issuer holds the signing key.

Task Type
  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other
Lingua principale
Scala
Stelle
333
Fork
202
Merge medio
3g 11h
PR unite (30g)
185

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/texera

Tutte le issue di apache/texera

Issue simili

Altre issue su Scala

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.