From e1ff698d11629868d0690694c86f9be337fb15c3 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Sat, 22 Aug 2026 22:08:36 +0100 Subject: [PATCH 1/5] Add Wi-Fi password visibility toggle --- shell/plugins/panels/network/Panel.qml | 22 +++++++++++++++++++++- test/shell.d/network-test.sh | 15 +++++++++++++++ 2 files changed, 36 insertions(+), 1 deletion(-) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index dea1d280a66c..195431a50d22 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -26,6 +26,7 @@ Panel { passwordSsid = "" passwordText = "" identityText = "" + passwordVisible = false } // Live connection details from `ip` / /sys / iw. @@ -97,6 +98,7 @@ Panel { property string passwordSsid: "" property string passwordText: "" property string identityText: "" + property bool passwordVisible: false // ConnectionFailReason values as a plain object, so Model.js helpers stay // pure JS and Node-testable. @@ -688,6 +690,7 @@ Panel { if (passwordSsid !== ssid) { passwordText = "" identityText = "" + passwordVisible = false } passwordSsid = ssid } @@ -1863,7 +1866,7 @@ Panel { anchors.bottom: parent.bottom anchors.bottomMargin: Style.spacing.rowGap / 2 anchors.rightMargin: Style.space(6) - password: true + password: !root.passwordVisible placeholderText: "Passphrase" font.family: Style.font.family font.pixelSize: Style.font.body @@ -1879,6 +1882,23 @@ Panel { onVisibleChanged: if (visible && !row.isEnterprise) Qt.callLater(forceActiveFocus) Component.onCompleted: if (visible && !row.isEnterprise) Qt.callLater(forceActiveFocus) + + rightPadding: passwordVisibilityBtn.width + Style.spacing.controlGap + + PanelActionButton { + id: passwordVisibilityBtn + anchors.right: parent.right + anchors.rightMargin: Style.space(2) + anchors.verticalCenter: parent.verticalCenter + iconText: root.passwordVisible ? "\uf070" : "\uf06e" + tooltipText: root.passwordVisible ? "Hide password" : "Show password" + foreground: root.bar.foreground + fontFamily: root.bar.fontFamily + onClicked: { + root.passwordVisible = !root.passwordVisible + pwField.forceActiveFocus() + } + } } BorderSurface { diff --git a/test/shell.d/network-test.sh b/test/shell.d/network-test.sh index 11fdf9dda71e..542d95ad485f 100644 --- a/test/shell.d/network-test.sh +++ b/test/shell.d/network-test.sh @@ -12,6 +12,21 @@ const panelSource = fs.readFileSync(root + '/shell/plugins/panels/network/Panel. assert(/IpcHandler[\s\S]*?function toggleNetwork\(\) \{ root\.toggleNetwork\(\) \}/.test(panelSource), 'network exposes the Wi-Fi radio toggle over IPC') assert(/manageIpc: false/.test(panelSource), 'network owns its IPC handler so it can extend the target methods') +const passwordField = panelSource.match(/TextField \{\s*id: pwField\b[\s\S]*?\n {6}\}/) +assert(passwordField, 'network has a Wi-Fi passphrase field') +assert(/password: !root\.passwordVisible/.test(passwordField[0]), 'network can reveal the Wi-Fi passphrase') +assert(/id: passwordVisibilityBtn/.test(passwordField[0]), 'network puts a password visibility control inside the passphrase field') +assert(/root\.passwordVisible \? "Hide password" : "Show password"/.test(passwordField[0]), 'network labels both password visibility states') +assert(/root\.passwordVisible = !root\.passwordVisible/.test(passwordField[0]), 'network password visibility control toggles the masked state') + +const cancelPasswordPrompt = panelSource.match(/function cancelPasswordPrompt\(\) \{[\s\S]*?\n {2}\}/) +assert(cancelPasswordPrompt, 'network has a passphrase prompt cleanup helper') +assert(/passwordVisible = false/.test(cancelPasswordPrompt[0]), 'network masks the passphrase again when its prompt closes') + +const openPasswordPrompt = panelSource.match(/function openPasswordPrompt\(ssid\) \{[\s\S]*?\n {2}\}/) +assert(openPasswordPrompt, 'network has a passphrase prompt opener') +assert(/if \(passwordSsid !== ssid\)[\s\S]*passwordVisible = false/.test(openPasswordPrompt[0]), 'network starts each network passphrase prompt masked') + // Opening from the bar must call open() and nothing else. open() runs // refresh(true), which defers the PHY scan; a second bare refresh() defaults // scanWifi to false, sets scannerEnabled synchronously, and stalls the open on From 299e62f7f91e582bcd3d2b9e5eeadb241e14e992 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Sat, 5 Sep 2026 16:09:48 +0100 Subject: [PATCH 2/5] Clear revealed Wi-Fi passwords after use --- shell/plugins/panels/network/Panel.qml | 5 ++++- test/shell.d/network-test.sh | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 195431a50d22..526e6855da23 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -726,7 +726,10 @@ Panel { function clearNetworkAction() { actionTimeout.stop() - if (actionKind === "connect") passwordSsid = "" + // A successful connection no longer needs the submitted secret. Clear the + // backing QML strings as well as hiding the row so a revealed passphrase + // does not remain resident until the panel is closed or another SSID opens. + if (actionKind === "connect") cancelPasswordPrompt() failureSsid = "" failureReason = "" actionSsid = "" diff --git a/test/shell.d/network-test.sh b/test/shell.d/network-test.sh index 542d95ad485f..56b926e7f867 100644 --- a/test/shell.d/network-test.sh +++ b/test/shell.d/network-test.sh @@ -27,6 +27,10 @@ const openPasswordPrompt = panelSource.match(/function openPasswordPrompt\(ssid\ assert(openPasswordPrompt, 'network has a passphrase prompt opener') assert(/if \(passwordSsid !== ssid\)[\s\S]*passwordVisible = false/.test(openPasswordPrompt[0]), 'network starts each network passphrase prompt masked') +const clearNetworkAction = panelSource.match(/function clearNetworkAction\(\) \{[\s\S]*?\n {2}\}/) +assert(clearNetworkAction, 'network has an action-success cleanup helper') +assert(/if \(actionKind === "connect"\) cancelPasswordPrompt\(\)/.test(clearNetworkAction[0]), 'network clears the submitted passphrase and reveal state after connecting') + // Opening from the bar must call open() and nothing else. open() runs // refresh(true), which defers the PHY scan; a second bare refresh() defaults // scanWifi to false, sets scannerEnabled synchronously, and stalls the open on From c6439ff4ec26161b70fc53547fdef2c8f376a6b1 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Sat, 5 Sep 2026 16:20:07 +0100 Subject: [PATCH 3/5] Contain revealed Wi-Fi credentials across retries --- shell/plugins/panels/network/Panel.qml | 26 ++++++++++++++++++++++++++ test/shell.d/network-test.sh | 22 ++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 526e6855da23..28080d4e129b 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -354,6 +354,7 @@ Panel { // The KeyboardPanel's focusTarget covers initial popup-open; this handles // the inline-editor case where focus was handed off to a child. onPasswordSsidChanged: { + if (passwordSsid === "") credentialAbsenceTimer.stop() if (passwordSsid === "" && opened) { passwordText = "" Qt.callLater(function() { if (keyCatcher) keyCatcher.forceActiveFocus() }) @@ -371,8 +372,15 @@ Panel { } else if (passwordSsid !== "") { var passwordIndex = wifiIndexForSsid(passwordSsid) if (passwordIndex >= 0) { + credentialAbsenceTimer.stop() selectedIndex = passwordIndex focusSection = "wifi" + } else { + // A scan can transiently remove a row. Never leave its secret + // revealed while the editor is unmounted, and expire the retained + // correction text if the network does not return promptly. + passwordVisible = false + credentialAbsenceTimer.restart() } } else if (selectedIndex >= wifiNetworks.length) { selectedIndex = wifiNetworks.length - 1 @@ -959,6 +967,16 @@ Panel { } } + Timer { + id: credentialAbsenceTimer + interval: 5000 + repeat: false + onTriggered: { + if (root.passwordSsid !== "" && root.wifiIndexForSsid(root.passwordSsid) < 0) + root.cancelPasswordPrompt() + } + } + BarIconButton { id: button anchors.fill: parent @@ -1625,6 +1643,10 @@ Panel { function submitCredentials() { if (!net || root.busy || root.passwordText.length === 0) return + // Submission may hide this editor for the whole connection attempt. + // Re-mask immediately so failure, timeout, or row remount cannot reveal + // a value the user had chosen to show before pressing Connect. + root.passwordVisible = false if (!isEnterprise) return root.connectWithPassphrase(net.ssid, root.passwordText) if (root.identityText.length > 0) root.connectEnterprise(net.ssid, root.identityText, root.passwordText) } @@ -1895,6 +1917,10 @@ Panel { anchors.verticalCenter: parent.verticalCenter iconText: root.passwordVisible ? "\uf070" : "\uf06e" tooltipText: root.passwordVisible ? "Hide password" : "Show password" + focusable: true + Accessible.role: Accessible.Button + Accessible.name: tooltipText + Accessible.description: root.passwordVisible ? "Password is visible" : "Password is hidden" foreground: root.bar.foreground fontFamily: root.bar.fontFamily onClicked: { diff --git a/test/shell.d/network-test.sh b/test/shell.d/network-test.sh index 56b926e7f867..a8b63650207c 100644 --- a/test/shell.d/network-test.sh +++ b/test/shell.d/network-test.sh @@ -18,6 +18,15 @@ assert(/password: !root\.passwordVisible/.test(passwordField[0]), 'network can r assert(/id: passwordVisibilityBtn/.test(passwordField[0]), 'network puts a password visibility control inside the passphrase field') assert(/root\.passwordVisible \? "Hide password" : "Show password"/.test(passwordField[0]), 'network labels both password visibility states') assert(/root\.passwordVisible = !root\.passwordVisible/.test(passwordField[0]), 'network password visibility control toggles the masked state') +assert(/id: passwordVisibilityBtn[\s\S]*?focusable: true/.test(passwordField[0]), 'network password visibility control is reachable with Tab') +assert(/id: passwordVisibilityBtn[\s\S]*?Accessible\.role: Accessible\.Button/.test(passwordField[0]), 'network exposes the visibility control as an accessible button') +assert(/id: passwordVisibilityBtn[\s\S]*?Accessible\.name: tooltipText/.test(passwordField[0]), 'network exposes the visibility action name to assistive technology') +assert(/Accessible\.description: root\.passwordVisible \? "Password is visible" : "Password is hidden"/.test(passwordField[0]), 'network exposes whether the password is currently visible') + +const actionButtonSource = fs.readFileSync(root + '/shell/Ui/PanelActionButton.qml', 'utf8') +assert(/activeFocusOnTab: focusable/.test(actionButtonSource), 'focusable panel actions participate in Tab navigation') +assert(/Keys\.on(Return|Enter)Pressed: if \(focusable\) root\.clicked\(\)/.test(actionButtonSource), 'focusable panel actions activate with Enter') +assert(/Keys\.onSpacePressed: if \(focusable\) root\.clicked\(\)/.test(actionButtonSource), 'focusable panel actions activate with Space') const cancelPasswordPrompt = panelSource.match(/function cancelPasswordPrompt\(\) \{[\s\S]*?\n {2}\}/) assert(cancelPasswordPrompt, 'network has a passphrase prompt cleanup helper') @@ -31,6 +40,19 @@ const clearNetworkAction = panelSource.match(/function clearNetworkAction\(\) \{ assert(clearNetworkAction, 'network has an action-success cleanup helper') assert(/if \(actionKind === "connect"\) cancelPasswordPrompt\(\)/.test(clearNetworkAction[0]), 'network clears the submitted passphrase and reveal state after connecting') +const networkRowSource = panelSource.match(/component NetworkRow:[\s\S]*?\n component DetailValue:/) +assert(networkRowSource, 'network has a Wi-Fi row component') +const submitCredentials = networkRowSource[0].match(/function submitCredentials\(\) \{[\s\S]*?\n \}/) +assert(submitCredentials, 'network has a credential submission helper') +assert(/passwordVisible = false[\s\S]*connectWithPassphrase/.test(submitCredentials[0]), 'network masks a revealed password before a connection attempt can fail or time out') + +const wifiNetworksChanged = panelSource.match(/onWifiNetworksChanged: \{[\s\S]*?\n \}/) +assert(wifiNetworksChanged, 'network handles scan-driven row churn') +assert(/passwordIndex >= 0[\s\S]*credentialAbsenceTimer\.stop\(\)[\s\S]*else[\s\S]*passwordVisible = false[\s\S]*credentialAbsenceTimer\.restart\(\)/.test(wifiNetworksChanged[0]), 'network masks an unmounted prompt immediately and retains it only across bounded scan churn') +const credentialAbsenceTimer = panelSource.match(/id: credentialAbsenceTimer[\s\S]*?\n \}/) +assert(credentialAbsenceTimer, 'network expires credentials for a row that stays absent') +assert(/wifiIndexForSsid\(root\.passwordSsid\) < 0[\s\S]*cancelPasswordPrompt\(\)/.test(credentialAbsenceTimer[0]), 'network clears retained credentials only if the prompted row is still absent') + // Opening from the bar must call open() and nothing else. open() runs // refresh(true), which defers the PHY scan; a second bare refresh() defaults // scanWifi to false, sets scannerEnabled synchronously, and stalls the open on From 7d218bae1433a8b21801c4c2eb61f6a4d5d4acc9 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Sat, 5 Sep 2026 16:23:21 +0100 Subject: [PATCH 4/5] Bound retained Wi-Fi credential lifetime --- shell/plugins/panels/network/Panel.qml | 20 ++++++++++++-------- test/shell.d/network-test.sh | 6 +++++- 2 files changed, 17 insertions(+), 9 deletions(-) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 28080d4e129b..67016edba813 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -365,22 +365,25 @@ Panel { // If the list empties (station gone, e.g. wifi off), bounce the cursor // back to the DNS row so the panel doesn't end up with no cursor at all. onWifiNetworksChanged: { + var passwordIndex = passwordSsid !== "" ? wifiIndexForSsid(passwordSsid) : -1 + if (passwordSsid !== "" && passwordIndex < 0) { + // An empty result and repeated refreshes are both ordinary during a + // scan. Mask on the first disappearance and start one fixed expiry; + // later updates must not extend how long the secret remains resident. + passwordVisible = false + if (!credentialAbsenceTimer.running) credentialAbsenceTimer.start() + } else if (passwordIndex >= 0) { + credentialAbsenceTimer.stop() + } + if (wifiNetworks.length === 0) { selectedIndex = -1 wifiActionFocused = false if (focusSection === "wifi") focusSection = "dns" } else if (passwordSsid !== "") { - var passwordIndex = wifiIndexForSsid(passwordSsid) if (passwordIndex >= 0) { - credentialAbsenceTimer.stop() selectedIndex = passwordIndex focusSection = "wifi" - } else { - // A scan can transiently remove a row. Never leave its secret - // revealed while the editor is unmounted, and expire the retained - // correction text if the network does not return promptly. - passwordVisible = false - credentialAbsenceTimer.restart() } } else if (selectedIndex >= wifiNetworks.length) { selectedIndex = wifiNetworks.length - 1 @@ -1921,6 +1924,7 @@ Panel { Accessible.role: Accessible.Button Accessible.name: tooltipText Accessible.description: root.passwordVisible ? "Password is visible" : "Password is hidden" + Accessible.onPressAction: passwordVisibilityBtn.clicked() foreground: root.bar.foreground fontFamily: root.bar.fontFamily onClicked: { diff --git a/test/shell.d/network-test.sh b/test/shell.d/network-test.sh index a8b63650207c..04f8106c9321 100644 --- a/test/shell.d/network-test.sh +++ b/test/shell.d/network-test.sh @@ -22,6 +22,7 @@ assert(/id: passwordVisibilityBtn[\s\S]*?focusable: true/.test(passwordField[0]) assert(/id: passwordVisibilityBtn[\s\S]*?Accessible\.role: Accessible\.Button/.test(passwordField[0]), 'network exposes the visibility control as an accessible button') assert(/id: passwordVisibilityBtn[\s\S]*?Accessible\.name: tooltipText/.test(passwordField[0]), 'network exposes the visibility action name to assistive technology') assert(/Accessible\.description: root\.passwordVisible \? "Password is visible" : "Password is hidden"/.test(passwordField[0]), 'network exposes whether the password is currently visible') +assert(/Accessible\.onPressAction: passwordVisibilityBtn\.clicked\(\)/.test(passwordField[0]), 'assistive-technology activation invokes the visibility control') const actionButtonSource = fs.readFileSync(root + '/shell/Ui/PanelActionButton.qml', 'utf8') assert(/activeFocusOnTab: focusable/.test(actionButtonSource), 'focusable panel actions participate in Tab navigation') @@ -48,7 +49,10 @@ assert(/passwordVisible = false[\s\S]*connectWithPassphrase/.test(submitCredenti const wifiNetworksChanged = panelSource.match(/onWifiNetworksChanged: \{[\s\S]*?\n \}/) assert(wifiNetworksChanged, 'network handles scan-driven row churn') -assert(/passwordIndex >= 0[\s\S]*credentialAbsenceTimer\.stop\(\)[\s\S]*else[\s\S]*passwordVisible = false[\s\S]*credentialAbsenceTimer\.restart\(\)/.test(wifiNetworksChanged[0]), 'network masks an unmounted prompt immediately and retains it only across bounded scan churn') +assert(/passwordSsid !== "" && passwordIndex < 0[\s\S]*passwordVisible = false[\s\S]*!credentialAbsenceTimer\.running[\s\S]*credentialAbsenceTimer\.start\(\)/.test(wifiNetworksChanged[0]), 'network masks an absent prompt and starts one non-extendable expiry') +assert(wifiNetworksChanged[0].indexOf('passwordIndex < 0') < wifiNetworksChanged[0].indexOf('wifiNetworks.length === 0'), 'network starts credential expiry even when a scan returns an empty list') +assert(!/credentialAbsenceTimer\.restart\(\)/.test(wifiNetworksChanged[0]), 'repeated scan churn cannot postpone credential expiry') +assert(/else if \(passwordIndex >= 0\)[\s\S]*credentialAbsenceTimer\.stop\(\)/.test(wifiNetworksChanged[0]), 'network cancels expiry when the same row returns') const credentialAbsenceTimer = panelSource.match(/id: credentialAbsenceTimer[\s\S]*?\n \}/) assert(credentialAbsenceTimer, 'network expires credentials for a row that stays absent') assert(/wifiIndexForSsid\(root\.passwordSsid\) < 0[\s\S]*cancelPasswordPrompt\(\)/.test(credentialAbsenceTimer[0]), 'network clears retained credentials only if the prompted row is still absent') From 4c050e2e2c17b827a58d7abdc686a33c64416130 Mon Sep 17 00:00:00 2001 From: Afonso Oliveira Date: Sat, 5 Sep 2026 16:25:27 +0100 Subject: [PATCH 5/5] Scope credential expiry to the prompted network --- shell/plugins/panels/network/Panel.qml | 4 +++- test/shell.d/network-test.sh | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/shell/plugins/panels/network/Panel.qml b/shell/plugins/panels/network/Panel.qml index 67016edba813..9d7f0ab90127 100644 --- a/shell/plugins/panels/network/Panel.qml +++ b/shell/plugins/panels/network/Panel.qml @@ -354,7 +354,9 @@ Panel { // The KeyboardPanel's focusTarget covers initial popup-open; this handles // the inline-editor case where focus was handed off to a child. onPasswordSsidChanged: { - if (passwordSsid === "") credentialAbsenceTimer.stop() + // Expiry belongs to the exact prompted SSID. Switching from an absent + // network to another prompt must give the new secret its own full grace. + credentialAbsenceTimer.stop() if (passwordSsid === "" && opened) { passwordText = "" Qt.callLater(function() { if (keyCatcher) keyCatcher.forceActiveFocus() }) diff --git a/test/shell.d/network-test.sh b/test/shell.d/network-test.sh index 04f8106c9321..985884812702 100644 --- a/test/shell.d/network-test.sh +++ b/test/shell.d/network-test.sh @@ -36,6 +36,9 @@ assert(/passwordVisible = false/.test(cancelPasswordPrompt[0]), 'network masks t const openPasswordPrompt = panelSource.match(/function openPasswordPrompt\(ssid\) \{[\s\S]*?\n {2}\}/) assert(openPasswordPrompt, 'network has a passphrase prompt opener') assert(/if \(passwordSsid !== ssid\)[\s\S]*passwordVisible = false/.test(openPasswordPrompt[0]), 'network starts each network passphrase prompt masked') +const passwordSsidChanged = panelSource.match(/onPasswordSsidChanged: \{[\s\S]*?\n \}/) +assert(passwordSsidChanged, 'network handles prompted SSID changes') +assert(/credentialAbsenceTimer\.stop\(\)/.test(passwordSsidChanged[0]), 'switching from absent SSID A to SSID B cancels A expiry so B gets its own full grace') const clearNetworkAction = panelSource.match(/function clearNetworkAction\(\) \{[\s\S]*?\n {2}\}/) assert(clearNetworkAction, 'network has an action-success cleanup helper')