Skip to content

Conversation

@laanwj
Copy link
Member

@laanwj laanwj commented Mar 6, 2018

Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is
disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

So explicitly force the format as text.

Currently, error messages (such as InitError) are displayed as-is, which
means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line
though e.g. specifying a wallet name with HTML in it. This isn't
a direct security risk because fetching content from internet is
disabled (and as far as I know we never report strings received
from the network this way). However, it can be confusing.

So explicitly force the format as text.
Copy link
Contributor

@randolf randolf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a good practice none-the-less as a preventive measure just in case something were to change in a future Qt version with regard to how it detects and interprets HTML or some other not-yet-invented format.

Copy link
Contributor

@promag promag left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK.

buttons = QMessageBox::Ok;

showNormalIfMinimized();
QMessageBox mBox(static_cast<QMessageBox::Icon>(nMBoxIcon), strTitle, message, buttons, this);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit, since it's not possible to specify the format in the constructor, change everything to setters:

QMessageBox mBox(this);
mBox.setIcon(static_cast<QMessageBox::Icon>(nMBoxIcon));
mBox.setWindowTitle(strTitle);
mBox.setTextFormat(Qt::PlainText);
mBox.setText(message);
mBox.setStandardButtons(buttons);

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Meh... let's not add more work here than is necessary. It works so it's ok, imo.

@fanquake
Copy link
Member

fanquake commented Mar 6, 2018

tACK 6fbc098

No more cats:
cat

@sipa
Copy link
Member

sipa commented Mar 6, 2018

No more cats? What is this? Dogecoin?

fanquake pushed a commit to fanquake/bitcoin that referenced this pull request Mar 6, 2018
6fbc098 gui: Show messages as text not html (Wladimir J. van der Laan)

Pull request description:

  Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

  This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is
  disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

  So explicitly force the format as text.

Tree-SHA512: 96c9196f20552544b862071bca61817ef03653019cc3548023d435f3a9c48b6cd501fab3246783cb0be68c8c7bb1b865913d92070a7c4e84e82c6577709f0934
@laanwj laanwj merged commit 6fbc098 into bitcoin:master Mar 6, 2018
maflcko pushed a commit to maflcko/bitcoin-core that referenced this pull request Jul 13, 2018
Currently, error messages (such as InitError) are displayed as-is, which
means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line
though e.g. specifying a wallet name with HTML in it. This isn't
a direct security risk because fetching content from internet is
disabled (and as far as I know we never report strings received
from the network this way). However, it can be confusing.

So explicitly force the format as text.

Github-Pull: bitcoin#12617
Rebased-From: 6fbc098
HashUnlimited pushed a commit to chaincoin/chaincoin that referenced this pull request Jan 11, 2019
Currently, error messages (such as InitError) are displayed as-is, which
means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line
though e.g. specifying a wallet name with HTML in it. This isn't
a direct security risk because fetching content from internet is
disabled (and as far as I know we never report strings received
from the network this way). However, it can be confusing.

So explicitly force the format as text.

Github-Pull: bitcoin#12617
Rebased-From: 6fbc098
jasonbcox pushed a commit to Bitcoin-ABC/bitcoin-abc that referenced this pull request Dec 20, 2019
Summary:
6fbc098 gui: Show messages as text not html (Wladimir J. van der Laan)

---

Pull request description:

Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

So explicitly force the format as text.

---

This is a backport from Core PR12617 (bitcoin/bitcoin#12617)

Test Plan:
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4761
PastaPastaPasta pushed a commit to PastaPastaPasta/dash that referenced this pull request Apr 16, 2020
Currently, error messages (such as InitError) are displayed as-is, which
means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line
though e.g. specifying a wallet name with HTML in it. This isn't
a direct security risk because fetching content from internet is
disabled (and as far as I know we never report strings received
from the network this way). However, it can be confusing.

So explicitly force the format as text.
jonspock pushed a commit to jonspock/devault that referenced this pull request Oct 2, 2020
Summary:
6fbc0986f gui: Show messages as text not html (Wladimir J. van der Laan)

---

Pull request description:

Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

So explicitly force the format as text.

---

This is a backport from Core PR12617 (bitcoin/bitcoin#12617)

Test Plan:
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4761
jonspock pushed a commit to jonspock/devault that referenced this pull request Oct 5, 2020
Summary:
6fbc0986f gui: Show messages as text not html (Wladimir J. van der Laan)

---

Pull request description:

Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

So explicitly force the format as text.

---

This is a backport from Core PR12617 (bitcoin/bitcoin#12617)

Test Plan:
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4761
jonspock pushed a commit to devaultcrypto/devault that referenced this pull request Oct 10, 2020
Summary:
6fbc0986f gui: Show messages as text not html (Wladimir J. van der Laan)

---

Pull request description:

Currently, error messages (such as InitError) are displayed as-is, which means Qt does auto detection on the format.

This means that it's possible to inject HTML from the command line though e.g. specifying a wallet name with HTML in it. This isn't a direct security risk because fetching content from internet is disabled (and as far as I know we never report strings received from the network this way). However, it can be confusing.

So explicitly force the format as text.

---

This is a backport from Core PR12617 (bitcoin/bitcoin#12617)

Test Plan:
  ninja check

Reviewers: O1 Bitcoin ABC, #bitcoin_abc, deadalnix, Fabien

Reviewed By: O1 Bitcoin ABC, #bitcoin_abc, Fabien

Differential Revision: https://reviews.bitcoinabc.org/D4761
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants