From 0c76e4b9c466f59c621c1d458cf75c1a780121e6 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 27 Feb 2024 10:08:38 +0100 Subject: [PATCH 01/19] Actions: python ver --- .github/workflows/windows-x64.yml | 2 +- .github/workflows/windows-x86.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/windows-x64.yml b/.github/workflows/windows-x64.yml index 3dd30846..8d0fee74 100644 --- a/.github/workflows/windows-x64.yml +++ b/.github/workflows/windows-x64.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 with: - python-version: '3.11.1' + python-version: '3.11.8' architecture: 'x64' - name: Install Qt diff --git a/.github/workflows/windows-x86.yml b/.github/workflows/windows-x86.yml index e769007d..9c30132d 100644 --- a/.github/workflows/windows-x86.yml +++ b/.github/workflows/windows-x86.yml @@ -15,7 +15,7 @@ jobs: - uses: actions/checkout@v1 - uses: actions/setup-python@v1 with: - python-version: '3.11.1' + python-version: '3.11.8' architecture: 'x86' - name: Install Qt From c91f6a9d59e28e65270c539bdc40e3f1dc5ff95d Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 27 Feb 2024 10:13:09 +0100 Subject: [PATCH 02/19] Actions: aqt fix --- .github/workflows/windows-x64.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/windows-x64.yml b/.github/workflows/windows-x64.yml index 8d0fee74..e6c22c59 100644 --- a/.github/workflows/windows-x64.yml +++ b/.github/workflows/windows-x64.yml @@ -19,13 +19,12 @@ jobs: architecture: 'x64' - name: Install Qt - uses: jurplel/install-qt-action@v2.10.0 + uses: jurplel/install-qt-action@v3 with: version: '5.14.1' host: 'windows' target: 'desktop' arch: 'win64_msvc2017_64' - aqtversion: '==0.9.7' - name: Download dependencies run: | From ae9460a8da08d6eb5f2f6dfd36710b70a8f804f7 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Wed, 28 Feb 2024 14:13:25 +0100 Subject: [PATCH 03/19] UI test --- ykman-gui/qml/Header.qml | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 96eec0c7..2150aefa 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -5,6 +5,9 @@ import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.2 ColumnLayout { + property bool pressed + + spacing: 0 width: app.width function activeKeyLbl() { @@ -34,14 +37,23 @@ ColumnLayout { color: yubicoBlue font.pixelSize: constants.h4 } - CustomButton { - flat: true - text: qsTr("Help") - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - iconSource: "../images/help.svg" - toolTipText: qsTr("Visit Yubico Support in your web browser") - onClicked: Qt.openUrlExternally("https://www.yubico.com/kb") - font.pixelSize: constants.h4 + ColumnLayout { + CustomButton { + flat: true + text: qsTr("Help") + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + iconSource: "../images/help.svg" + onClicked: pressed = true + font.pixelSize: constants.h4 + } + Label { + text: https://www.yubico.com/kb + Layout.fillWidth: false + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + color: yubicoBlue + font.pixelSize: constants.h4 + visible: pressed == true + } } CustomButton { flat: true From 7cde8e93c5104de0d4413cb321134a6a9f8f5374 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Thu, 29 Feb 2024 14:44:17 +0100 Subject: [PATCH 04/19] Link fixes --- ykman-gui/qml/ContentStack.qml | 14 +++- ykman-gui/qml/CopyableConfirmationPopup.qml | 37 +++++++++++ ykman-gui/qml/Header.qml | 74 ++++++++++++++------- ykman-gui/qml/OtpYubiOtpView.qml | 63 ++++++++++-------- 4 files changed, 138 insertions(+), 50 deletions(-) create mode 100644 ykman-gui/qml/CopyableConfirmationPopup.qml diff --git a/ykman-gui/qml/ContentStack.qml b/ykman-gui/qml/ContentStack.qml index 3806a2b1..eecc8887 100644 --- a/ykman-gui/qml/ContentStack.qml +++ b/ykman-gui/qml/ContentStack.qml @@ -168,6 +168,14 @@ StackView { callback) } + function otpUrl(url, callback) { + copyableConfirmationPopup.show( + qsTr("Upload?"), qsTr( + "Go to the following url in your browser to make sure your credential gets uploaded %1").arg( + url), + callback) + } + function otpWriteError() { snackbarError.show( qsTr("Failed to modify %1. Make sure the YubiKey does not have restricted access.").arg( @@ -337,6 +345,10 @@ StackView { id: confirmationPopup } + CopyableConfirmationPopup { + id: copyableConfirmationPopup + } + PivPinPopup { id: pivPinPopup } @@ -360,4 +372,4 @@ StackView { SnackBarError { id: snackbarError } -} +} \ No newline at end of file diff --git a/ykman-gui/qml/CopyableConfirmationPopup.qml b/ykman-gui/qml/CopyableConfirmationPopup.qml new file mode 100644 index 00000000..fe74cce8 --- /dev/null +++ b/ykman-gui/qml/CopyableConfirmationPopup.qml @@ -0,0 +1,37 @@ +import QtQuick 2.9 +import QtQuick.Controls 2.2 +import QtQuick.Layouts 1.2 + +InlinePopup { + + property var acceptCallback + standardButtons: Dialog.Ok + onAccepted: acceptCallback() + focus: true + + function show(heading, message, cb) { + confirmationHeading.text = heading + confirmationLbl.text = message + acceptCallback = cb + open() + } + + ColumnLayout { + width: parent.width + spacing: 20 + Heading2 { + id: confirmationHeading + width: parent.width + Layout.maximumWidth: parent.width + } + + TextInput { + id: confirmationLbl + wrapMode: Text.WordWrap + font.pixelSize: constants.h3 + color: yubicoBlue + selectByMouse: true + readOnly: true + } + } +} \ No newline at end of file diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 2150aefa..8e120384 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -7,7 +7,6 @@ import QtQuick.Controls.Material 2.2 ColumnLayout { property bool pressed - spacing: 0 width: app.width function activeKeyLbl() { @@ -22,6 +21,14 @@ ColumnLayout { } } + function press() { + if (pressed) { + pressed = false + } else { + pressed = true + } +} + RowLayout { Layout.fillWidth: true Layout.alignment: Qt.AlignRight @@ -30,12 +37,22 @@ ColumnLayout { RowLayout { Layout.alignment: Qt.AlignRight Layout.fillWidth: true - Label { - text: activeKeyLbl() - Layout.fillWidth: false - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - color: yubicoBlue - font.pixelSize: constants.h4 + ColumnLayout { + Label { + text: activeKeyLbl() + Layout.fillWidth: false + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + color: yubicoBlue + font.pixelSize: constants.h4 + } + TextInput { + selectByMouse: true + readOnly: true + text: qsTr("") + font.pixelSize: constants.h4 + visible: pressed + color: yubicoBlue + } } ColumnLayout { CustomButton { @@ -43,26 +60,37 @@ ColumnLayout { text: qsTr("Help") Layout.alignment: Qt.AlignRight | Qt.AlignVCenter iconSource: "../images/help.svg" - onClicked: pressed = true + toolTipText: qsTr("Visit Yubico Support in your web browser") + onClicked: press() font.pixelSize: constants.h4 } - Label { - text: https://www.yubico.com/kb - Layout.fillWidth: false - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - color: yubicoBlue + TextInput { + selectByMouse: true + readOnly: true + text: qsTr("https://www.yubico.com/kb") font.pixelSize: constants.h4 - visible: pressed == true + visible: pressed + color: yubicoBlue } } - CustomButton { - flat: true - text: qsTr("About") - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - iconSource: "../images/info.svg" - toolTipText: qsTr("About YubiKey Manager") - onClicked: aboutPage.open() - font.pixelSize: constants.h4 + ColumnLayout { + CustomButton { + flat: true + text: qsTr("About") + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + iconSource: "../images/info.svg" + toolTipText: qsTr("About YubiKey Manager") + onClicked: aboutPage.open() + font.pixelSize: constants.h4 + } + TextInput { + selectByMouse: true + readOnly: true + text: qsTr("") + font.pixelSize: constants.h4 + visible: pressed + color: yubicoBlue + } } } } @@ -146,4 +174,4 @@ ColumnLayout { Layout.fillHeight: true color: yubicoGreen } -} +} \ No newline at end of file diff --git a/ykman-gui/qml/OtpYubiOtpView.qml b/ykman-gui/qml/OtpYubiOtpView.qml index 6067d10e..1bf5da87 100644 --- a/ykman-gui/qml/OtpYubiOtpView.qml +++ b/ykman-gui/qml/OtpYubiOtpView.qml @@ -5,6 +5,8 @@ import "slotutils.js" as SlotUtils import QtQuick.Controls.Material 2.2 ColumnLayout { + property bool upload + property string url function useSerial() { if (useSerialCb.checked) { @@ -40,12 +42,12 @@ ColumnLayout { enableUpload.checked, function (resp) { if (resp.success) { if (resp.upload_url) { - if (Qt.openUrlExternally(resp.upload_url)) { - snackbarSuccess.show(qsTr("Configured Yubico OTP credential. Preparing upload in web browser.")) - views.otp() - } else { - snackbarError.show(qsTr("Configured Yubico OTP credential. Failed to open upload in web browser!")) - } + upload = true + url = resp.upload_url + otpUrl(url, views.otp()) + //snackbarSuccess.show(qsTr("Configured Yubico OTP credential. Preparing upload in web browser.")) + //views.otp() + } else { snackbarSuccess.show( qsTr("Configured Yubico OTP credential")) @@ -180,34 +182,43 @@ ColumnLayout { flat: true Layout.alignment: Qt.AlignLeft | Qt.AlignBottom } - Row { id: row spacing: 5 Layout.alignment: Qt.AlignRight | Qt.AlignBottom - CheckBox { - id: enableUpload - text: qsTr("Upload") - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - ToolTip.delay: 1000 - font.pixelSize: constants.h3 - ToolTip.visible: hovered - ToolTip.text: qsTr("Upload credential to YubiCloud (opens a web browser)") - Material.foreground: yubicoBlue - } + ColumnLayout { + CheckBox { + id: enableUpload + text: qsTr("Upload") + Layout.alignment: Qt.AlignRight | Qt.AlignBottom + ToolTip.delay: 1000 + font.pixelSize: constants.h3 + ToolTip.visible: hovered + ToolTip.text: qsTr("Upload credential to YubiCloud (opens a web browser)") + Material.foreground: yubicoBlue + } + TextInput { + selectByMouse: true + readOnly: true + text: url + font.pixelSize: constants.h4 + visible: upload + color: yubicoBlue + } + } - FinishButton { + FinishButton { - onClicked: finish() - enabled: publicIdInput.acceptableInput - && privateIdInput.acceptableInput - && secretKeyInput.acceptableInput - toolTipText: qsTr("Finish and write the configuration to the YubiKey") - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - } + onClicked: finish() + enabled: publicIdInput.acceptableInput + && privateIdInput.acceptableInput + && secretKeyInput.acceptableInput + toolTipText: qsTr("Finish and write the configuration to the YubiKey") + Layout.alignment: Qt.AlignRight | Qt.AlignBottom + } } } } -} +} \ No newline at end of file From bb4690d2c429b5dfa8c659fe4279533e6e4023f4 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 1 Mar 2024 08:44:14 +0100 Subject: [PATCH 05/19] UI fix --- ykman-gui/qml/ContentStack.qml | 4 +- ykman-gui/qml/Header.qml | 89 ++++++++++---------------------- ykman-gui/qml/OtpYubiOtpView.qml | 28 ++++------ ykman-gui/qml/main.qml | 4 ++ 4 files changed, 43 insertions(+), 82 deletions(-) diff --git a/ykman-gui/qml/ContentStack.qml b/ykman-gui/qml/ContentStack.qml index eecc8887..e71ad8c9 100644 --- a/ykman-gui/qml/ContentStack.qml +++ b/ykman-gui/qml/ContentStack.qml @@ -168,12 +168,12 @@ StackView { callback) } - function otpUrl(url, callback) { + function otpUrl(url) { copyableConfirmationPopup.show( qsTr("Upload?"), qsTr( "Go to the following url in your browser to make sure your credential gets uploaded %1").arg( url), - callback) + ) } function otpWriteError() { diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 8e120384..43b879d9 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -5,7 +5,6 @@ import QtQuick.Dialogs 1.2 import QtQuick.Controls.Material 2.2 ColumnLayout { - property bool pressed spacing: 0 width: app.width @@ -21,13 +20,6 @@ ColumnLayout { } } - function press() { - if (pressed) { - pressed = false - } else { - pressed = true - } -} RowLayout { Layout.fillWidth: true @@ -37,61 +29,36 @@ ColumnLayout { RowLayout { Layout.alignment: Qt.AlignRight Layout.fillWidth: true - ColumnLayout { - Label { - text: activeKeyLbl() - Layout.fillWidth: false - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - color: yubicoBlue - font.pixelSize: constants.h4 - } - TextInput { - selectByMouse: true - readOnly: true - text: qsTr("") - font.pixelSize: constants.h4 - visible: pressed - color: yubicoBlue - } - } - ColumnLayout { - CustomButton { - flat: true - text: qsTr("Help") - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - iconSource: "../images/help.svg" - toolTipText: qsTr("Visit Yubico Support in your web browser") - onClicked: press() - font.pixelSize: constants.h4 - } - TextInput { - selectByMouse: true - readOnly: true - text: qsTr("https://www.yubico.com/kb") - font.pixelSize: constants.h4 - visible: pressed - color: yubicoBlue - } + Label { + text: activeKeyLbl() + Layout.fillWidth: false + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + color: yubicoBlue + font.pixelSize: constants.h4 + } + CustomButton { + + flat: true + text: qsTr("Help") + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + iconSource: "../images/help.svg" + toolTipText: qsTr("Visit Yubico Support in your web browser") + onClicked: helpPopup.show( + qsTr("Help"), qsTr( + "Visit https://www.yubico.com/kb for support with YubiKey Manager")) + font.pixelSize: constants.h4 } - ColumnLayout { - CustomButton { - flat: true - text: qsTr("About") - Layout.alignment: Qt.AlignRight | Qt.AlignVCenter - iconSource: "../images/info.svg" - toolTipText: qsTr("About YubiKey Manager") - onClicked: aboutPage.open() - font.pixelSize: constants.h4 - } - TextInput { - selectByMouse: true - readOnly: true - text: qsTr("") - font.pixelSize: constants.h4 - visible: pressed - color: yubicoBlue - } + CustomButton { + flat: true + text: qsTr("About") + Layout.alignment: Qt.AlignRight | Qt.AlignVCenter + iconSource: "../images/info.svg" + toolTipText: qsTr("About YubiKey Manager") + onClicked: aboutPage.open() + font.pixelSize: constants.h4 } + + } } diff --git a/ykman-gui/qml/OtpYubiOtpView.qml b/ykman-gui/qml/OtpYubiOtpView.qml index 1bf5da87..96034504 100644 --- a/ykman-gui/qml/OtpYubiOtpView.qml +++ b/ykman-gui/qml/OtpYubiOtpView.qml @@ -186,25 +186,15 @@ ColumnLayout { id: row spacing: 5 Layout.alignment: Qt.AlignRight | Qt.AlignBottom - ColumnLayout { - CheckBox { - id: enableUpload - text: qsTr("Upload") - Layout.alignment: Qt.AlignRight | Qt.AlignBottom - ToolTip.delay: 1000 - font.pixelSize: constants.h3 - ToolTip.visible: hovered - ToolTip.text: qsTr("Upload credential to YubiCloud (opens a web browser)") - Material.foreground: yubicoBlue - } - TextInput { - selectByMouse: true - readOnly: true - text: url - font.pixelSize: constants.h4 - visible: upload - color: yubicoBlue - } + CheckBox { + id: enableUpload + text: qsTr("Upload") + Layout.alignment: Qt.AlignRight | Qt.AlignBottom + ToolTip.delay: 1000 + font.pixelSize: constants.h3 + ToolTip.visible: hovered + ToolTip.text: qsTr("Upload credential to YubiCloud (opens a web browser)") + Material.foreground: yubicoBlue } FinishButton { diff --git a/ykman-gui/qml/main.qml b/ykman-gui/qml/main.qml index 0db8cb14..9410f3ba 100644 --- a/ykman-gui/qml/main.qml +++ b/ykman-gui/qml/main.qml @@ -143,4 +143,8 @@ ApplicationWindow { AboutPagePopup { id: aboutPage } + + CopyableConfirmationPopup { + id: helpPopup + } } From c15255832cd4b757a2af304924ed30c9645733a2 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 1 Mar 2024 08:59:46 +0100 Subject: [PATCH 06/19] Wrap text --- ykman-gui/qml/CopyableConfirmationPopup.qml | 6 +++--- ykman-gui/qml/OtpYubiOtpView.qml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ykman-gui/qml/CopyableConfirmationPopup.qml b/ykman-gui/qml/CopyableConfirmationPopup.qml index fe74cce8..298cc6e3 100644 --- a/ykman-gui/qml/CopyableConfirmationPopup.qml +++ b/ykman-gui/qml/CopyableConfirmationPopup.qml @@ -6,13 +6,11 @@ InlinePopup { property var acceptCallback standardButtons: Dialog.Ok - onAccepted: acceptCallback() focus: true - function show(heading, message, cb) { + function show(heading, message) { confirmationHeading.text = heading confirmationLbl.text = message - acceptCallback = cb open() } @@ -32,6 +30,8 @@ InlinePopup { color: yubicoBlue selectByMouse: true readOnly: true + Layout.maximumWidth: parent.width + width: parent.width } } } \ No newline at end of file diff --git a/ykman-gui/qml/OtpYubiOtpView.qml b/ykman-gui/qml/OtpYubiOtpView.qml index 96034504..d84c205c 100644 --- a/ykman-gui/qml/OtpYubiOtpView.qml +++ b/ykman-gui/qml/OtpYubiOtpView.qml @@ -44,9 +44,9 @@ ColumnLayout { if (resp.upload_url) { upload = true url = resp.upload_url - otpUrl(url, views.otp()) + otpUrl(url) //snackbarSuccess.show(qsTr("Configured Yubico OTP credential. Preparing upload in web browser.")) - //views.otp() + views.otp() } else { snackbarSuccess.show( From 54e94da7bc4b510ccb5ca5c69764ed01f7fd52b5 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 5 Mar 2024 08:37:07 +0100 Subject: [PATCH 07/19] Fix actions --- .github/workflows/windows-x64.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/windows-x64.yml b/.github/workflows/windows-x64.yml index e6c22c59..1c3ff6f8 100644 --- a/.github/workflows/windows-x64.yml +++ b/.github/workflows/windows-x64.yml @@ -57,7 +57,7 @@ jobs: - name: Build and install pyotherside run: | - set PATH=D:\a\yubikey-manager-qt\Qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\Qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 cd pyotherside-%PYOTHERSIDE_VER% qmake @@ -68,7 +68,7 @@ jobs: - name: Build app shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 qmake jom @@ -76,7 +76,7 @@ jobs: - name: Run windeployqt shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 windeployqt .\ykman-gui\release\ykman-gui.exe --qmldir=.\ykman-gui\qml --no-translations --angle --release From 71b73e60a023d0d82ff461668fcda6a38a5b3fcb Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Wed, 6 Mar 2024 11:52:43 +0100 Subject: [PATCH 08/19] Fix actions win32 --- .github/workflows/windows-x86.yml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/windows-x86.yml b/.github/workflows/windows-x86.yml index 9c30132d..370cd6a3 100644 --- a/.github/workflows/windows-x86.yml +++ b/.github/workflows/windows-x86.yml @@ -19,13 +19,12 @@ jobs: architecture: 'x86' - name: Install Qt - uses: jurplel/install-qt-action@v2.10.0 + uses: jurplel/install-qt-action@v3 with: version: '5.14.1' host: 'windows' target: 'desktop' arch: 'win32_msvc2017' - aqtversion: '==0.9.7' - name: Download dependencies run: | @@ -60,7 +59,7 @@ jobs: - name: Build and install pyotherside shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 cd pyotherside-%PYOTHERSIDE_VER% qmake @@ -74,7 +73,7 @@ jobs: $py_ver -match "python (?.*)" $version = $matches['content'] - set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 qmake jom @@ -82,7 +81,7 @@ jobs: - name: Run windeployqt shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% + set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 windeployqt .\ykman-gui\release\ykman-gui.exe --qmldir=.\ykman-gui\qml --no-translations --angle --release From 35b6ff7b728f7033d3dc24e112db91c84c57650e Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 8 Mar 2024 11:44:44 +0100 Subject: [PATCH 09/19] Check for admin --- ykman-gui/qml/Header.qml | 4 ++-- ykman-gui/qml/OtpYubiOtpView.qml | 19 ++++++++++++++----- ykman-gui/qml/YubiKey.qml | 7 +++++++ 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 43b879d9..21d70c30 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -43,9 +43,9 @@ ColumnLayout { Layout.alignment: Qt.AlignRight | Qt.AlignVCenter iconSource: "../images/help.svg" toolTipText: qsTr("Visit Yubico Support in your web browser") - onClicked: helpPopup.show( + onClicked: yubiKey.isAdmin ? helpPopup.show( qsTr("Help"), qsTr( - "Visit https://www.yubico.com/kb for support with YubiKey Manager")) + "Visit https://www.yubico.com/kb for support with YubiKey Manager")) : Qt.openUrlExternally("https://www.yubico.com/kb") font.pixelSize: constants.h4 } CustomButton { diff --git a/ykman-gui/qml/OtpYubiOtpView.qml b/ykman-gui/qml/OtpYubiOtpView.qml index d84c205c..16e51950 100644 --- a/ykman-gui/qml/OtpYubiOtpView.qml +++ b/ykman-gui/qml/OtpYubiOtpView.qml @@ -42,11 +42,20 @@ ColumnLayout { enableUpload.checked, function (resp) { if (resp.success) { if (resp.upload_url) { - upload = true - url = resp.upload_url - otpUrl(url) - //snackbarSuccess.show(qsTr("Configured Yubico OTP credential. Preparing upload in web browser.")) - views.otp() + if (yubiKey.isAdmin) { + upload = true + url = resp.upload_url + otpUrl(url, views.otp()) + + views.otp() + } else { + if (Qt.openUrlExternally(resp.upload_url)) { + snackbarSuccess.show(qsTr("Configured Yubico OTP credential. Preparing upload in web browser.")) + views.otp() + } else { + snackbarError.show(qsTr("Configured Yubico OTP credential. Failed to open upload in web browser!")) + } + } } else { snackbarSuccess.show( diff --git a/ykman-gui/qml/YubiKey.qml b/ykman-gui/qml/YubiKey.qml index cc9913ca..ae50119e 100644 --- a/ykman-gui/qml/YubiKey.qml +++ b/ykman-gui/qml/YubiKey.qml @@ -13,6 +13,7 @@ Python { property string serial property bool canWriteConfig property bool configurationLocked + property bool isAdmin: true property var applicationsEnabledOverUsb: [] property var applicationsEnabledOverNfc: [] @@ -77,6 +78,12 @@ Python { path = path + '/pymodules' } + importModule('ctypes', function () { + call('ctypes.windll.shell32.IsUserAnAdmin', [], function (res) { + isAdmin = (res === 1) + }) + }) + importModule('site', function () { call('site.addsitedir', [path], function () { addImportPath(urlPrefix + '/py') From e6c69441e6a365449dbc08ac7d268f39ddaa8d33 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 12 Mar 2024 09:12:17 +0100 Subject: [PATCH 10/19] Change phrasing --- ykman-gui/qml/ContentStack.qml | 4 ++-- ykman-gui/qml/Header.qml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ykman-gui/qml/ContentStack.qml b/ykman-gui/qml/ContentStack.qml index e71ad8c9..671a1dd8 100644 --- a/ykman-gui/qml/ContentStack.qml +++ b/ykman-gui/qml/ContentStack.qml @@ -170,8 +170,8 @@ StackView { function otpUrl(url) { copyableConfirmationPopup.show( - qsTr("Upload?"), qsTr( - "Go to the following url in your browser to make sure your credential gets uploaded %1").arg( + qsTr("Upload"), qsTr( + "Complete the upload of your credential by visiting the following URL: %1").arg( url), ) } diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 21d70c30..7a24a971 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -45,7 +45,7 @@ ColumnLayout { toolTipText: qsTr("Visit Yubico Support in your web browser") onClicked: yubiKey.isAdmin ? helpPopup.show( qsTr("Help"), qsTr( - "Visit https://www.yubico.com/kb for support with YubiKey Manager")) : Qt.openUrlExternally("https://www.yubico.com/kb") + "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb") font.pixelSize: constants.h4 } CustomButton { From 7abbd7a8bc9afd1a6121f4b1cd1079826898eba2 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 12 Mar 2024 13:58:56 +0100 Subject: [PATCH 11/19] Minor fix --- ykman-gui/qml/Header.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 7a24a971..dcc11a1f 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -45,7 +45,7 @@ ColumnLayout { toolTipText: qsTr("Visit Yubico Support in your web browser") onClicked: yubiKey.isAdmin ? helpPopup.show( qsTr("Help"), qsTr( - "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb") + "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb")) font.pixelSize: constants.h4 } CustomButton { From 24e1341308c4aa242085d802179e671d385609f0 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 12 Mar 2024 14:18:36 +0100 Subject: [PATCH 12/19] Minor fix --- ykman-gui/qml/Header.qml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index dcc11a1f..5e706ba5 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -45,7 +45,7 @@ ColumnLayout { toolTipText: qsTr("Visit Yubico Support in your web browser") onClicked: yubiKey.isAdmin ? helpPopup.show( qsTr("Help"), qsTr( - "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb")) + "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb")) : Qt.openUrlExternally("https://www.yubico.com/kb") font.pixelSize: constants.h4 } CustomButton { From 22e036556dea2cfbbd57f416ab9fc231f903be6d Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 12 Mar 2024 14:34:34 +0100 Subject: [PATCH 13/19] Bump version --- ykman-gui/ykman-gui.pro | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ykman-gui/ykman-gui.pro b/ykman-gui/ykman-gui.pro index 5b840060..174d2ff9 100644 --- a/ykman-gui/ykman-gui.pro +++ b/ykman-gui/ykman-gui.pro @@ -5,12 +5,12 @@ SOURCES += main.cpp # This is the internal verson number, Windows requires 4 digits. win32|win64 { - VERSION = 1.2.5.0 + VERSION = 1.2.6.0 } else { - VERSION = 1.2.5 + VERSION = 1.2.6 } # This is the version shown on the About page -DEFINES += APP_VERSION=\\\"1.2.5\\\" +DEFINES += APP_VERSION=\\\"1.2.6\\\" message(Version of this build: $$VERSION) From bbd222e8d31165ee5fc1b774b98d4f79363a71ae Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Wed, 13 Mar 2024 13:51:57 +0100 Subject: [PATCH 14/19] Only check if running as admin on Win --- ykman-gui/qml/Header.qml | 2 +- ykman-gui/qml/OtpYubiOtpView.qml | 2 +- ykman-gui/qml/YubiKey.qml | 14 +++++++++----- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/ykman-gui/qml/Header.qml b/ykman-gui/qml/Header.qml index 5e706ba5..ab9057bf 100644 --- a/ykman-gui/qml/Header.qml +++ b/ykman-gui/qml/Header.qml @@ -43,7 +43,7 @@ ColumnLayout { Layout.alignment: Qt.AlignRight | Qt.AlignVCenter iconSource: "../images/help.svg" toolTipText: qsTr("Visit Yubico Support in your web browser") - onClicked: yubiKey.isAdmin ? helpPopup.show( + onClicked: yubiKey.isWinAdmin ? helpPopup.show( qsTr("Help"), qsTr( "Visit the following URL for support with YubiKey Manager: https://www.yubico.com/kb")) : Qt.openUrlExternally("https://www.yubico.com/kb") font.pixelSize: constants.h4 diff --git a/ykman-gui/qml/OtpYubiOtpView.qml b/ykman-gui/qml/OtpYubiOtpView.qml index 16e51950..43edb8b7 100644 --- a/ykman-gui/qml/OtpYubiOtpView.qml +++ b/ykman-gui/qml/OtpYubiOtpView.qml @@ -42,7 +42,7 @@ ColumnLayout { enableUpload.checked, function (resp) { if (resp.success) { if (resp.upload_url) { - if (yubiKey.isAdmin) { + if (yubiKey.isWinAdmin) { upload = true url = resp.upload_url otpUrl(url, views.otp()) diff --git a/ykman-gui/qml/YubiKey.qml b/ykman-gui/qml/YubiKey.qml index ae50119e..8a9cfa02 100644 --- a/ykman-gui/qml/YubiKey.qml +++ b/ykman-gui/qml/YubiKey.qml @@ -13,7 +13,7 @@ Python { property string serial property bool canWriteConfig property bool configurationLocked - property bool isAdmin: true + property bool isWinAdmin: true property var applicationsEnabledOverUsb: [] property var applicationsEnabledOverNfc: [] @@ -78,11 +78,15 @@ Python { path = path + '/pymodules' } - importModule('ctypes', function () { - call('ctypes.windll.shell32.IsUserAnAdmin', [], function (res) { - isAdmin = (res === 1) + if (Qt.platform.os === "windows") { + importModule('ctypes', function () { + call('ctypes.windll.shell32.IsUserAnAdmin', [], function (res) { + isWinAdmin = (res === 1) + }) }) - }) + } else { + isWinAdmin = false + } importModule('site', function () { call('site.addsitedir', [path], function () { From faa08c8f0a33048dcdac16bb56a54469f2bf6497 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Fri, 22 Mar 2024 12:23:47 +0100 Subject: [PATCH 15/19] Add flag --- ykman-cli/ykman-cli.pro | 4 ++++ ykman-gui/ykman-gui.pro | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ykman-cli/ykman-cli.pro b/ykman-cli/ykman-cli.pro index bd941d73..6990d58e 100644 --- a/ykman-cli/ykman-cli.pro +++ b/ykman-cli/ykman-cli.pro @@ -24,6 +24,10 @@ mac|win32 { QMAKE_CLEAN += -r pymodules } +win32 { + QMAKE_CXXFLAGS += /guard:cf +} + macx { pip.commands = python3 -m venv pymodules && source pymodules/bin/activate && pip3 install -r ../requirements.txt && deactivate } diff --git a/ykman-gui/ykman-gui.pro b/ykman-gui/ykman-gui.pro index 174d2ff9..5f43d611 100644 --- a/ykman-gui/ykman-gui.pro +++ b/ykman-gui/ykman-gui.pro @@ -42,6 +42,10 @@ macx { pip.commands = pip3 install -r ../requirements.txt --target pymodules } +win32 { + QMAKE_CXXFLAGS += /guard:cf +} + # Default rules for deployment. include(deployment.pri) From 1320239d66f8c285934afa5ee31c0bf8ea3d33e0 Mon Sep 17 00:00:00 2001 From: Alexandru Geana Date: Fri, 22 Mar 2024 13:15:24 +0100 Subject: [PATCH 16/19] Add CFG flags for C files and linker --- ykman-cli/ykman-cli.pro | 2 ++ ykman-gui/ykman-gui.pro | 2 ++ 2 files changed, 4 insertions(+) diff --git a/ykman-cli/ykman-cli.pro b/ykman-cli/ykman-cli.pro index 6990d58e..70de9a02 100644 --- a/ykman-cli/ykman-cli.pro +++ b/ykman-cli/ykman-cli.pro @@ -25,7 +25,9 @@ mac|win32 { } win32 { + QMAKE_CFLAGS += /guard:cf QMAKE_CXXFLAGS += /guard:cf + QMAKE_LFLAGS += /guard:cf } macx { diff --git a/ykman-gui/ykman-gui.pro b/ykman-gui/ykman-gui.pro index 5f43d611..d3ef54a9 100644 --- a/ykman-gui/ykman-gui.pro +++ b/ykman-gui/ykman-gui.pro @@ -43,7 +43,9 @@ macx { } win32 { + QMAKE_CFLAGS += /guard:cf QMAKE_CXXFLAGS += /guard:cf + QMAKE_LFLAGS += /guard:cf } # Default rules for deployment. From bedddf80db117bf221e420dc73ad14ebd6f744b1 Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Tue, 26 Mar 2024 08:57:17 +0100 Subject: [PATCH 17/19] Pin cryptography version --- requirements.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 362e25de..2f0075ec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ -yubikey-manager==5.0.1 \ No newline at end of file +yubikey-manager==5.0.1 +cryptography==39.0.0 From a6dd82f840e903da2d237e7f4a943a77272ae36a Mon Sep 17 00:00:00 2001 From: Dennis Fokin Date: Thu, 4 Apr 2024 11:19:40 +0200 Subject: [PATCH 18/19] Update NEWS --- NEWS | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/NEWS b/NEWS index f5cdaa25..4ea58498 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,7 @@ +* Version 1.2.6 (released 2024-04-04) + ** Windows-only security fix, see advisory: + https://www.yubico.com/support/security-advisories/ysa-2024-01/ + * Version 1.2.5 (released 2023-02-02) ** Compatibility update for ykman 5.0.1. ** Update to Python 3.11. From ec79d7f212c05378f23da2f729b97751c1478105 Mon Sep 17 00:00:00 2001 From: Dain Nilsson Date: Thu, 4 Apr 2024 11:39:36 +0200 Subject: [PATCH 19/19] Fix paths --- .github/workflows/windows-x64.yml | 6 +++--- .github/workflows/windows-x86.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/windows-x64.yml b/.github/workflows/windows-x64.yml index 1c3ff6f8..e6c22c59 100644 --- a/.github/workflows/windows-x64.yml +++ b/.github/workflows/windows-x64.yml @@ -57,7 +57,7 @@ jobs: - name: Build and install pyotherside run: | - set PATH=D:\a\yubikey-manager-qt-private\Qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\Qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 cd pyotherside-%PYOTHERSIDE_VER% qmake @@ -68,7 +68,7 @@ jobs: - name: Build app shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 qmake jom @@ -76,7 +76,7 @@ jobs: - name: Run windeployqt shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017_64\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x64 windeployqt .\ykman-gui\release\ykman-gui.exe --qmldir=.\ykman-gui\qml --no-translations --angle --release diff --git a/.github/workflows/windows-x86.yml b/.github/workflows/windows-x86.yml index 370cd6a3..d93fea11 100644 --- a/.github/workflows/windows-x86.yml +++ b/.github/workflows/windows-x86.yml @@ -59,7 +59,7 @@ jobs: - name: Build and install pyotherside shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 cd pyotherside-%PYOTHERSIDE_VER% qmake @@ -73,7 +73,7 @@ jobs: $py_ver -match "python (?.*)" $version = $matches['content'] - set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 qmake jom @@ -81,7 +81,7 @@ jobs: - name: Run windeployqt shell: cmd run: | - set PATH=D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt-private\yubikey-manager-qt-private;%PATH% + set PATH=D:\a\yubikey-manager-qt\yubikey-manager-qt\5.14.1\msvc2017\bin;D:\a\yubikey-manager-qt\yubikey-manager-qt;%PATH% call C:\"Program Files\Microsoft Visual Studio"\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat x86 windeployqt .\ykman-gui\release\ykman-gui.exe --qmldir=.\ykman-gui\qml --no-translations --angle --release