Skip to content

qt: PSBT dialog Save leaves Sign and Close reachable during its file dialog #364

Open

Description

@kiwidream

PSBTOperationsDialog::saveTransaction opens a file dialog, which runs a nested event loop, and blocks nothing in the PSBT dialog behind it. Mouse and keyboard input cannot reach that dialog while the file dialog is open, but an accessibility client (VoiceOver, UI automation) still can. This is the same bypass as the send-confirmation abort fixed by #348 and the PSBT Sign re-entry in #350. Line numbers are at 1.x.x 993ab7531f.

What happens

saveTransaction (src/qt/psbtoperationsdialog.cpp:570) serializes m_transaction_data (:572) before calling GUIUtil::getSaveFileName(this, …) (:589, which calls QFileDialog::getSaveFileName at src/qt/guiutil.cpp:340). While the file dialog is open:

  1. Sign can run a whole signing attempt.
    • Save then writes the PSBT it serialized before signing (:596-597), without the new signatures, although those signatures have already consumed PQC counter capacity.
    • "PSBT saved to disk." (:604) replaces the signing status and its PQC usage report.
    • The dialog then renders the signed m_transaction_data (:608-609), so the dialog and the saved file disagree.
  2. Close deletes the dialog. The PSBT dialog is WA_DeleteOnClose (src/qt/guiutil.cpp:1011). Pressing Close deletes it, and the file dialog it parents, inside the nested loop. saveTransaction then goes on using the freed dialog.

Evidence

Found by reading the code during the #350 fix. It has not been reproduced in a running app.

Expected

  • Sign, Close and the other actions are disabled while Save's file dialog is open, the same way Sign is guarded while signing.
  • saveTransaction checks the dialog still exists (for example with a QPointer) before using it after the file dialog returns.
  • What it writes matches the PSBT the dialog shows. For example, it could serialize after the file dialog returns.

Related: #349 (quitting during nested event loops), #350 (Sign re-entry).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions