[Qt] ensure BIP70 certificate problems are shown to user #3684

pull Diapolo wants to merge 1 commits into bitcoin:master from Diapolo:paymentrequest_checkcert changing 3 files +18 −11
  1. Diapolo commented at 6:36 PM on February 16, 2014: none
    • fixes #3628 by showing certificate error(s) to user
    • prevents accepting payment requests when certificate error(s) occur
    • insecure payment requests are still possible with this, if they correctly set paymentRequest.pki_type() == "none"

    Don't merge, NEEDS TO BE REWORKED!

  2. Diapolo commented at 9:40 PM on February 16, 2014: none

    Can please somone update @BitcoinPullTester to use current libs?

    <pre> paymentrequestplus.cpp: In member function ‘bool PaymentRequestPlus::getMerchant(X509_STORE*, QString&, QString&) const’: paymentrequestplus.cpp:105: error: ‘class QSslCertificate’ has no member named ‘toText’ </pre>

    Will rework to be compatible with Qt 4...

  3. cozz commented at 10:05 PM on February 16, 2014: contributor

    So we do not allow Insecure payment requests in general anymore? recipient.authenticatedMerchant is empty in this case, we show a yellow instead of green background there. Maybe handling this like the webbrowsers do?: Show a big fat warning (just a yellow background is too nice for an invalid certificate), but you can still send the transaction if you want to. But strongly recommended to not continue. A button to look at the certificate would be nice IMO.

  4. Diapolo commented at 10:26 PM on February 16, 2014: none

    My fault, I didn't want to block insecure payment requests... I was aiming for a quick fix for 0.9, as @laanwj sais, GUI can be improved in a later pull ;).

  5. cozz commented at 10:40 PM on February 16, 2014: contributor

    Yes, I was wondering about issue #3628 too. But as far as I have tested this, there is no bug. The return value of getMerchant() is ignored, this is confusing, but QString& merchant is passed by reference, so recipient.authenticatedMerchant. This string is empty or not whether the certificate is valid or not. So thats our "bool" return value. So if the string is empty we show a yellow background. If not empty green. The only bug here is the yellow background misses a big fat warning.

  6. Diapolo commented at 7:14 AM on February 17, 2014: none

    @cozz Can you take another look, now insecure payment requests are possible, but errors are shown to user (not final but just to see I'm on track).

  7. cozz commented at 7:46 AM on February 17, 2014: contributor

    Yes, I would say on track :) So pki == "none" ends up with the yellow background now.

    To be honest I am not sure by myself what the expected behavior should be for an invalid certificate. There could be a temporary issue with the certificate. To not drive a store out of business in this case, maybe give the user an option to make an insecure payment request instead. But I can not judge, if this is a good idea or not.

  8. laanwj commented at 8:00 AM on February 17, 2014: member

    @cozz I think invalid certificates should be treated like missing certificates but there should be a warning that the certificate is invalid (to aid people building sites that issue them). (as it just as easy for an attacker to strip the signature than corrupt it, it makes no sense to distinguish them in 'severenes' - IMO)

  9. ryanxcharles commented at 5:37 PM on February 17, 2014: contributor

    I get this error trying to build this pull request:

    Undefined symbols for architecture x86_64: "PaymentRequestPlus::getMerchant(x509_store_st*, QString&, QString&) const", referenced from: PaymentServerTests::paymentServerTests() in test_bitcoin_qt-paymentservertests.o ld: symbol(s) not found for architecture x86_64

  10. luke-jr commented at 3:24 AM on February 21, 2014: member

    @Diapolo Please stop trying to force dependency upgrades without discussion. We should remain compatible with the versions packaged by major stable distros. That currently means Qt 4.6.2 (limited by RedHat). I'm pretty sure PullTester's is not older than that...

  11. Diapolo commented at 8:09 AM on February 21, 2014: none

    To quote myself: Will rework to be compatible with Qt 4...

  12. laanwj commented at 8:46 AM on February 21, 2014: member

    In a way it's good that pulltester tests with old libraries. My gut feeling is that none of the devs builds regularly against Qt4 (certainly not pre-4.8) anymore.

  13. mikehearn commented at 11:48 AM on February 27, 2014: contributor

    Sorry to weigh in late but I was away and am still catching up.

    Please don't expose validation errors to users. Just silently fall back to treating them as if they were unsigned (and print errors to the logs). That way we can extend with new features later and even if they aren't fully backwards compatible, the worst that happens is some users see unverified requests instead of errors they almost certainly won't understand.

  14. laanwj added this to the milestone 0.9.2 on Apr 19, 2014
  15. laanwj removed this from the milestone 0.9.2 on May 13, 2014
  16. laanwj commented at 8:38 AM on July 1, 2014: member

    OK, won't show it to users. But better logging to the debug log is welcome.

    Btw, we should change the Qt logging around a bit. Currently all log messages from the GUI are ignored unless -debug=qt is provided. IMO this should only apply to QtDebugMsg. QtWarningMsg/QtCriticalMsg/QtFatalMsg/QtSystemMsg should always be LogPrintf'ed.

    Problems with Payment requests should at least have level QtWarningMsg.

  17. Diapolo commented at 8:44 AM on July 1, 2014: none

    Agreed on the logging change for Qt, even if this not the scope of this request. We still have the serious problem that we don't check request.getMerchant() for success, which means current implementation of PRs is potential "unsafe". Will update this pull so that we log errors and don't allow request.getMerchant() to fail, but don't show the actual errors to users.

  18. Diapolo commented at 9:03 AM on July 1, 2014: none

    Damn, there is a problem with my assumption! Look at request.getMerchant(PaymentServer::certStore, recipient.authenticatedMerchant for insecure payment requests this call is allowed to fail, but for secure payment requests this should not be allowed to fail. An insecure PR has pki_type == none. @mikehearn Can you shed some light on this?

  19. [Qt] ensure BIP70 certificate problems are shown to user
    - fixes #3628 by showing certificate error(s) to user
    - prevents accepting payment requests when certificate error(s) occur
    - insecure payment requests are still possible with this, if they
      correctly set paymentRequest.pki_type() == "none"
    114c38c09a
  20. BitcoinPullTester commented at 9:32 AM on July 1, 2014: none

    Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/p3684_114c38c09a913749c4bdf9d125a944c5024fad58/ for binaries and test log. This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/ Contact BlueMatt on freenode if something looks broken.

  21. Diapolo commented at 9:42 AM on July 1, 2014: none

    What about making getMerchant() return true if (pki_type == none) and reworking the comment on what getMerchant() returns true for insecure payment requests (that set pki_type = none) and true for secure payment requests only if no cert errors occur?

  22. laanwj commented at 1:32 PM on July 1, 2014: member

    @diapolo Re: logging see #4448

    As for 'secure' and 'insecure' payment requests, getMerchant must return false when no authenticated merchant could be extracted from the request. This can be either due to an error or due to the request not being signed at all. These cases don't need to be distinguished.

    Also, the output argument QString merchant must be empty after the call unless there is a successfully authenticated merchant.

  23. laanwj commented at 2:55 PM on July 9, 2014: member

    Closing this pull, as we don't want to show these problems to the user, but just want to log them (which already happens). If you want you can move the unrelated message change in src/qt/transactiondesc.cpp to a new pull.

  24. laanwj closed this on Jul 9, 2014

  25. Diapolo deleted the branch on Dec 10, 2014
  26. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-20 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me