Skip to content

fix(setup): add -r to read -s PASSWORD to prevent backslash corruption#43

Open
amathxbt wants to merge 1 commit into
canopy-network:masterfrom
amathxbt:fix/setup-read-password-backslash
Open

fix(setup): add -r to read -s PASSWORD to prevent backslash corruption#43
amathxbt wants to merge 1 commit into
canopy-network:masterfrom
amathxbt:fix/setup-read-password-backslash

Conversation

@amathxbt

Copy link
Copy Markdown

Bug

setup.sh reads the monitoring-stack admin password with:

read -s PASSWORD

In bash, read without -r treats backslashes as escape characters. Any operator password containing a backslash (e.g. P@ss\\word1, a common pattern in auto-generated strong passwords) is silently mangled before being passed to htpasswd.

Impact: The hash written to middleware.yaml does not correspond to the password the operator typed. The operator is locked out of the monitoring dashboard immediately after setup, with no error message — the failure only appears when attempting to log in.

Fix

Add -r to the read invocation:

# Before
read -s PASSWORD

# After
read -r -s PASSWORD

The -r flag disables backslash escaping so the raw bytes of the password are used, matching the hash generated by htpasswd.

…ling

bash read without -r interprets backslashes as escape sequences. A password
containing a backslash (e.g. P@ss\\word1) is silently rewritten before being
passed to htpasswd, so the hash stored in middleware.yaml does not match
the password the operator actually typed.

Add -r so that read treats the input as raw bytes, matching the exact
password the user intends to set.
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