Skip to content

Commit 7f7423b

Browse files
committed
RDK-55520: Obscure "value" field from getting printed in MigrationPreparer logs
Reason for change: to avoid any sensitive information from getting printed in logs Test Procedure: build Risks: Low Priority: P1 Signed-off-by:Boopathi Vanavarayan <[email protected]>
1 parent 66d0476 commit 7f7423b

File tree

4 files changed

+23
-12
lines changed

4 files changed

+23
-12
lines changed

MigrationPreparer/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ All notable changes to this RDK Service will be documented in this file.
1414

1515
For more details, refer to versioning section under Main README.
1616

17+
## [1.0.1] - 2025-20-01
18+
- Changes to avoid any "value" field from getting printed in MigrationPreparer related logs.
19+
1720
## [1.0.0] - 2024-12-01
1821
### Added
1922
- New RDK Service MigrationPreparer to aid the Data Harvesting process, where it exposes APIs to applications such as ResidentApp and others to store user settings in a standardized format (as a JSON file) suitable for EntOS consumption. The MigrationPreparer Thunder plugin will exist only in the RDKV ecosystem.

MigrationPreparer/MigrationPreparer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#define API_VERSION_NUMBER_MAJOR 1
2323
#define API_VERSION_NUMBER_MINOR 0
24-
#define API_VERSION_NUMBER_PATCH 0
24+
#define API_VERSION_NUMBER_PATCH 1
2525

2626
namespace WPEFramework
2727
{

MigrationPreparer/MigrationPreparerImplementation.cpp

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ namespace Plugin {
157157
}
158158

159159
int8_t MigrationPreparerImplementation::split(std::list<string>& list, string& value, std::string delimiter) {
160-
LOGINFO("split: %s", value.c_str());
160+
// LOGINFO("split: %s", value.c_str());
161161
string::size_type start = 0, pos = 0;
162162
while ((pos = value.find(delimiter, start) )!= std::string::npos) {
163163
list.emplace_back(value.substr(start, pos - start));
@@ -178,7 +178,7 @@ namespace Plugin {
178178
}
179179
// Add the last element without an underscore
180180
value += *it;
181-
LOGINFO("join: %s", value.c_str());
181+
// LOGINFO("join: %s", value.c_str());
182182
return Core::ERROR_NONE;
183183
}
184184

@@ -196,7 +196,8 @@ namespace Plugin {
196196

197197
uint32_t MigrationPreparerImplementation::write(const string& name, const string &value) {
198198

199-
LOGINFO("[WRITE] params={name: %s, value: %s}", name.c_str(), value.c_str());
199+
// LOGINFO("[WRITE] params={name: %s, value: %s}", name.c_str(), value.c_str());
200+
LOGINFO("Writing entry for name: %s", name.c_str());
200201
string entry;
201202
string key = name;
202203
string newValue = value;
@@ -232,7 +233,8 @@ namespace Plugin {
232233

233234
if(!dataStore.Open(false)) {
234235
LOGERR("Failed to open migration datastore %s, errno: %d, reason: %s", DATASTORE_PATH, errno, strerror(errno));
235-
LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
236+
// LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
237+
LOGERR("Failed to create entry for name: %s in migration datastore", key.c_str());
236238
_dataStoreMutex.unlock();
237239
return ERROR_OPEN;
238240
}
@@ -253,7 +255,8 @@ namespace Plugin {
253255
string oldValue = _valueEntry[_lineNumber[key] - 2];
254256

255257
if(oldValue == newValue) {
256-
LOGWARN("Entry {%s:%s} is already existing in the dataStore, returning success", oldValue.c_str(), key.c_str());
258+
// LOGWARN("Entry {%s:%s} is already existing in the dataStore, returning success", oldValue.c_str(), key.c_str());
259+
LOGWARN("Entry for name: %s is already existing in the dataStore, returning success", key.c_str());
257260
_dataStoreMutex.unlock();
258261
return Core::ERROR_NONE;
259262
}
@@ -279,23 +282,26 @@ namespace Plugin {
279282
return Core::ERROR_NONE;
280283
}
281284
result = WEXITSTATUS(result);
282-
LOGERR("Failed to update entry for {%s:%s} in migration datastore, v_secure_system failed with error %d",key.c_str(), newValue.c_str(), result);
285+
// LOGERR("Failed to update entry for {%s:%s} in migration datastore, v_secure_system failed with error %d",key.c_str(), newValue.c_str(), result);
286+
LOGERR("Failed to update entry for name: %s in migration datastore, v_secure_system failed with error %d",key.c_str(), result);
283287
_dataStoreMutex.unlock();
284288
return ERROR_WRITE;
285289
}
286290

287291
// Handle subsequent Write request
288292
if(!dataStore.Open(false)) {
289293
LOGERR("Failed to create migration datastore %s, errno: %d, reason: %s", DATASTORE_PATH, errno, strerror(errno));
290-
LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
294+
// LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
295+
LOGERR("Failed to create entry for name: %s in migration datastore", key.c_str());
291296
_dataStoreMutex.unlock();
292297
return ERROR_OPEN;
293298
}
294299

295300
// append new key-value pair to the dataStore
296301
if(!dataStore.Position(false, dataStore.Size() - 2)) {
297302
LOGERR("DataStore truncate failed with errno: %d, reason: %s\n", errno, strerror(errno));
298-
LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
303+
// LOGERR("Failed to create entry for {%s:%s} in migration datastore", key.c_str(), newValue.c_str());
304+
LOGERR("Failed to create entry for %s in migration datastore", key.c_str());
299305
dataStore.Close();
300306
_dataStoreMutex.unlock();
301307
return ERROR_WRITE;
@@ -311,7 +317,7 @@ namespace Plugin {
311317

312318
uint32_t MigrationPreparerImplementation::read(const string& name, string &result) {
313319

314-
LOGINFO("[READ] params={name: %s}", name.c_str());
320+
LOGINFO("Reading entry for name: %s", name.c_str());
315321
string key = name;
316322

317323
if(!_fileExist) {
@@ -336,7 +342,7 @@ namespace Plugin {
336342

337343
uint32_t MigrationPreparerImplementation::Delete(const string& name) {
338344

339-
LOGINFO("[DELETE] params={name: %s}", name.c_str());
345+
LOGINFO("Deleting entry for name: %s", name.c_str());
340346
string key = name;
341347
int result;
342348

MigrationPreparer/MigrationPreparerJsonRpc.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,10 @@ namespace Plugin {
158158
response["error"] = error;
159159
break;
160160
case Core::ERROR_NONE:
161-
status = true;
161+
// In order to avoid printing "value" field in the MigrationPreparer logs, we bypass "returnResponse" macro
162162
response["value"] = value;
163+
response["success"] = true;
164+
return WPEFramework::Core::ERROR_NONE;
163165
break;
164166
default:
165167
error["message"] = "Unknown Error";

0 commit comments

Comments
 (0)