mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-07 08:48:45 +00:00
Strip session keys and IVs from the logs
Logging these isn't a major issue because they change each session and the privilege level to access the logs is the same as those to access the private key of Moonlight client itself, but there's also no good reason to log them either.
This commit is contained in:
parent
e07f069222
commit
a0a8b70bc1
1 changed files with 7 additions and 0 deletions
|
@ -11,6 +11,7 @@
|
|||
#include <QCursor>
|
||||
#include <QElapsedTimer>
|
||||
#include <QTemporaryFile>
|
||||
#include <QRegularExpression>
|
||||
|
||||
// Don't let SDL hook our main function, since Qt is already
|
||||
// doing the same thing. This needs to be before any headers
|
||||
|
@ -60,6 +61,8 @@ static QElapsedTimer s_LoggerTime;
|
|||
static QTextStream s_LoggerStream(stderr);
|
||||
static QMutex s_LoggerLock;
|
||||
static bool s_SuppressVerboseOutput;
|
||||
static QRegularExpression k_RikeyRegex("&rikey=\\w+");
|
||||
static QRegularExpression k_RikeyIdRegex("&rikeyid=[\\d-]+");
|
||||
#ifdef LOG_TO_FILE
|
||||
// Max log file size of 10 MB
|
||||
#define MAX_LOG_SIZE_BYTES (10 * 1024 * 1024)
|
||||
|
@ -72,6 +75,10 @@ void logToLoggerStream(QString& message)
|
|||
{
|
||||
QMutexLocker lock(&s_LoggerLock);
|
||||
|
||||
// Strip session encryption keys and IVs from the logs
|
||||
message.replace(k_RikeyRegex, "&rikey=REDACTED");
|
||||
message.replace(k_RikeyIdRegex, "&rikeyid=REDACTED");
|
||||
|
||||
#ifdef LOG_TO_FILE
|
||||
if (s_LogLimitReached) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue