fix(integrity): restore bootstrap runtime protection

This commit is contained in:
Comely
2026-07-12 17:36:53 -07:00
parent c5e8f34f75
commit b098792001
4 changed files with 45 additions and 35 deletions
+3 -15
View File
@@ -1,5 +1,6 @@
#include "IntegrityHelper.h"
#include "ConfigHelper.h"
#include "RuntimeProtectionPolicy.h"
#include <QCryptographicHash>
#include <QDir>
#include <QDirIterator>
@@ -33,21 +34,8 @@ bool IntegrityHelper::safeRelativePath(const QString& path) const
bool IntegrityHelper::runtimeProtectedPath(const QString& path) const
{
const QString p = QDir::fromNativeSeparators(path).toCaseFolded();
QSet<QString> protectedPaths{
"client.ini", "config/app_config.json", "config/local_state.json",
"config/client_identity.dat", "config/version_policy.dat"
};
const QString runtimePrefix = ConfigHelper::instance().runtimeRelativePath().toCaseFolded();
if (!runtimePrefix.isEmpty()) {
const QStringList runtimeProtected{
"client.ini", "config/app_config.json", "config/local_state.json",
"config/client_identity.dat", "config/version_policy.dat"
};
for (const QString& protectedPath : runtimeProtected)
protectedPaths.insert(runtimePrefix + "/" + protectedPath);
}
return protectedPaths.contains(p);
return UpdateClient::isRuntimeProtectedPath(
path, ConfigHelper::instance().runtimeRelativePath());
}
QString IntegrityHelper::sha256(const QString& filePath) const