The package mirror's address reaches every app, so a token in it leaks

Aperta
#96 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
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go, kubernetes

Direzione di ricerca

Start with validMirrorURL in internal/config/config.go and trace how the mirror address reaches internal/pixienv/pixienv.go and the config written in internal/cli/podcmd/runner.go. Then review the proposed auth Secret and install-step mount design, along with the mirror documentation; done means credentials stay out of the app environment and readable config, with tests covering rejected query strings and fragments.

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

Descrizione

The package mirror's address still reaches every user's app, so a secret written into it leaks.

validMirrorURL refuses a user name or password, but a token anywhere else in the address passes, for example https://mirror.example.com/conda-forge?token=SECRET, https://mirror.example.com/t/SECRET/conda-forge (conda's own token form) or https://mirror.example.com/conda-forge#SECRET:
https://github.com/nebari-dev/tapas/blob/cc65f01120dbcf3efc76386b18a0ecc07e20cc93/internal/config/config.go#L1278-L1280

The full address is then put in the app container's environment as TAPAS_PIXI_MIRROR, which the person's own code can read:
https://github.com/nebari-dev/tapas/blob/cc65f01120dbcf3efc76386b18a0ecc07e20cc93/internal/pixienv/pixienv.go#L394-L396

and in /etc/pixi/config.toml, written world-readable (0644) and mounted into the app:
https://github.com/nebari-dev/tapas/blob/cc65f01120dbcf3efc76386b18a0ecc07e20cc93/internal/cli/podcmd/runner.go#L113

Reproduced on a local cluster with a user name and password before that check existed: inside the app, echo $TAPAS_PIXI_MIRROR printed the password.

Proposed fix: keep the mirror's address public and its credentials apart.

  • Refuse a query string and a fragment in the address, as a user name or password is refused now. A token in the path cannot be detected, so the docs say the address must hold no secret.
  • Credentials in a Secret named by a new setting (for example environments.mirror.authSecret): pixi's auth file, mounted read-only (0400) in the install step only, never in the app.
  • Keep TAPAS_PIXI_MIRROR out of the app container; the install step can keep it. /etc/pixi/config.toml can stay readable once it holds only the public address.
  • Document mirrors that need a login, and that a person's own pixi add in the app does not get the mirror's credentials.

Follow-up from #63 and #65.

Lingua principale
Go
Stelle
5
Fork
0
Merge medio
21h 13m
PR unite (30g)
53

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 nebari-dev/tapas

Tutte le issue di nebari-dev/tapas

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.