summaryrefslogtreecommitdiffstats
path: root/common/listener.cpp
diff options
context:
space:
mode:
authorChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-18 11:40:41 +0200
committerChristian Mollekopf <chrigi_1@fastmail.fm>2017-09-18 11:40:45 +0200
commita7e7f7fdd2a9d38921476d57f305c9cd4459a556 (patch)
treed9ad3bdc3e275004a54f508025f0d52227ab18cb /common/listener.cpp
parentea2e02ad656640c17d520b5a22c168c3c1faef56 (diff)
downloadsink-a7e7f7fdd2a9d38921476d57f305c9cd4459a556.tar.gz
sink-a7e7f7fdd2a9d38921476d57f305c9cd4459a556.zip
Avoid storing the password in the configuration
The password (or any other secret), is now cached in the client process (in-memory only), and delivered to the resource via command. The resource avoids doing any operations against the source until the secret is available.
Diffstat (limited to 'common/listener.cpp')
-rw-r--r--common/listener.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/common/listener.cpp b/common/listener.cpp
index c9fd9d3..c6747cd 100644
--- a/common/listener.cpp
+++ b/common/listener.cpp
@@ -33,6 +33,7 @@
33#include "common/revisionupdate_generated.h" 33#include "common/revisionupdate_generated.h"
34#include "common/notification_generated.h" 34#include "common/notification_generated.h"
35#include "common/revisionreplayed_generated.h" 35#include "common/revisionreplayed_generated.h"
36#include "common/secret_generated.h"
36 37
37#include <QLocalServer> 38#include <QLocalServer>
38#include <QLocalSocket> 39#include <QLocalSocket>
@@ -240,6 +241,17 @@ void Listener::processCommand(int commandId, uint messageId, const QByteArray &c
240 } 241 }
241 break; 242 break;
242 } 243 }
244 case Sink::Commands::SecretCommand: {
245 flatbuffers::Verifier verifier((const uint8_t *)commandBuffer.constData(), commandBuffer.size());
246 if (Sink::Commands::VerifySecretBuffer(verifier)) {
247 auto buffer = Sink::Commands::GetSecret(commandBuffer.constData());
248 loadResource().setSecret(QString{buffer->secret()->c_str()});
249 } else {
250 SinkWarning() << "received invalid command";
251 }
252 break;
253 }
254
243 case Sink::Commands::SynchronizeCommand: 255 case Sink::Commands::SynchronizeCommand:
244 case Sink::Commands::InspectionCommand: 256 case Sink::Commands::InspectionCommand:
245 case Sink::Commands::DeleteEntityCommand: 257 case Sink::Commands::DeleteEntityCommand: