Skip to content

rebase#47

Open
nhanasi wants to merge 136 commits intofeature/RDK-49249-devfrom
develop
Open

rebase#47
nhanasi wants to merge 136 commits intofeature/RDK-49249-devfrom
develop

Conversation

@nhanasi
Copy link
Copy Markdown
Contributor

@nhanasi nhanasi commented Feb 14, 2025

  • 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

nhanasi and others added 3 commits February 5, 2025 21:54
* 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
@nhanasi nhanasi requested a review from a team as a code owner February 14, 2025 16:01
@nhanasi nhanasi requested a review from a team February 14, 2025 16:01
nhanasi and others added 12 commits February 14, 2025 14:43
* 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
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 18, 2025

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
5 out of 6 committers have signed the CLA.

✅ AravindanNC
✅ Abhinavpv28
✅ Alan-Ryan
✅ nhanasi
✅ venkat0557
❌ naveenkumarhanasi
You have signed the CLA already but the status is still pending? Let us recheck it.

Abhinavpv28 and others added 12 commits February 19, 2025 14:37
Correct the duplicate functions and add more logcheck
Correct the duplicate functions and add more logcheck
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>
This reverts commit 842bf96.
* 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
Alan-Ryan and others added 6 commits September 29, 2025 14:34
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>
… 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
Copilot AI review requested due to automatic review settings December 4, 2025 23:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment on lines +125 to +126
SCRIPT_SUCCESS = "Debug Information Report upload Failed"
SCRIPT_FAILURE = "Debug Information Report upload Success"
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "shopuld" should be "should"

Copilot uses AI. Check for mistakes.
ISSUE_STRING = "Device.Info"

CATEGORY_STRING = "Device"
HARMFULL_STRING = "Command.Harm"
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo: "harmfull" should be "harmful"

Copilot uses AI. Check for mistakes.
if '.' in BACKGROUND_STRING:
ISSUE_NODE, ISSUE_SUBNODE = BACKGROUND_STRING.split('.')
else:
node = BACKGROUND_STRING
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable node is not used.

Copilot uses AI. Check for mistakes.
ISSUE_NODE, ISSUE_SUBNODE = BACKGROUND_STRING.split('.')
else:
node = BACKGROUND_STRING
subnode = None
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable subnode is not used.

Copilot uses AI. Check for mistakes.
# limitations under the License.
##########################################################################

import json
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'json' is not used.

Copilot uses AI. Check for mistakes.
# limitations under the License.
##########################################################################

import json
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'json' is not used.

Copilot uses AI. Check for mistakes.
# limitations under the License.
##########################################################################

import json
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'json' is not used.

Copilot uses AI. Check for mistakes.
# limitations under the License.
##########################################################################

import json
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import of 'json' is not used.

Copilot uses AI. Check for mistakes.
Comment on lines +40 to +55
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
Copy link

Copilot AI Dec 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
* 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.
@github-actions
Copy link
Copy Markdown

github-actions bot commented Jan 12, 2026


Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I have read the CLA Document and I hereby sign the CLA


9 out of 10 committers have signed the CLA.
nhanasi
Abhinavpv28
shibu-kv
venkat0557
AravindanNC
scthunderbolt
santoshcomcast
madhubabutt
Saranya2421
Shibu Kakkoth Vayalambron
Shibu Kakkoth Vayalambron seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You can retrigger this bot by commenting recheck in this Pull Request. Posted by the CLA Assistant Lite bot.

* 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>
Copilot AI review requested due to automatic review settings January 21, 2026 19:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "shopuld" should be "should" in this feature file scenario description.

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The spelling "commmand" has an extra 'm' and should be "command".

Copilot uses AI. Check for mistakes.
if '.' in ISSUE_STRING:
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable node is not used.

Copilot uses AI. Check for mistakes.
ISSUE_NODE, ISSUE_SUBNODE = ISSUE_STRING.split('.')
else:
node = ISSUE_STRING
subnode = None
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable subnode is not used.

Copilot uses AI. Check for mistakes.
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"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable ISSUE_FOUND is not used.

Copilot uses AI. Check for mistakes.
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"
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Variable ISSUE_FOUND is not used.

Copilot uses AI. Check for mistakes.
# limitations under the License.
##########################################################################

from helper_functions import *
Copy link

Copilot AI Jan 21, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import pollutes the enclosing namespace, as the imported module helper_functions does not define 'all'.

Copilot uses AI. Check for mistakes.
nhanasi and others added 4 commits January 22, 2026 19:45
…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>
Copilot AI review requested due to automatic review settings February 17, 2026 16:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 98 out of 98 changed files in this pull request and generated 3 comments.

Comment on lines +125 to +132
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")
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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".

Copilot uses AI. Check for mistakes.
Comment on lines 67 to 73
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;
}
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
UPLOAD_MSG = "Skip uploading Debug Report"
assert UPLOAD_MSG in grep_rrdlogs(UPLOAD_MSG)

#remove_logfile()
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commented out remove_logfile() line at line 104 should either be uncommented or removed. Leaving commented code reduces code clarity.

Copilot uses AI. Check for mistakes.
madhubabutt and others added 4 commits February 25, 2026 15:11
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
Copilot AI review requested due to automatic review settings March 20, 2026 19:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

  • checkcmd returned by cJSON_Print is 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 for cJSON_free, operate on a separate pointer/temporary buffer when trimming quotes/spaces, and also handle the case where cJSON_Print returns NULL before calling strlen.
         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;
         }

Comment on lines +125 to +130
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 456 to +468
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);
}
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Copilot uses AI. Check for mistakes.
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
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
chmod -R 777 /lib/rdk/uploadRRDLogs.sh
chmod -R 777 /lib/rdk/uploadSTBLogs.sh

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +154
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +149 to +154
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +196 to +201
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +140 to +145
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +163 to +168
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")
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 256 to +290
@@ -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);
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +191 to +197
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) {
Copy link

Copilot AI Mar 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.