Skip to content

Commit

Permalink
Preserve Secret Service exposed group setting on merge
Browse files Browse the repository at this point in the history
* Fixes #9371 - adds secret service custom data key to the list of protected custom data (will not be overwritten on merge)
  • Loading branch information
droidmonkey committed Apr 29, 2024
1 parent e9b2a1c commit ada78b7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 15 deletions.
2 changes: 1 addition & 1 deletion src/core/CustomData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ void CustomData::updateLastModified(QDateTime lastModified)

bool CustomData::isProtected(const QString& key) const
{
return key.startsWith(CustomData::BrowserKeyPrefix) || key.startsWith(CustomData::Created);
return key.startsWith(BrowserKeyPrefix) || key == Created || key == FdoSecretsExposedGroup;
}

bool CustomData::isAutoGenerated(const QString& key) const
Expand Down
18 changes: 4 additions & 14 deletions src/fdosecrets/FdoSecretsSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,6 @@
#include "core/Database.h"
#include "core/Metadata.h"

namespace Keys
{
namespace Db
{
constexpr auto FdoSecretsExposedGroup = "FDO_SECRETS_EXPOSED_GROUP";
} // namespace Db

} // namespace Keys

namespace FdoSecrets
{

Expand Down Expand Up @@ -98,20 +89,19 @@ namespace FdoSecrets
return exposedGroup(db.data());
}

void FdoSecretsSettings::setExposedGroup(const QSharedPointer<Database>& db,
const QUuid& group) // clazy:exclude=function-args-by-value
void FdoSecretsSettings::setExposedGroup(const QSharedPointer<Database>& db, const QUuid& group)
{
setExposedGroup(db.data(), group);
}

QUuid FdoSecretsSettings::exposedGroup(Database* db) const
{
return {db->metadata()->customData()->value(Keys::Db::FdoSecretsExposedGroup)};
return {db->metadata()->customData()->value(CustomData::FdoSecretsExposedGroup)};
}

void FdoSecretsSettings::setExposedGroup(Database* db, const QUuid& group) // clazy:exclude=function-args-by-value
void FdoSecretsSettings::setExposedGroup(Database* db, const QUuid& group)
{
db->metadata()->customData()->set(Keys::Db::FdoSecretsExposedGroup, group.toString());
db->metadata()->customData()->set(CustomData::FdoSecretsExposedGroup, group.toString());
}

} // namespace FdoSecrets

0 comments on commit ada78b7

Please sign in to comment.