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
Deploy fossid_integration_stateless_diffscan_target_repo action
…rget 80% [ Phase 2 ] (#157) * Update rrdInterface.c * Update rrdIarmEvents.c * Update configure.ac * Update cov_build.sh * Update remote_debugger.json * Update create_json.sh * Create Makefile * Create deepsleep_main.c --------- Co-authored-by: nhanasi <navihansi@gmail.com>
RRD 1.2.9 release
… C (#167) * Add comprehensive HLD documentation for uploadRRDLogs.sh migration to C - Requirements document with functional specs, I/O definitions, and constraints - High-Level Design with architecture, module breakdown, and data flows - Detailed flowcharts for all major operations (Mermaid + text-based) - Sequence diagrams showing component interactions - Low-Level Design with complete C code, data structures, and implementations Documentation covers migration of uploadRRDLogs.sh to embedded C program optimized for low-memory, low-CPU embedded systems with full error handling, security considerations, and platform portability. - Replace custom MAC retrieval logic with TR-181 parameters via RBus - Device.DeviceInfo.X_COMCAST-COM_STB_MAC (Video) - Device.DeviceInfo.X_COMCAST-COM_CM_MAC (Broadband) - Device.X_CISCO_COM_MACAddress (Alternative) - Add cache file fallback (/tmp/device_details.cache, /tmp/estb_mac) - Add early exit optimization in config parser when all required properties found - Mark libarchive as mandatory dependency, remove tar command fallback
There was a problem hiding this comment.
Pull request overview
This PR implements L2 (Level 2) functional testing infrastructure for the Remote Debugger component, adding comprehensive test scenarios for static/dynamic profile handling, deep sleep events, command validation, and log upload functionality.
Key Changes
- Added 20+ Python-based L2 test cases covering various remote debugger scenarios
- Implemented test infrastructure including helper functions, mock scripts, and CI workflow
- Added support for PowerManager plugin integration via Thunder client library
- Enhanced event handling with RDM download event subscription and dynamic profile management
Reviewed changes
Copilot reviewed 79 out of 79 changed files in this pull request and generated 41 comments.
Show a summary per file
| File | Description |
|---|---|
| test/functional-tests/tests/*.py | L2 test implementations for various RRD scenarios (static/dynamic profiles, harmful commands, empty events, etc.) |
| test/functional-tests/features/*.feature | Gherkin feature files defining test scenarios |
| test/functional-tests/tests/helper_functions.py | Common test utility functions for process management, file operations, and log parsing |
| test/functional-tests/tests/uploadSTBLogs.sh | Mock upload script for testing RRD log upload functionality |
| src/rrdInterface.c | Enhanced with RDM download event handler and improved event processing logic |
| src/rrdIarmEvents.c | Added PowerManager plugin support with Thunder client integration for deep sleep events |
| src/rrdDynamic.c | Refactored dynamic profile handling with RBUS integration |
| scripts/uploadRRDLogs.sh | Fixed shell script syntax and improved tr181 command availability checks |
| run_l2.sh | L2 test execution script with environment setup |
| .github/workflows/native_full_build.yml | Enhanced CI workflow with dependency checkout |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| SCRIPT_SUCCESS = "Debug Information Report upload Failed" | ||
| SCRIPT_FAILURE = "Debug Information Report upload Success" |
There was a problem hiding this comment.
The variable names SCRIPT_SUCCESS and SCRIPT_FAILURE are swapped - their associated messages are opposite to what their names suggest. SCRIPT_SUCCESS is checking for "Failed" message while SCRIPT_FAILURE is checking for "Success" message. These should be renamed to match their actual purpose.
| 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.
Typo: "shopuld" should be "should"
| ISSUE_STRING = "Device.Info" | ||
|
|
||
| CATEGORY_STRING = "Device" | ||
| HARMFULL_STRING = "Command.Harm" |
There was a problem hiding this comment.
Typo: "harmfull" should be "harmful"
| if '.' in BACKGROUND_STRING: | ||
| ISSUE_NODE, ISSUE_SUBNODE = BACKGROUND_STRING.split('.') | ||
| else: | ||
| node = BACKGROUND_STRING |
There was a problem hiding this comment.
Variable node is not used.
| ISSUE_NODE, ISSUE_SUBNODE = BACKGROUND_STRING.split('.') | ||
| else: | ||
| node = BACKGROUND_STRING | ||
| subnode = None |
There was a problem hiding this comment.
Variable subnode is not used.
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| import json |
There was a problem hiding this comment.
Import of 'json' is not used.
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| import json |
There was a problem hiding this comment.
Import of 'json' is not used.
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| import json |
There was a problem hiding this comment.
Import of 'json' is not used.
| # limitations under the License. | ||
| ########################################################################## | ||
|
|
||
| import json |
There was a problem hiding this comment.
Import of 'json' is not used.
| chmod -R 777 /lib/rdk/uploadRRDLogs.sh | ||
| 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 | ||
|
|
||
| cp scripts/systemd-run /usr/local/bin/systemd-run | ||
| chmod -R 777 /usr/local/bin/systemd-run | ||
| ln -s /usr/local/bin/systemd-run /usr/bin/systemd-run | ||
|
|
||
| touch /usr/local/bin/systemctl | ||
| chmod -R 777 /usr/local/bin/systemctl | ||
| ln -s /usr/local/bin/systemctl /usr/bin/systemctl | ||
|
|
||
| touch /usr/local/bin/journalctl | ||
| chmod -R 777 /usr/local/bin/journalctl |
There was a problem hiding this comment.
This script sets world-writable permissions (chmod -R 777) on critical executables like /lib/rdk/uploadRRDLogs.sh, /usr/local/bin/systemd-run, /usr/local/bin/systemctl, and /usr/local/bin/journalctl. On any multi-user or shared environment, an unprivileged user could modify these scripts and then wait for them to be invoked by a privileged process (e.g., during tests), gaining code execution with elevated privileges. To mitigate this, restrict permissions to the minimum required (e.g., 755 or tighter, owned by root) and avoid making system-wide executables writable by non-privileged users; if these are purely for test harnesses, place them in a non-global, test-only directory with controlled access instead of /usr/local/bin and /usr/bin.
| chmod -R 777 /lib/rdk/uploadRRDLogs.sh | |
| 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 | |
| cp scripts/systemd-run /usr/local/bin/systemd-run | |
| chmod -R 777 /usr/local/bin/systemd-run | |
| ln -s /usr/local/bin/systemd-run /usr/bin/systemd-run | |
| touch /usr/local/bin/systemctl | |
| chmod -R 777 /usr/local/bin/systemctl | |
| ln -s /usr/local/bin/systemctl /usr/bin/systemctl | |
| touch /usr/local/bin/journalctl | |
| chmod -R 777 /usr/local/bin/journalctl | |
| chmod 755 /lib/rdk/uploadRRDLogs.sh | |
| 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 755 /lib/rdk/uploadRRDLogs.sh | |
| cp scripts/systemd-run /usr/local/bin/systemd-run | |
| chmod 755 /usr/local/bin/systemd-run | |
| ln -s /usr/local/bin/systemd-run /usr/bin/systemd-run | |
| touch /usr/local/bin/systemctl | |
| chmod 755 /usr/local/bin/systemctl | |
| ln -s /usr/local/bin/systemctl /usr/bin/systemctl | |
| touch /usr/local/bin/journalctl | |
| chmod 755 /usr/local/bin/journalctl |
* RDK-58172: integrate dcm-agent uploadstblogs and cleanup logging; update Makefile and upload flow * Add unit tests for RRD upload orchestration This file contains unit tests for the RRD upload orchestration, covering various aspects such as configuration loading, system information retrieval, log directory validation, and the entire upload workflow. * Update Makefile.am * Remove uploadRRDLogs program from Makefile * Refactor uploadDebugoutput to use upload API Updated the uploadDebugoutput function to call the upload API instead of executing a script. Enhanced logging for upload orchestration success and failure. * Refactor upload orchestration into rrd_upload_orchestrate Refactor upload orchestration logic into a separate function and remove deprecated main function. * Update rrd_config.h * Include common_device_api.h in rrd_sysinfo.h Added inclusion of common_device_api.h for device API access. * Add comprehensive functional tests for C API upload orchestration - Add BDD feature file with 20 test scenarios for rrd_upload_orchestrate - Add Python test implementation with 14 test functions - Test coverage includes: * Valid and invalid parameter handling * Configuration loading from multiple sources (properties, RFC, DCM) * MAC address retrieval and timestamp generation * Issue type sanitization and normalization * Archive creation and format validation * Upload execution and lock handling * Cleanup operations * Error code propagation (codes 1-11) * Comprehensive logging verification * Integration with uploadDebugoutput wrapper - Tests validate the complete flow from event trigger through C API execution to upload completion - Helper class provides utilities for test setup, archive validation, and log verification Refactor source validation and log handling. Improve error handling for directory operations and add functionality to move live logs. * Refactor log upload handling and cleanup process Updated log upload process to handle LOGUPLOAD_ENABLE case and adjusted archive creation and upload paths.
|
I have read the CLA Document and I hereby sign the CLA 9 out of 10 committers have signed the CLA. |
* RDKEMW-12334-The log entries in remote-debugger.log RDKEMW-12334-The log entries in remote-debugger.log differ between C binary files and script files when compared * Change the log from Debug to Info * Apply suggestions from code review Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Abhinavpv28 <162570454+Abhinavpv28@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
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