rebase#47
Conversation
replace iarm and syscfg call with rbus
* Create L2-tests.yml * Update cov_build.sh * Update remote_debugger.json * Create uploadRRDL2Logs.sh * Update uploadRRDL2Logs.sh * Create run_l2.sh * Create rrd_start_control.feature * Create test_rrd_start_control.py * Create rrd_single_instance.feature * Create rrd_start_subscribe_and_wait.feature * Create test_rrd_start_subscribe_and_wait.py * Create test_rrd_single_instance.py * Create helper_functions.py * Update run_l2.sh * Update L2-tests.yml * Update run_l2.sh * Delete scripts/uploadRRDL2Logs.sh * Update rrd_start_control.feature * RDK-56099: Pytest L2 Implementation Code Changes Add L2 test cases for following scenarios 1. corrupted static profile 2. harmfull command in static profile 3. Missing issue in static profile 4. Empty issue rbus event 5. Static profile report 6. Static profile Category report * Update remote_debugger.json * Create systemd-run * Update run_l2.sh * Create rrd_background_cmd_static_profile_report.feature * Create test_rrd_background_cmd_static_profile_report.py * Update uploadRRDLogs.sh * Update helper_functions.py * Update run_l2.sh
* RDKE-263:[OSCR Scan] RDKE - remote_debugger repo There is a still a reference to the rdk-e repo in src/unittest/README.md. This must be removed. Many files missing headers: not a blocker but a pity to let this slip. Could the component owner look at this please? cov_build.sh scripts/systemd-run test/functional-tests/tests/* * Update remote_debugger.json * Update run_l2.sh * Create rrd_debug_report_upload.feature * Create test_rrd_debug_report_upload.py * Update test_rrd_harmful_command_static_report.py * Update rrdMain.c * Update rrdInterface.c * Update rrd_empty_issuetype_event.feature * Update test_rrd_empty_issuetype_event.py * Update test_rrd_debug_report_upload.py * Update rrd_debug_report_upload.feature
Native builds are covered with L2 validations
RDK-56099: Enable L2 test workflows with PR
|
|
Correct the duplicate functions and add more logcheck
Correct the duplicate functions and add more logcheck
…/remote_debugger into feature/RDK-56099_add
RDK-56099: Pytest L2 Implementation Code Changes
* RDK-56099: Pytest L2 Implementation Code Changes (#39) * Create L2-tests.yml * Update cov_build.sh * Update remote_debugger.json * Create uploadRRDL2Logs.sh * Update uploadRRDL2Logs.sh * Create run_l2.sh * Create rrd_start_control.feature * Create test_rrd_start_control.py * Create rrd_single_instance.feature * Create rrd_start_subscribe_and_wait.feature * Create test_rrd_start_subscribe_and_wait.py * Create test_rrd_single_instance.py * Create helper_functions.py * Update run_l2.sh * Update L2-tests.yml * Update run_l2.sh * Delete scripts/uploadRRDL2Logs.sh * Update rrd_start_control.feature * RDK-56099: Pytest L2 Implementation Code Changes (#42) * Create L2-tests.yml * Update cov_build.sh * Update remote_debugger.json * Create uploadRRDL2Logs.sh * Update uploadRRDL2Logs.sh * Create run_l2.sh * Create rrd_start_control.feature * Create test_rrd_start_control.py * Create rrd_single_instance.feature * Create rrd_start_subscribe_and_wait.feature * Create test_rrd_start_subscribe_and_wait.py * Create test_rrd_single_instance.py * Create helper_functions.py * Update run_l2.sh * Update L2-tests.yml * Update run_l2.sh * Delete scripts/uploadRRDL2Logs.sh * Update rrd_start_control.feature * RDK-56099: Pytest L2 Implementation Code Changes Add L2 test cases for following scenarios 1. corrupted static profile 2. harmfull command in static profile 3. Missing issue in static profile 4. Empty issue rbus event 5. Static profile report 6. Static profile Category report * Update remote_debugger.json * Create systemd-run * Update run_l2.sh * Create rrd_background_cmd_static_profile_report.feature * Create test_rrd_background_cmd_static_profile_report.py * Update uploadRRDLogs.sh * Update helper_functions.py * Update run_l2.sh * RDKE-263:[OSCR Scan] RDKE - remote_debugger repo (#44) * RDKE-263:[OSCR Scan] RDKE - remote_debugger repo There is a still a reference to the rdk-e repo in src/unittest/README.md. This must be removed. Many files missing headers: not a blocker but a pity to let this slip. Could the component owner look at this please? cov_build.sh scripts/systemd-run test/functional-tests/tests/* * Update remote_debugger.json * Update run_l2.sh * Create rrd_debug_report_upload.feature * Create test_rrd_debug_report_upload.py * Update test_rrd_harmful_command_static_report.py * Update rrdMain.c * Update rrdInterface.c * Update rrd_empty_issuetype_event.feature * Update test_rrd_empty_issuetype_event.py * Update test_rrd_debug_report_upload.py * Update rrd_debug_report_upload.feature * RDK-56099: Enable L2 test workflows with PR * RDK-56099: Pre-clone dependent repositories * Move native builds as optional Native builds are covered with L2 validations * RDK-56099: Correct the report directory location * Update L2-tests.yml * Update run_l2.sh * Update test_rrd_debug_report_upload.py * Create uploadSTBLogs.sh * Update L2-tests.yml * Update L2-tests.yml * RDK-56099: Pytest L2 Implementation Code Changes Correct the duplicate functions and add more logcheck * RDK-56099: Pytest L2 Implementation Code Changes Correct the duplicate functions and add more logcheck --------- Co-authored-by: Shibu Kakkoth Vayalambron <mfox@mfox.local> Co-authored-by: shibu-kv <shibu.kakkoth@gmail.com> Co-authored-by: Venkata Bojja <39968865+venkat0557@users.noreply.github.com>
* Create L2-tests.yml * Update cov_build.sh * Update remote_debugger.json * Create uploadRRDL2Logs.sh * Update uploadRRDL2Logs.sh * Create run_l2.sh * Create rrd_start_control.feature * Create test_rrd_start_control.py * Create rrd_single_instance.feature * Create rrd_start_subscribe_and_wait.feature * Create test_rrd_start_subscribe_and_wait.py * Create test_rrd_single_instance.py * Create helper_functions.py * Update run_l2.sh * Update L2-tests.yml * Update run_l2.sh * Delete scripts/uploadRRDL2Logs.sh * Update rrd_start_control.feature
* Create L2-tests.yml * Update cov_build.sh * Update remote_debugger.json * Create uploadRRDL2Logs.sh * Update uploadRRDL2Logs.sh * Create run_l2.sh * Create rrd_start_control.feature * Create test_rrd_start_control.py * Create rrd_single_instance.feature * Create rrd_start_subscribe_and_wait.feature * Create test_rrd_start_subscribe_and_wait.py * Create test_rrd_single_instance.py * Create helper_functions.py * Update run_l2.sh * Update L2-tests.yml * Update run_l2.sh * Delete scripts/uploadRRDL2Logs.sh * Update rrd_start_control.feature * RDK-56099: Pytest L2 Implementation Code Changes Add L2 test cases for following scenarios 1. corrupted static profile 2. harmfull command in static profile 3. Missing issue in static profile 4. Empty issue rbus event 5. Static profile report 6. Static profile Category report * Update remote_debugger.json * Create systemd-run * Update run_l2.sh * Create rrd_background_cmd_static_profile_report.feature * Create test_rrd_background_cmd_static_profile_report.py * Update uploadRRDLogs.sh * Update helper_functions.py * Update run_l2.sh
* RDKE-263:[OSCR Scan] RDKE - remote_debugger repo There is a still a reference to the rdk-e repo in src/unittest/README.md. This must be removed. Many files missing headers: not a blocker but a pity to let this slip. Could the component owner look at this please? cov_build.sh scripts/systemd-run test/functional-tests/tests/* * Update remote_debugger.json * Update run_l2.sh * Create rrd_debug_report_upload.feature * Create test_rrd_debug_report_upload.py * Update test_rrd_harmful_command_static_report.py * Update rrdMain.c * Update rrdInterface.c * Update rrd_empty_issuetype_event.feature * Update test_rrd_empty_issuetype_event.py * Update test_rrd_debug_report_upload.py * Update rrd_debug_report_upload.feature
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 98 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| ISSUE_STRING = "Device.Info" | ||
|
|
||
| CATEGORY_STRING = "Device" | ||
| HARMFULL_STRING = "Command.Harm" |
There was a problem hiding this comment.
The spelling "harmfull" should be "harmful" in the variable name HARMFULL_STRING. This typo is used consistently across multiple files but should be corrected for proper English spelling.
| And the issue data node and sub-node should be found in the JSON file | ||
| And the directory should be created to store the executed output | ||
| And Sanity check to validate the commands should be executed | ||
| And Command output shopuld be added to the output file |
There was a problem hiding this comment.
The spelling "shopuld" should be "should" in this feature file scenario description.
| Given the remote debugger profile has the harmfull commands | ||
| When the issue command and the sanity commands are matched | ||
| Then the remote debugger should exit the processing of commands | ||
| And Abort the commmand execution and skip report upload |
There was a problem hiding this comment.
The spelling "commmand" has an extra 'm' and should be "command".
| if '.' in ISSUE_STRING: | ||
| ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.') | ||
| else: | ||
| node = ISSUE_STRING |
There was a problem hiding this comment.
Variable node is not used.
| ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.') | ||
| else: | ||
| node = ISSUE_STRING | ||
| subnode = None |
There was a problem hiding this comment.
Variable subnode is not used.
| node = ISSUE_STRING | ||
| subnode = None | ||
|
|
||
| ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json" |
There was a problem hiding this comment.
Variable ISSUE_FOUND is not used.
| node = ISSUE_STRING | ||
| subnode = None | ||
|
|
||
| ISSUE_FOUND = f"Issue Data Node: {ISSUE_NODE} and Sub-Node: {ISSUE_SUBNODE} found in Static JSON File /etc/rrd/remote_debugger.json" |
There was a problem hiding this comment.
Variable ISSUE_FOUND is not used.
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| from helper_functions import * |
There was a problem hiding this comment.
Import pollutes the enclosing namespace, as the imported module helper_functions does not define 'all'.
RRD release 1.3.1
…ode (#178) * Update Makefile.am * Update rrdExecuteScript.c * Update rrd_upload.h * Update Makefile.am * Update Makefile.am * Update Makefile.am * Update Makefile.am --------- Co-authored-by: nhanasi <navihansi@gmail.com>
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") | ||
| else: | ||
| print("Script execution not found in logs") |
There was a problem hiding this comment.
The variable names SCRIPT_SUCCESS and SCRIPT_FAILURE are swapped - their associated log messages are reversed. SCRIPT_SUCCESS checks for "upload Failed" and SCRIPT_FAILURE checks for "upload Success".
| break; | ||
| default: | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]: Invalid Message Type %d!!!\n", __FUNCTION__, __LINE__, rbuf->mtype); | ||
| free(rbuf->mdata); | ||
| free(rbuf); | ||
| break; | ||
| } |
There was a problem hiding this comment.
Memory leak: The function deletes rbuf in the default case but not in other cases. This inconsistency can lead to memory leaks in EVENT_MSG and EVENT_WEBCFG_MSG cases.
| UPLOAD_MSG = "Skip uploading Debug Report" | ||
| assert UPLOAD_MSG in grep_rrdlogs(UPLOAD_MSG) | ||
|
|
||
| #remove_logfile() |
There was a problem hiding this comment.
The commented out remove_logfile() line at line 104 should either be uncommented or removed. Leaving commented code reduces code clarity.
This pull request addresses Coverity defects in the RDK Remote Debugger Device Management code, focusing on fixing memory leaks, buffer overflows, and resource handling issues. Changes: Added NULL checks for memory allocations (malloc, strdup, fread) with proper error handling and resource cleanup Fixed buffer overflow vulnerabilities by using correct size parameters in strncpy/strncat operations Corrected file pointer closure to only occur when pointers are valid (v_secure_pclose moved inside if blocks) Fixed memory management issues with rfcbuf allocations and ownership Co-authored-by: mtirum011 <madhubabu_tirumala@comcast.com>
Remote Debugger 1.3.2 release
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 98 out of 98 changed files in this pull request and generated 14 comments.
Comments suppressed due to low confidence (1)
src/rrdCommandSanity.c:154
checkcmdreturned bycJSON_Printis heap-allocated but is never freed anymore, and the code increments the pointer (checkcmd++), making it impossible to free correctly later. Keep the original pointer forcJSON_free, operate on a separate pointer/temporary buffer when trimming quotes/spaces, and also handle the case wherecJSON_Printreturns NULL before callingstrlen.
checkcmd = cJSON_Print(subcmd); // Print each command from the sanity command array in Json
int len = strlen(checkcmd);
if (len >= 2 && checkcmd[0] == '"' && checkcmd[len - 1] == '"')
{
checkcmd[len - 1] = '\0'; // Remove closing quote
checkcmd++; // Move pointer forward to skip opening quote
len -= 2; // Adjust length after removing quotes
}
// Trim trailing spaces
int j = len - 1;
while (j >= 0 && isspace(checkcmd[j])) {
checkcmd[j] = '\0';
j--;
}
RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Checking for \"%s\" string in Issue commands... \n",__FUNCTION__,__LINE__,checkcmd);
sanitystr = strstr(issuecmd,checkcmd);
if (sanitystr)
{
RDK_LOG(RDK_LOG_ERROR,LOG_REMDEBUG,"[%s:%d]: Found harmful commands: %s, Exiting!!! \n",__FUNCTION__,__LINE__,sanitystr);
return 1;
}
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| sanity = cJSON_GetObjectItem(jsoncfg, "Sanity"); | ||
| check = cJSON_GetObjectItem(sanity, "Check"); | ||
| checkval = cJSON_Print(check); // Print list of sanity commands received | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Reading Sanity Check Commands List: \n%s\n",__FUNCTION__,__LINE__,checkval); | ||
| if(checkval ==NULL) | ||
| { | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Entering checkval null case : \n",__FUNCTION__,__LINE__); | ||
| jsoncfg = readAndParseJSON(RRD_JSON_FILE); | ||
| sanity = cJSON_GetObjectItem(jsoncfg, "Sanity"); | ||
| check = cJSON_GetObjectItem(sanity, "Check"); | ||
| checkval = cJSON_Print(check); // Print list of sanity commands received | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Reading Sanity Check Commands List: \n%s\n",__FUNCTION__,__LINE__,checkval); | ||
| } |
There was a problem hiding this comment.
checkval is logged with %s immediately after cJSON_Print(check) (line 459) before the NULL check; passing NULL to %s is undefined behavior and can crash. Also, in the NULL case you overwrite jsoncfg with a new parsed tree without cleaning up the previous one, leaking memory. Check for NULL before logging, and avoid re-reading/overwriting jsoncfg here (or delete the old tree and clearly transfer ownership).
| sed -i 's/remote-debugger\.log/remotedebugger\.log\.0/g' /lib/rdk/uploadRRDLogs.sh | ||
|
|
||
| cp test/functional-tests/tests/uploadSTBLogs.sh /lib/rdk/uploadSTBLogs.sh | ||
| chmod -R 777 /lib/rdk/uploadRRDLogs.sh |
There was a problem hiding this comment.
After copying uploadSTBLogs.sh to /lib/rdk/uploadSTBLogs.sh, the script runs chmod -R 777 /lib/rdk/uploadRRDLogs.sh again (line 46) instead of chmod'ing the newly copied uploadSTBLogs script. This leaves /lib/rdk/uploadSTBLogs.sh potentially non-executable in the L2 container.
| chmod -R 777 /lib/rdk/uploadRRDLogs.sh | |
| chmod -R 777 /lib/rdk/uploadSTBLogs.sh |
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" | ||
| if SCRIPT_SUCCESS in grep_rrdlogs(SCRIPT_SUCCESS): | ||
| print("Script execution success") | ||
| elif SCRIPT_FAILURE in grep_rrdlogs(SCRIPT_FAILURE): | ||
| print("Script execution failed") |
There was a problem hiding this comment.
SCRIPT_SUCCESS and SCRIPT_FAILURE are assigned to the opposite log messages (Success variable contains "...upload Failed" and vice versa), so the test will report inverted results. Swap the message assignments (or swap the branches) so success/failure checks match the log text.
| @@ -264,6 +262,7 @@ class RBusApiInterface | |||
| virtual rbusError_t rbusValue_Init(rbusValue_t *value) = 0; | |||
| virtual rbusError_t rbusValue_SetString(rbusValue_t value, char const *str) = 0; | |||
| virtual rbusError_t rbus_set(rbusHandle_t handle, char const *objectName, rbusValue_t value, rbusMethodAsyncRespHandler_t respHandler) = 0; | |||
| virtual rbusError_t rbus_get(rbusHandle_t handle, char const *objectName, rbusValue_t value, rbusMethodAsyncRespHandler_t respHandler) = 0; | |||
| }; | |||
|
|
|||
| class RBusApiWrapper | |||
| @@ -280,13 +279,15 @@ class RBusApiWrapper | |||
| static rbusError_t rbusValue_Init(rbusValue_t *value); | |||
| static rbusError_t rbusValue_SetString(rbusValue_t value, char const *str); | |||
| static rbusError_t rbus_set(rbusHandle_t handle, char const *objectName, rbusValue_t value, rbusMethodAsyncRespHandler_t respHandler); | |||
| static rbusError_t rbus_get(rbusHandle_t handle, char const *objectName, rbusValue_t value, rbusMethodAsyncRespHandler_t respHandler); | |||
| }; | |||
|
|
|||
| extern rbusError_t (*rbus_open)(rbusHandle_t *, char const *); | |||
| extern rbusError_t (*rbus_close)(rbusHandle_t); | |||
| extern rbusError_t (*rbusValue_Init)(rbusValue_t *); | |||
| extern rbusError_t (*rbusValue_SetString)(rbusValue_t, char const *); | |||
| extern rbusError_t (*rbus_set)(rbusHandle_t, char const *, rbusValue_t, rbusMethodAsyncRespHandler_t); | |||
| extern rbusError_t (*rbus_get)(rbusHandle_t, char const *, rbusValue_t, rbusMethodAsyncRespHandler_t); | |||
There was a problem hiding this comment.
The mock adds rbus_get with a 4-argument signature, but production code calls rbus_get(handle, name, &value) (3 arguments). This signature mismatch will prevent reliable mocking and can break compilation when the mock wrapper is used. Update the mock interface/wrapper to match the actual rbus_get prototype (typically rbus_get(rbusHandle_t, const char*, rbusValue_t*)) and adjust the function pointer declarations accordingly.
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "%s: Removing source directory: %s\n", __FUNCTION__, dir_path); | ||
|
|
||
| char cmd[1024]; | ||
| snprintf(cmd, sizeof(cmd), "rm -rf %s", dir_path); | ||
|
|
||
| int ret = system(cmd); | ||
| if (ret == 0) { |
There was a problem hiding this comment.
rrd_upload_cleanup_source_dir builds a shell command with snprintf("rm -rf %s", dir_path) and executes it via system(). If dir_path is attacker-controlled or contains shell metacharacters, this becomes command injection. Replace this with a safe recursive delete implementation (e.g., nftw/unlinkat), and validate the directory is within an expected base path before deletion.
* RDKEMW-16897: Add Agentic Support for the RRD * Updated the instructions --------- Co-authored-by: Hanasi <nhanas001c@cable.comcast.com>
…ile Data (#183) * Update rrdInterface.h Update rrdInterface.h Update rrdInterface.c Update rrdInterface.h Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Add helper functions for profile data processing Added helper functions for profile data processing. Update rrdInterface.c Update rrdInterface.h Update Client_Mock.h Add mock implementations for RBusApiWrapper methods Remove mock profile handler functions for GTEST Removed mock implementations for profile handler functions when GTEST_ENABLE is defined. Update Client_Mock.cpp Update Client_Mock.h Update rrdInterface.h Update Makefile.am Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Create profileTestValid.json Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Create profileTestInvalid.json Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Update rrdInterface.c Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> fix: add NULL guard to has_direct_commands to prevent crash on NULL input Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c84bc9e8-e1d2-4412-81d4-54eb9c67be5f Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Create test.py Convert run_l2.sh to Python with RDK tests Refactor run_l2.sh to Python and implement RDK Remote Debugger tests. L2 Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c fix: correct set_rbus_response to use real rbus API signatures rbusValue_Init() returns rbusValue_t (not rbusError_t) and rbusValue_SetString() returns void in the real rbus library, so capturing their return values as rbusError_t caused a build error. - Remove incorrect return-value capture from rbusValue_Init and rbusValue_SetString; check rbusValue != NULL after init instead - Add NULL guard for prop parameter - Update RRDProfileHandlerTest SetUp() mock so rbusValue_Init actually sets *value to a non-null pointer, keeping SetRbusResponse_ValidInput test passing Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/e887c84a-2e12-4903-9d59-2bd6f90e2527 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdInterface.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> fix: resolve Coverity dead code and add NULL guard to get_all_categories_json - read_profile_json_file: split combined NULL check into two separate checks (file_size first, then filename) so *file_size is safely zeroed before the filename check; eliminates the ternary 'filename ? filename : "(null)"' and the Coverity dead-code report - get_all_categories_json: add early NULL guard for json parameter that returns an empty JSON object string to prevent crash when callers (including unit tests) pass NULL Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c686520e-0adf-4e7e-9915-9b9e4e8a74fd Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Update rrdInterface.c Update rrdUnitTestRunner.cpp Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdInterface.c Clean up comments in save_profile_category function Removed comments explaining file opening flags. RDKEMW-16897: Add Agentic Support for the RRD (#182) * RDKEMW-16897: Add Agentic Support for the RRD * Updated the instructions --------- Co-authored-by: Hanasi <nhanas001c@cable.comcast.com> Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Rename test.py to test_rrd_profile_data.py rrd Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update src/rrdInterface.c Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp * Update rrdInterface.c * Update rrdUnitTestRunner.cpp
| subcmd = cJSON_GetArrayItem(sanitylist, i); | ||
| checkcmd = cJSON_Print(subcmd); // Print each command from the sanity command array in Json | ||
| int len = strlen(checkcmd); | ||
| if (len >= 2 && checkcmd[0] == '"' && checkcmd[len - 1] == '"') | ||
| { | ||
| checkcmd[len - 1] = '\0'; // Remove closing quote | ||
| checkcmd++; // Move pointer forward to skip opening quote | ||
| len -= 2; // Adjust length after removing quotes | ||
| } | ||
| // Trim trailing spaces | ||
| int j = len - 1; | ||
| while (j >= 0 && isspace(checkcmd[j])) { | ||
| checkcmd[j] = '\0'; | ||
| j--; | ||
| } | ||
| RDK_LOG(RDK_LOG_DEBUG,LOG_REMDEBUG,"[%s:%d]: Checking for \"%s\" string in Issue commands... \n",__FUNCTION__,__LINE__,checkcmd); | ||
| sanitystr = strstr(issuecmd,checkcmd); | ||
| cJSON_free(checkcmd); // free each command from the sanity command array | ||
| if (sanitystr) |
|
|
||
| devicePropertiesData devPropData; | ||
|
|
||
| void *RRDEventThreadFunc(void *arg) | ||
| { | ||
| data_buf *rbuf; | ||
| msgRRDHdr msgHdr; | ||
|
|
||
| while (1) | ||
| { | ||
| RDK_LOG(RDK_LOG_INFO, LOG_REMDEBUG, "[%s:%d]:Waiting for for TR69/RBUS Events... \n", __FUNCTION__, __LINE__); | ||
|
|
||
| if (msgrcv(msqid, (void *)&msgHdr, sizeof(void *), 0, 0) < 0) | ||
| { | ||
| RDK_LOG(RDK_LOG_ERROR, LOG_REMDEBUG, "[%s:%d]:Message Reception failed for Message Queue Id:[%d]!!! \n", __FUNCTION__, __LINE__, msqid); | ||
| break; | ||
| } |
| ########################################################################## | ||
| # If not stated otherwise in this file or this component's LICENSE | ||
| # file the following copyright and licenses apply: | ||
| # | ||
| # Copyright 2018 RDK Management | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| #!/bin/bash |
| echo "AA:BB:CC:DD:EE:FF" >> /tmp/.estb_mac | ||
|
|
||
|
|
||
| apt-get remove systemd |
| uses: actions/checkout@v3 | ||
| with: | ||
| path: remote_debugger | ||
|
|
||
| - name: Checkout code rfc code |
|
|
||
| # Define the compiler flags | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage | ||
| COMMON_CXXFLAGS = -frtti -fprofile-arcs -ftest-coverage -fpermissive |
| fi | ||
|
|
||
| if [[ -z $LOG_SERVER || -z $HTTP_UPLOAD_LINK ]]; then | ||
| if [ -z $LOG_SERVER ] || [ -z $HTTP_UPLOAD_LINK ]; then |
| rbusValue_t value; | ||
| rbusValue_Init(&value); | ||
| rbusValue_SetString(value,"root"); | ||
| rc = rbus_set(rrdRbusHandle, RRD_WEBCFG_FORCE_SYNC, value, NULL); |
|
|
||
| // --- Main Orchestration Layer --- | ||
|
|
||
| int rrd_upload_orchestrate(const char *upload_dir, const char *issue_type) |
| DYNAMIC_DIR="/media/apps/RDK-RRD-Test/etc/rrd" | ||
| DYNAMIC_JSON_FILE = "/media/apps/RDK-RRD-Test/etc/rrd/remote_debugger.json" | ||
| DYNAMIC_STRING = "Test" | ||
| DYNAMIC_HARMFUL_STRING = "Test.TestRun3" |
RRD release for static profile DML
Update rrdEventProcess.c Update rrdExecuteScript.c Refactor rrdEventProcess.h to rrdExecuteScript.h Update rrdExecuteScript.h Update rrdExecuteScript.h Update rrdEventProcess.h Update rrdExecuteScript.h Update rrdJsonParser.c Update rrdJsonParser.h Update rrdInterface.c Update rrdCommon.h Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Fix indentation for appendMode assignment Update rrdCommon.h Fix appendMode assignment in rrdEventProcess.c Update rrdEventProcess.c Update rrdJsonParser.c Update rrdEventProcess.c Update rrdExecuteScript.h Update rrdExecuteScript.c Update rrdExecuteScript.c Update rrdExecuteScript.c Remove redundant logging from rrdJsonParser Update rrdJsonParser.c Update rrdEventProcess.c Update rrdJsonParser.c Update rrdEventProcess.c Update rrdJsonParser.c Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Apply suggestion from @Copilot Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Fix heap overflow in issueTypeSplitter and memory leaks in suffix handling Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/fbc52780-966b-4912-825f-3030aa43c3e9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdUnitTestRunner.cpp Delete .gitignore Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdUnitTestRunner.cpp Add gtest test cases for split_issue_type Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Remove build artifacts, add .gitignore Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Add explicit truncated content assertion in SuffixTruncatedWhenTooSmall test Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/9996d741-248e-4e58-8689-b4ba873cfaf2 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Apply suggestions from code review Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Update rrdEventProcess.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Update rrdJsonParser.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdUnitTestRunner.cpp Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Delete .gitignore Delete src/unittest/UTJson/device.properties Update rrdEventProcess.c Add gtest tests for split_issue_type, suffix field, and processIssueTypeEvent Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/76cad72a-f67f-4c05-8fb5-bfadf0c173b3 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Delete .gitignore Validate suffix prefix: only _Search- and _LogSearch- are allowed Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/125526c2-7b70-48f5-8bec-fd725eea8a04 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Base never contains underscore: split at first _ and discard invalid suffix Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/904bf10d-546b-4038-a60c-9bc76094a225 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdEventProcess.c Update rrdUnitTestRunner.cpp Update rrdEventProcess.c Update rrdEventProcess.c Fix segfault in GTEST_ENABLE mode when rbuf->jsonPath is NULL Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/efdc0d6b-89e6-4423-b202-a900f5683839 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Remove accidentally committed dummy directory and update .gitignore Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/efdc0d6b-89e6-4423-b202-a900f5683839 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Fix IssueTypeSplitterTest to match new issueTypeSplitter behavior (no built-in special-char removal) Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/00abcaba-8a41-4b88-ae12-07b5ff780ff9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Fix empty/whitespace IssueType bypassing processIssueTypeEvent guards Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/4de31e24-70d8-496c-ac6a-a5376771d936 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> fix: preserve hyphens in archive filename so portal can parse it correctly rrd_logproc_convert_issue_type() was converting '-' to '_', turning the suffix '_Search-67768-67' into '_SEARCH_67768_67'. This added extra '_' separators into the archive filename that broke the analytics portal's filename parser — it could no longer identify the timestamp field, so download requests used an incorrect S3 key. Fix: keep '-' as '-' in the sanitized output. The archive filename now uses '_' to separate structural fields (MAC, issueType, timestamp) and '-' within the UUID suffix, giving the portal a reliable delimiter. Also increase issue_type_sanitized buffer in uploadRRDLogs.c from 64 to 256 bytes so a full UUID suffix never causes a silent truncation failure. Before: 04B86A12F9F8_DEVICE_DEVICEIP_SEARCH_67768_67_<timestamp>_RRD_DEBUG_LOGS.tgz After: 04B86A12F9F8_DEVICE_DEVICEIP_SEARCH-67768-67_<timestamp>_RRD_DEBUG_LOGS.tgz All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/981b6bc1-c9d2-4150-9e9d-851004942ffc Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> fix: replace _Search-/_LogSearch- prefix check with suffix length <= 9 rule split_issue_type() now discards any suffix whose total length (including the leading '_') exceeds 9 characters. The old _Search-/_LogSearch- prefix validation is removed entirely. Rule: strlen(underscore) <= 9 → suffix accepted strlen(underscore) > 9 → suffix discarded This means: - Short session tokens (e.g. "_ab12345", 8 chars) are carried through - Long UUID-based suffixes like "_Search-b6877385-...) are discarded, preventing extra '_' delimiters from breaking the portal filename parser Affected tests updated: - UnderscoreSplitsBaseAndSuffix : uses a short accepted suffix - MultipleUnderscoresSplitsAtFirst: "_def_ghi" (8 chars) now kept - BaseTruncatedWhenTooSmall / ExactFitBase: "_suffix" (7 chars) now kept - SuffixTruncatedWhenTooSmall: uses 9-char suffix with 5-byte buffer - OnlyUnderscoreInput: "_" (1 char) now kept - LogSearchSuffixIsValid → NineCharSuffixIsAccepted (boundary test) - SearchSuffixIsValid → LongSuffixIsDiscarded - InvalidSuffixPrefixDiscarded / SearchWithoutHyphenIsInvalid / LogSearchWithoutHyphenIsInvalid: updated comments (same outcomes) - ProcessIssueTypeEvntTest comments updated to reflect new rule All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> refactor: improve RRD_MAX_SUFFIX_LEN comment and rename length-based tests - Expand the RRD_MAX_SUFFIX_LEN comment to explain why 9 chars is the limit - Rename misleading test names that referenced old prefix-based validation: InvalidSuffixPrefixDiscarded → SuffixExceedingMaxLengthDiscarded SearchWithoutHyphenIsInvalid → SuffixSeventeenCharsDiscarded LogSearchWithoutHyphenIsInvalid → SuffixTwentyCharsDiscarded - LongSuffixIsDiscarded: switch to a neutral _1234567890 example so the test does not imply any Search-specific behavior All 331 tests pass. Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/c6d6fc29-da2a-46af-a417-c2de67a18448 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdJsonParser.c Update uploadRRDLogs.c Update uploadRRDLogs.c Update rrdJsonParser.c Delete .gitignore Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdEventProcess.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdJsonParser.c Update rrdEventProcess.c sanitize split_issue_type suffix to [A-Za-z0-9_-] to prevent injection Agent-Logs-Url: https://github.com/rdkcentral/remote_debugger/sessions/72e164ed-ae53-4076-8fb1-5ff1e21375e9 Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Update rrdEventProcess.c Delete .gitignore Update rrdRunCmdThread.c Update rrdRunCmdThread.h Delete src/unittest/UTJson/device.properties Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> Update rrdRunCmdThread.c Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
RDK-60236 : Remote Debugger Supports UUID Information in Debug Report File
RRD release 1.3.4 for UUID fix
Create L2-tests.yml
Update cov_build.sh
Update remote_debugger.json
Create uploadRRDL2Logs.sh
Update uploadRRDL2Logs.sh
Create run_l2.sh
Create rrd_start_control.feature
Create test_rrd_start_control.py
Create rrd_single_instance.feature
Create rrd_start_subscribe_and_wait.feature
Create test_rrd_start_subscribe_and_wait.py
Create test_rrd_single_instance.py
Create helper_functions.py
Update run_l2.sh
Update L2-tests.yml
Update run_l2.sh
Delete scripts/uploadRRDL2Logs.sh
Update rrd_start_control.feature
RDK-56099: Pytest L2 Implementation Code Changes
Add L2 test cases for following scenarios
Update remote_debugger.json
Create systemd-run
Update run_l2.sh
Create rrd_background_cmd_static_profile_report.feature
Create test_rrd_background_cmd_static_profile_report.py
Update uploadRRDLogs.sh
Update helper_functions.py
Update run_l2.sh