Stream beets imports over HTTP.

fix(cmdstream,beets): strip GOOSEFOOT_API_KEY from subprocess environments #22

Merged glerp.sullen.net
targeting main from glerp.sullen.net/goosefoot:fix/strip-subprocess-api-key
Merged opened by and assigned to glerp.sullen.net
targeting main from glerp.sullen.net/goosefoot:fix/strip-subprocess-api-key

Summary #

Prevent child subprocesses from inheriting the daemon's HTTP bearer token (GOOSEFOOT_API_KEY) while preserving all other operator-supplied environment variables (PATH, HOME, BEETSDIR, custom hook variables, etc.).

  • Add cmdstream.BaseEnviron(), which returns os.Environ() with GOOSEFOOT_API_KEY filtered out (case-insensitively on the variable name).
  • Build child environments in cmdstream.Run from BaseEnviron() so beet import, beet import -t, and post-import hooks in GOOSEFOOT_HOOKS_DIR never receive GOOSEFOOT_API_KEY.
  • Set cmd.Env = cmdstream.BaseEnviron() in CLIBeetsRunner.Version so GET /health beet version checks also exclude GOOSEFOOT_API_KEY.

Testing #

  • gofmt -l .
  • go vet ./...
  • go test -race -count=1 ./...
Commits 0