Skip to content

RDKEMW-28050 Mitigate Frontier AI Scan for system maintenance scripts - #643

Open
MV-1970 wants to merge 2 commits into
developfrom
feature/RDKEMW-28050
Open

MV-1970 wants to merge 2 commits into
developfrom
feature/RDKEMW-28050

Conversation

@MV-1970

@MV-1970 MV-1970 commented Nov 12, 2026

Copy link
Copy Markdown

Reason for change:

  • Validate cron entries to reject dangerous shell characters (&, |, ;)
  • Escape special characters in sed expressions for safe path/name matching
  • Use literal grep search to prevent pattern interpretation
  • Quote process names to prevent word splitting in grep commands
  • Validate DCMSettings.conf is not a symlink and URL format is valid

Reason for change:
- Validate cron entries to reject dangerous shell characters (&, |, ;)
- Escape special characters in sed expressions for safe path/name matching
- Use literal grep search to prevent pattern interpretation
- Quote process names to prevent word splitting in grep commands
- Validate DCMSettings.conf is not a symlink and URL format is valid
@MV-1970
MV-1970 requested a review from a team as a code owner November 12, 2026 11:51
Copilot AI balanced review requested due to automatic review settings November 12, 2026 11:51

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The cron updater continues after lock-acquisition failure, allowing concurrent runs to overwrite shared state and install incomplete or stale crontabs.

5 open issues
What changed in this PR

This PR hardens RDK system maintenance scripts against unsafe shell input and file handling, addressing Frontier AI scan findings under RDKEMW-28050.

Changes:

  • Adds cron-entry restrictions, literal lookup, sed escaping, and a lock timeout.
  • Adds log-upload configuration checks and changes the fallback protocol to HTTPS.
  • Improves quoting in core cleanup and replaces the warehouse-reset cleanup pipeline with find.
File Description
lib/​rdk/​warehouse-reset.sh Uses find to remove configuration files while preserving receiver.conf.
lib/​rdk/​Start_MaintenanceTasks.sh Adds symlink and URL checks plus an HTTPS default.
lib/​rdk/​cronjobs_update.sh Adds input restrictions, matching safeguards, quoting, and lock handling changes.
lib/​rdk/​core_shell.sh Quotes process-name searches and core-file removal paths.

Review effort: Balanced

Comment thread lib/rdk/cronjobs_update.sh Resolved
Comment thread lib/rdk/Start_MaintenanceTasks.sh Resolved
Comment thread lib/rdk/cronjobs_update.sh Resolved
Comment thread lib/rdk/cronjobs_update.sh Resolved
Comment thread lib/rdk/cronjobs_update.sh Resolved
Copilot AI balanced review requested due to automatic review settings November 13, 2026 10:54

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Cron validation still allows pipes that can execute additional commands, while maintenance handling continues to read rejected symlinks and accepts malformed upload URLs.

2 open issues
1 previously missed issue

In code that hasn't changed since last review

Medium severity Validate the complete HTTP(S) URL and require a host

lib/​rdk/​Start_MaintenanceTasks.sh:156

This validates only the scheme prefix: malformed values such as https:// pass and are forwarded to logupload as valid destinations. Validate a complete, single HTTP(S) URL with a nonempty host before assigning it, so malformed configuration takes the invalid-URL path instead of reaching the uploader.

4 resolved since last review

Review effort: Balanced

Comment thread lib/rdk/cronjobs_update.sh Resolved
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.

2 participants