qml: add FeePicker manual fee/feerate input validators
What changed, and why it matters
This commit adds input validators to two manual fee input fields in Electrum's QML (mobile-style) user interface. One field now only accepts whole numbers, and the other only accepts numbers with at most one decimal place. This is a defensive hardening change that reduces the chance a user can type malformed or unexpected values into fee fields, which could previously lead to confusing errors or invalid transactions.
Treat as minor UI hardening. No urgent action required, but verify the regexes match the backend's expected formats and that localized decimal separators or copy-paste edge cases are handled gracefully.
Security signals we found
Input validation added to user-controlled numeric fields
Prevents malformed fee/feerate strings from propagating to transaction finalizer
UI-only change; no backend logic modified
Evidence from the diff
The patch adds QML RegularExpressionValidator rules to the userFeerate and userFee TextInput fields in FeePicker.qml. userFeerate is restricted to /^[0-9].[0-9]?$/ (digits, a single dot, and at most one fractional digit), and userFee is restricted to /^[0-9]$/ (digits only). This prevents arbitrary text, multiple decimals, negative signs, or other non-numeric characters from reaching the underlying finalizer logic when a user manually edits fees.
Changed components
electrum/gui/qml/components/controls/FeePicker.qmlManual fee rate input fieldManual absolute fee input fieldInspect captured patch +6 / −0
diff --git a/electrum/gui/qml/components/controls/FeePicker.qml b/electrum/gui/qml/components/controls/FeePicker.qml
index dedb03c..932e9af 100644
--- a/electrum/gui/qml/components/controls/FeePicker.qml
+++ b/electrum/gui/qml/components/controls/FeePicker.qml
@@ -140,6 +140,9 @@ Item {
Layout.fillWidth: true
text: finalizer.userFeerate
inputMethodHints: Qt.ImhDigitsOnly
+ validator: RegularExpressionValidator {
+ regularExpression: /^[0-9]*\.[0-9]?$/
+ }
onTextEdited: {
finalizer.userFeerate = text
}
@@ -156,6 +159,9 @@ Item {
Layout.fillWidth: true
text: finalizer.userFee
inputMethodHints: Qt.ImhDigitsOnly
+ validator: RegularExpressionValidator {
+ regularExpression: /^[0-9]*$/
+ }
onTextEdited: {
finalizer.userFee = text
}
Why this scored 23/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.