Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .jules/sentinel.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Sentinel's Journal

## 2025-02-12 - Shell Variable Expansion Risks
**Vulnerability:** Passwords containing spaces were being truncated in the entrypoint script due to unquoted variable expansion (`adduser $username $password`).
**Learning:** Shell scripts are prone to word splitting issues that can silently corrupt data like passwords.
**Prevention:** Always quote variables in shell scripts, especially when handling user input or secrets. Use strict linting (shellcheck) where possible.
4 changes: 2 additions & 2 deletions copyables/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -142,11 +142,11 @@ if [ ! -f $CONFIG ] || [ ! -s $CONFIG ]; then
for i in "${USER[@]}"; do
IFS=':' read username password <<<"$i"
# echo "Creating user: ${username}"
adduser $username $password
adduser "$username" "$password"
done
done <<<"$USERS"
else
adduser $USERNAME $PASSWORD
adduser "$USERNAME" "$PASSWORD"
fi

echo
Expand Down
19 changes: 19 additions & 0 deletions tests/verify_password_fix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash
# Mock adduser and verify arguments
adduser() {
if [[ "$2" == "secret pass" ]]; then
echo "SUCCESS: Password verified correctly: '$2'"
else
echo "FAILURE: Password mismatch: '$2'"
exit 1
fi
}

USERS="alice:secret pass"
# Extract the logic from entrypoint.sh (simplified)
while IFS=';' read -ra USER; do
for i in "${USER[@]}"; do
IFS=':' read username password <<<"$i"
adduser "$username" "$password"
done
done <<<"$USERS"