sudo drops SILTA_CONFIG/HOME, so privileged commands can resolve the wrong config #5
Labels
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
carvers/silta#5
Loading…
Reference in a new issue
No description provided.
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?
Removing the required positional CONFIG argument (src/main.rs:78) lets privileged subcommands silently resolve a different config than the one
run/setupused, because sudo's env_reset drops SILTA_CONFIG and resets HOME.Failure scenario: a user works with
export SILTA_CONFIG=~/Work/pxy/netzlive-addr.toml, runssilta run(works), then runssudo silta updateorsudo silta teardownwith no --config. sudo strips SILTA_CONFIG and sets HOME=/var/root, soconfig_pathresolves/var/root/.config/silta/config.toml. Best case the command fails with "reading ... No such file"; if a different config exists there, update reconciles the wrong interface and removes as "extra" the very addresses the live run instance is bound to, so active forwards stop accepting connections. The old CLI made this impossible: every privileged command had to name its config explicitly.Fix direction: for privileged subcommands, require an explicit --config (or otherwise detect that the default path was reached via a reset environment) rather than silently falling back.
Source: high-effort code review, CONFIRMED. Area: cli.