]> dgit.raspbian.org Git - nextcloud-desktop.git/commitdiff
Remote Wipe: Implement hack to allow deleting all keychain entries (SSL certs & keys)
authorMichael Schuster <michael@schuster.ms>
Sat, 7 Dec 2019 23:00:02 +0000 (00:00 +0100)
committerMichael Schuster <48932272+misch7@users.noreply.github.com>
Sun, 8 Dec 2019 01:47:22 +0000 (02:47 +0100)
Client SSL certificates and keys cannot be deleted at this time because there is
no UI for selecting them on re-login.

We introduce this dirty hack here, to allow deleting them upon Remote Wipe.

Signed-off-by: Michael Schuster <michael@schuster.ms>
src/gui/creds/webflowcredentials.cpp
src/gui/remotewipe.cpp
src/libsync/account.h

index c898748cfbd418f3351e6176c1c88a4a582abdba..f6a9c1260470de3738c74a811bc78c0251b0036b 100644 (file)
@@ -432,14 +432,7 @@ void WebFlowCredentials::forgetSensitiveData() {
 
     invalidateToken();
 
-    /* IMPORTANT
-     * TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
-     *
-     *       Disabled as long as selecting another cert is not supported by the UI.
-     *
-     *       Being able to specify a new certificate is important anyway: expiry etc.
-    */
-    //deleteKeychainEntries();
+    deleteKeychainEntries();
 }
 
 void WebFlowCredentials::setAccount(Account *account) {
@@ -706,19 +699,34 @@ void WebFlowCredentials::deleteKeychainEntries(bool oldKeychainEntries) {
     };
 
     startDeleteJob(_user);
-    startDeleteJob(_user + clientKeyPEMC);
-    startDeleteJob(_user + clientCertificatePEMC);
 
-    for (auto i = 0; i < _clientSslCaCertificates.count(); i++) {
-        startDeleteJob(_user + clientCaCertificatePEMC + QString::number(i));
-    }
+    /* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
+      * TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
+      *
+      *       Disabled as long as selecting another cert is not supported by the UI.
+      *
+      *       Being able to specify a new certificate is important anyway: expiry etc.
+      *
+      *       We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
+     */
+    if(_account->isRemoteWipeRequested_HACK()) {
+    // <-- FIXME MS@2019-12-07
+        startDeleteJob(_user + clientKeyPEMC);
+        startDeleteJob(_user + clientCertificatePEMC);
+
+        for (auto i = 0; i < _clientSslCaCertificates.count(); i++) {
+            startDeleteJob(_user + clientCaCertificatePEMC + QString::number(i));
+        }
 
 #if defined(Q_OS_WIN)
-    // also delete key sub-chunks (Windows workaround)
-    for (auto i = 1; i < _clientSslKeyChunkCount; i++) {
-        startDeleteJob(_user + clientKeyPEMC + QString(".") + QString::number(i));
-    }
+        // also delete key sub-chunks (Windows workaround)
+        for (auto i = 1; i < _clientSslKeyChunkCount; i++) {
+            startDeleteJob(_user + clientKeyPEMC + QString(".") + QString::number(i));
+        }
 #endif
+    // FIXME MS@2019-12-07 -->
+    }
+    // <-- FIXME MS@2019-12-07
 }
 
 }
index 176cda5472f6a038b8fa44d1150f6832550fc375..061acb2e079decde6a934d2c0f5f587c56b0feba 100644 (file)
@@ -100,6 +100,18 @@ void RemoteWipe::checkJobSlot()
     auto accountState = manager->account(_account->displayName()).data();
 
     if(wipe){
+        /* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
+         * TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
+         *
+         *       Disabled as long as selecting another cert is not supported by the UI.
+         *
+         *       Being able to specify a new certificate is important anyway: expiry etc.
+         *
+         *       We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
+         */
+        _account->setRemoteWipeRequested_HACK();
+        // <-- FIXME MS@2019-12-07
+
         // delete account
         manager->deleteAccount(accountState);
         manager->save();
index 2b843dca95645258dbc0c13268c8f7fec54254f7..1caef1991a81aafe9fc934cb6b7a777d242c57f0 100644 (file)
@@ -323,6 +323,22 @@ private:
     bool _wroteAppPassword = false;
 
     friend class AccountManager;
+
+    /* IMPORTANT - remove later - FIXME MS@2019-12-07 -->
+     * TODO: For "Log out" & "Remove account": Remove client CA certs and KEY!
+     *
+     *       Disabled as long as selecting another cert is not supported by the UI.
+     *
+     *       Being able to specify a new certificate is important anyway: expiry etc.
+     *
+     *       We introduce this dirty hack here, to allow deleting them upon Remote Wipe.
+    */
+    public:
+        void setRemoteWipeRequested_HACK() { _isRemoteWipeRequested_HACK = true; }
+        bool isRemoteWipeRequested_HACK() { return _isRemoteWipeRequested_HACK; }
+    private:
+        bool _isRemoteWipeRequested_HACK = false;
+    // <-- FIXME MS@2019-12-07
 };
 }