-
Notifications
You must be signed in to change notification settings - Fork 9
Lemur/feature/work authentication fix lemur #74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: development
Are you sure you want to change the base?
Changes from all commits
a9edcc5
f4ccbfc
b01be5a
a8c41ae
cc54b2e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -9,10 +9,23 @@ read -r POST_DATA | |||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # Debug log for generated hash | ||||||||||||||||||||||||||||||||||
| DEBUG_LOG="/tmp/auth.log" | ||||||||||||||||||||||||||||||||||
| touch $DEBUG_LOG | ||||||||||||||||||||||||||||||||||
| # Clear log before each attempt to keep file space usage small | ||||||||||||||||||||||||||||||||||
| echo "" > "$DEBUG_LOG" | ||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||
| # get the platform type | ||||||||||||||||||||||||||||||||||
| PLATFORM=$(cat /sys/devices/soc0/machine) | ||||||||||||||||||||||||||||||||||
| echo "PLATFORM: $PLATFORM" >> "$DEBUG_LOG" | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+16
to
+18
|
||||||||||||||||||||||||||||||||||
| # Extract the password from POST data (URL encoded) | ||||||||||||||||||||||||||||||||||
| USER="root" | ||||||||||||||||||||||||||||||||||
| if echo $PLATFORM | grep -q "LEMUR"; then | ||||||||||||||||||||||||||||||||||
| USER="admin" | ||||||||||||||||||||||||||||||||||
| ACCESS_FILE="/opt/etc/.htpasswd" | ||||||||||||||||||||||||||||||||||
| elif echo $PLATFORM | grep -q "PINN"; then | ||||||||||||||||||||||||||||||||||
| USER="root" | ||||||||||||||||||||||||||||||||||
| ACCESS_FILE="/etc/shadow" | ||||||||||||||||||||||||||||||||||
|
Comment on lines
+20
to
+25
|
||||||||||||||||||||||||||||||||||
| if echo $PLATFORM | grep -q "LEMUR"; then | |
| USER="admin" | |
| ACCESS_FILE="/opt/etc/.htpasswd" | |
| elif echo $PLATFORM | grep -q "PINN"; then | |
| USER="root" | |
| ACCESS_FILE="/etc/shadow" | |
| if echo "$PLATFORM" | grep -q "LEMUR"; then | |
| USER="admin" | |
| ACCESS_FILE="/opt/etc/.htpasswd" | |
| elif echo "$PLATFORM" | grep -q "PINN"; then | |
| USER="root" | |
| ACCESS_FILE="/etc/shadow" | |
| else | |
| echo "Unsupported platform: $PLATFORM" >> "$DEBUG_LOG" | |
| echo '{"state":"failed", "message":"Unsupported platform"}' | |
| exit 1 |
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logs the full shadow/.htpasswd entry, which exposes password hashes in plaintext logs. Even if debugging is required, avoid logging USER_SHADOW_ENTRY (and generated hashes) to prevent offline cracking and accidental disclosure.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Salt parsing is not correct for all valid shadow hash formats. For example, "$6$rounds=...$salt$hash" will make field 3 be "rounds=..." rather than the actual salt, causing authentication to fail. Parse the hash components more robustly (handle optional rounds= and ensure a $-delimited format before extracting).
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
HASH_TYPE is derived from the stored hash and is spliced into the openssl command without validation. If HASH_TYPE is empty/unknown (locked accounts, non-$id$ hashes, or algorithms openssl passwd doesn't support), this will error or behave unexpectedly. Validate HASH_TYPE against an allowlist (e.g., 1/5/6/apr1) and return a clear authentication failure when unsupported.
Copilot
AI
Apr 6, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This uses echo with a printf-style format string ("%s\n"), so the log output will be incorrect (and may include a literal "\n"). If logging remains, use printf for formatted output.
| echo "Generated hash: %s\n" "$GENERATED_HASH" >> "$DEBUG_LOG" | |
| printf 'Generated hash: %s\n' "$GENERATED_HASH" >> "$DEBUG_LOG" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Writing debug output to a predictable path in /tmp is a security risk (symlink/hardlink attacks) and the log includes credential material (shadow/.htpasswd hashes and generated hashes). Please remove this logging or gate it behind an explicit debug flag, and if logs are truly needed write to a root-only location with restrictive perms (e.g., umask 077 / chmod 600) and avoid logging password hashes entirely.