Skip to content

Commit b712912

Browse files
committed
security: remove sensitive data from logs and escape HTML in tx details
Remove console.log statements that printed transaction IDs, wallet addresses, payment IDs and payment-proof signatures to the debug log. Escape all user/chain-supplied fields in buildTxDetailsString before inserting them into the rich-text table shown in the transaction details dialog, preserving the intentional <br> line separators in the destinations field.
1 parent 3a1462e commit b712912

4 files changed

Lines changed: 12 additions & 13 deletions

File tree

main.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,6 @@ ApplicationWindow {
539539
// opening with password but password doesn't match
540540
console.error("Error opening wallet with password: ", wallet.errorString);
541541
passwordDialog.showError(qsTr("Couldn't open wallet: ") + wallet.errorString);
542-
console.log("closing wallet async : " + wallet.address)
543542
closeWallet();
544543
return;
545544
}

pages/AddressBook.qml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,6 @@ Rectangle {
151151
color: itemMouseArea.containsMouse ? MoneroComponents.Style.titleBarButtonHoverColor : "transparent"
152152

153153
function doSend() {
154-
console.log("Sending to: ", address +" "+ paymentId);
155154
middlePanel.sendTo(address, paymentId);
156155
leftPanel.selectItem(middlePanel.state)
157156
}

pages/History.qml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1719,7 +1719,6 @@ Rectangle {
17191719
console.log('getProof: Error checking TxId and/or address');
17201720
}
17211721

1722-
console.log("getProof: Generate clicked: txid " + hash + ", address " + address);
17231722
middlePanel.getProofClicked(hash, address, '', null);
17241723
informationPopup.title = qsTr("Payment proof") + translationManager.emptyString;
17251724
informationPopup.text = qsTr("Generating payment proof") + "..." + translationManager.emptyString;
@@ -1738,17 +1737,21 @@ Rectangle {
17381737
trMiddle = '</b></td><td style="padding-left:10px;padding-top:5px;">',
17391738
trEnd = "</td></tr>";
17401739

1740+
// destinations may intentionally contain "<br>" separators inserted by the wallet backend;
1741+
// escape everything first, then restore the literal "<br>" so line breaks are preserved.
1742+
destinations = Utils.htmlEscape(destinations).replace(/&lt;br&gt;/g, '<br>');
1743+
17411744
return '<table border="0">'
1742-
+ (tx_id ? trStart + qsTr("Tx ID:") + trMiddle + tx_id + trEnd : "")
1743-
+ (dateTime ? trStart + qsTr("Date") + ":" + trMiddle + dateTime + trEnd : "")
1744-
+ (amount ? trStart + qsTr("Amount") + ":" + trMiddle + amount + trEnd : "")
1745-
+ (address ? trStart + qsTr("Address:") + trMiddle + address + trEnd : "")
1746-
+ (paymentId ? trStart + qsTr("Payment ID:") + trMiddle + paymentId + trEnd : "")
1747-
+ (integratedAddress ? trStart + qsTr("Integrated address") + ":" + trMiddle + integratedAddress + trEnd : "")
1748-
+ (tx_key ? trStart + qsTr("Tx key:") + trMiddle + tx_key + trEnd : "")
1745+
+ (tx_id ? trStart + qsTr("Tx ID:") + trMiddle + Utils.htmlEscape(tx_id) + trEnd : "")
1746+
+ (dateTime ? trStart + qsTr("Date") + ":" + trMiddle + Utils.htmlEscape(dateTime) + trEnd : "")
1747+
+ (amount ? trStart + qsTr("Amount") + ":" + trMiddle + Utils.htmlEscape(amount) + trEnd : "")
1748+
+ (address ? trStart + qsTr("Address:") + trMiddle + Utils.htmlEscape(address) + trEnd : "")
1749+
+ (paymentId ? trStart + qsTr("Payment ID:") + trMiddle + Utils.htmlEscape(paymentId) + trEnd : "")
1750+
+ (integratedAddress ? trStart + qsTr("Integrated address") + ":" + trMiddle + Utils.htmlEscape(integratedAddress) + trEnd : "")
1751+
+ (tx_key ? trStart + qsTr("Tx key:") + trMiddle + Utils.htmlEscape(tx_key) + trEnd : "")
17491752
+ (tx_note ? trStart + qsTr("Tx note:") + trMiddle + Utils.htmlEscape(tx_note) + trEnd : "")
17501753
+ (destinations ? trStart + qsTr("Destinations:") + trMiddle + destinations + trEnd : "")
1751-
+ (rings ? trStart + qsTr("Rings:") + trMiddle + rings + trEnd : "")
1754+
+ (rings ? trStart + qsTr("Rings:") + trMiddle + Utils.htmlEscape(rings) + trEnd : "")
17521755
+ "</table>"
17531756
+ translationManager.emptyString;
17541757
}

pages/TxKey.qml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ Rectangle {
148148
text: qsTr("Generate") + translationManager.emptyString
149149
enabled: TxUtils.checkTxID(getProofTxIdLine.text) && (getProofAddressLine.text.length == 0 || TxUtils.checkAddress(getProofAddressLine.text, appWindow.persistentSettings.nettype)) || getReserveProofAmtLine.text.length != 0 && walletManager.amountFromString(getReserveProofAmtLine.text) < appWindow.getUnlockedBalance() && walletManager.amountFromString(getReserveProofAmtLine.text) > 0
150150
onClicked: {
151-
console.log("getProof: Generate clicked: txid " + getProofTxIdLine.text + ", address " + getProofAddressLine.text + ", message: " + getProofMessageLine.text);
152151
middlePanel.getProofClicked(getProofTxIdLine.text, getProofAddressLine.text, getProofMessageLine.text, getReserveProofAmtLine.text)
153152
}
154153
}
@@ -233,7 +232,6 @@ Rectangle {
233232
text: qsTr("Check") + translationManager.emptyString
234233
enabled: (TxUtils.checkTxID(checkProofTxIdLine.text) && TxUtils.checkSignature(checkProofSignatureLine.text) && ((checkProofSignatureLine.text.indexOf("SpendProofV") === 0 && checkProofAddressLine.text.length == 0) || (checkProofSignatureLine.text.indexOf("SpendProofV") !== 0 && TxUtils.checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.nettype)))) || (TxUtils.checkSignature(checkProofSignatureLine.text) && checkProofSignatureLine.text.indexOf("ReserveProofV") === 0 && TxUtils.checkAddress(checkProofAddressLine.text, appWindow.persistentSettings.nettype))
235234
onClicked: {
236-
console.log("checkProof: Check clicked: txid " + checkProofTxIdLine.text + ", address " + checkProofAddressLine.text + ", message " + checkProofMessageLine.text + ", signature " + checkProofSignatureLine.text);
237235
middlePanel.checkProofClicked(checkProofTxIdLine.text, checkProofAddressLine.text, checkProofMessageLine.text, checkProofSignatureLine.text)
238236
}
239237
}

0 commit comments

Comments
 (0)