build: switch_to.sh: use local wifi SSID/password as defaults when enabling wifi logging
What changed, and why it matters
This change updates a developer build script so that, when enabling Wi-Fi logging on a Blockstream Jade device, it tries to auto-fill the user's current Wi-Fi network name and password from their Linux computer. The credentials are shown on screen as defaults and written into the device's build configuration. This is a convenience feature, but it increases the chance that real Wi-Fi credentials are copied into a firmware build configuration file and displayed in the terminal.
Treat this as a low-risk developer-experience change rather than a vulnerability. If reviewing, confirm that the build config file containing the captured credentials is not committed to version control or included in release artifacts. Consider masking the password prompt and default value, and warn users that real credentials should not be used for production builds.
Security signals we found
Wi-Fi credentials extracted from host system and offered as defaults
Wi-Fi password displayed in terminal prompt brackets
Credentials written into build configuration file
Convenience feature increases credential exposure surface
Evidence from the diff
The commit modifies tools/switch_to.sh. When LOG=wifi is selected, the script now calls nmcli dev wifi show-password to extract the currently connected Wi-Fi SSID and password. These are offered as bracketed defaults in read prompts and, if the user presses Enter without typing anything, are written via set_config into CONFIG_WIFI_SSID and CONFIG_WIFI_PASSWORD. Previously the script required manual entry. The credentials are also echoed to the terminal inside the prompt brackets.
Changed components
tools/switch_to.shInspect captured patch +18 / −4
diff --git a/tools/switch_to.sh b/tools/switch_to.sh
index 1907b5e..35c4e7d 100755
--- a/tools/switch_to.sh
+++ b/tools/switch_to.sh
@@ -194,16 +194,30 @@ if [ "$LOG" = "cbor" ]; then
LOG="uart" # Enable UART logging below
elif [ "$LOG" = "wifi" ]; then
echo "updating config file for WIFI logging ..."
+ DEFAULT_SSID=""
+ DEFAULT_PASSWORD=""
+ SHOW_DEFAULT_SSID=""
+ SHOW_DEFAULT_PASSWORD=""
+ if have_cmd nmcli; then
+ WIFI_CONNECTED=$(nmcli -f type,state device status | awk '$1=="wifi" && $2=="connected"' || true)
+ if [ -n "$WIFI_CONNECTED" ]; then
+ WIFI_DETAILS=$(nmcli dev wifi show-password 2>/dev/null || true)
+ DEFAULT_SSID=$(echo "$WIFI_DETAILS" | grep "SSID:" | awk -F'SSID: ' '{print $2}')
+ SHOW_DEFAULT_SSID=" [${DEFAULT_SSID}]"
+ DEFAULT_PASSWORD=$(echo "$WIFI_DETAILS" | grep "Password:" | awk -F'Password: ' '{print $2}')
+ SHOW_DEFAULT_PASSWORD=" [${DEFAULT_PASSWORD}]"
+ fi
+ fi
DEFAULT_IP="192.168.1.100"
if have_cmd ip; then
DEFAULT_IP=$(ip addr show $(ip route | awk '/default/ { print $5 }') | grep "inet" | head -n 1 | awk '/inet/ {print $2}' | cut -d'/' -f1 | cut -d'.' -f1,2,3)
DEFAULT_IP="${DEFAULT_IP}.100"
fi
set_config CONFIG_LOG_WIFI y
- read -r -p "Enter WIFI SSID: " SSID
- set_config CONFIG_WIFI_SSID "\"$SSID\""
- read -r -p "Enter WIFI Password: " PASSWORD
- set_config CONFIG_WIFI_PASSWORD "\"$PASSWORD\""
+ read -r -p "Enter WIFI SSID${SHOW_DEFAULT_SSID}: " SSID
+ set_config CONFIG_WIFI_SSID "\"${SSID:-${DEFAULT_SSID}}\""
+ read -r -p "Enter WIFI Password${SHOW_DEFAULT_PASSWORD}: " PASSWORD
+ set_config CONFIG_WIFI_PASSWORD "\"${PASSWORD:-${DEFAULT_PASSWORD}}\""
read -r -p "Enter socket server IP [${DEFAULT_IP}]: " IP
set_config CONFIG_WIFI_LOGGER_IP "\"${IP:-${DEFAULT_IP}}\""
read -r -p "Enter socket server PORT [8888]: " PORT
Why this scored 37/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.