Skip to content

fog.man.reg: send the login as typed, and keep the password local - #201

Merged
mastacontrola merged 1 commit into
masterfrom
fix/man-reg-login-followups
Nov 4, 2026
Merged

mastacontrola merged 1 commit into
masterfrom
fix/man-reg-login-followups

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Problem

Review of #200 found three problems in fogLogin():

  • echo $password split and globbed the value. A password holding *, ?, a run of spaces, or spelled -n reached the server changed, and a correct login read as invalid. b* expanded to file names in the working directory.
  • username and password were globals, so the plaintext password outlived the function.
  • A rejected deploy login printed nothing about imaging.

Fix

  • Encode with printf '%s' "$value" | base64 | tr -d '\n'. read -r keeps a backslash. Leading and trailing blanks are still trimmed, as the web UI trims every posted value.
  • Declare username and password local.
  • Print "This host will be registered without deploying an image." after a rejected deploy login.

Test

New tests/checks/man-reg-login.sh drives fogLogin() with a stubbed callServer. It fails on the #200 version (glob expansion, leaked password and username, wrapped long value) and passes here. tests/run-all.sh: 33 passed, 0 failed.

🤖 Generated with Claude Code

Review follow-ups to the fogLogin() change (#200):

- Quote the value and encode it with printf. The bare `echo $password`
  split and globbed it, so a password holding '*', '?', a run of
  spaces, or spelled -n or -e reached the server changed, and a
  correct login read as invalid. `read -r` keeps a backslash. The tr
  joins base64's 76-column wrap for a long value. Leading and trailing
  blanks are still trimmed, as the web UI trims every posted value.
- Declare username and password local, so the plaintext password
  does not outlive the function.
- Say "registered without deploying an image" after a rejected deploy
  login, as the domain question already does.

tests/checks/man-reg-login.sh cuts fogLogin() out of the script and
drives it with a stubbed callServer. On the #200 version it fails on
the glob expansion, the leaked password and username, and the wrapped
long value.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mastacontrola
mastacontrola merged commit 87590f6 into master Nov 4, 2026
1 check passed
@mastacontrola
mastacontrola deleted the fix/man-reg-login-followups branch November 4, 2026 01:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant