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

Open
#96 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
go, kubernetes

Research direction

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.

Written by the indexing model from the issue text.

Description

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.

Dominant language
Go
Stars
5
Forks
0
Avg merge
21h 13m
Merged PRs (30d)
53

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from nebari-dev/tapas

All issues in nebari-dev/tapas

Similar issues

More Go issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.