credential loader breaks under HOME-redirected profiles (Hermes profile homes) #699
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Problem
The shared credential loader (
tools/_lib/credentials.sh) and two scripts with inline resolution (git/detect-platform.sh,health/stack-health.sh) resolve the default credentials file exclusively relative to$HOME. Under a HOME-redirected profile environment (e.g. a Hermes profile:HOME=/home/hermes/.hermes/profiles/<name>/home), the default resolves into the empty profile home and every Mosaic tool fails authentication unless the operator exportsMOSAIC_CREDENTIALS_FILEper invocation.Observed in production on the USC host (Edith profile):
teaauthenticated fine on both Gitea instances while every Mosaic wrapper failed, because the loader looked inside the profile home. Verified fix was a manualexport MOSAIC_CREDENTIALS_FILE=...— which is exactly the per-invocation friction the loader is supposed to remove.Fix
Add a host-level fallback candidate to the resolution chain, keeping explicit override supreme:
$MOSAIC_CREDENTIALS_FILE(explicit — never second-guessed)$HOME/.config/mosaic/credentials.json/etc/mosaic/credentials.json(host-level fallback, one symlink per host)Also export the resolved
MOSAIC_CREDENTIALS_FILEso sourcing scripts and subprocesses inherit the resolution, and apply the same chain to the inline site indetect-platform.sh.Operator-side (per affected host, one time):
ln -s <canonical credentials.json> /etc/mosaic/credentials.json. Deliberately NOT hardcoding any operator-specific repo path in the framework loader (framework firewall).