Skip to content

RDKEMW-28109: Fix high severity security findings in sysint scripts - #644

Open
sanalachary wants to merge 1 commit into
developfrom
feature/RDKEMW-28109-sysint-high-findings
Open

sanalachary wants to merge 1 commit into
developfrom
feature/RDKEMW-28109-sysint-high-findings

Conversation

@sanalachary

Copy link
Copy Markdown

Summary

Addressed Mythos/SysInt high severity findings in:
getDeviceDetails.sh:
rdkcentral-sysint_High_007
rdkcentral-sysint_High_009
rdkcentral-sysint_High_020
rdkcentral-sysint_High_022
rdkcentral-sysint_High_023
rdkcentral-sysint_High_031
rdkcentral-sysint_High_037

getPartnerId.sh:
rdkcentral-sysint_High_026

getDeviceId.sh:
rdkcentral-sysint_High_036

getAccountId.sh:
rdkcentral-sysint_High_010

timesyncd-conf-update.sh:
rdkcentral-sysint_High_038

Changes

  • Added input validation/allowlisting where values are consumed by shell commands.
  • Replaced unsafe command constructions.
  • Improved handling of temporary file writes.
  • Hardened scripts against command injection and symlink-related issues.

@sanalachary
sanalachary requested a review from a team as a code owner November 22, 2026 05:15
Copilot AI balanced review requested due to automatic review settings November 22, 2026 05:15

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

Unresolved cache-symlink handling allows the root service to overwrite symlink targets, and the partner-ID fallback bypasses validation before entering a shell-command string.

4 open issues
What changed in this PR

This PR hardens SysInt scripts that supply device identity, metadata, firmware requests, and time-server configuration, targeting command injection and unsafe temporary-file handling.

Changes:

  • Adds allowlists for identity values, device parameters, and NTP server names.
  • Replaces signing-command eval with direct invocation and removes the temporary bootstrap-file copy.
  • Introduces atomic device-metadata writes and ownership/symlink checks.
File Description
lib/​rdk/​xconfImageCheck.sh Calls GetServiceUrl directly instead of through eval.
lib/​rdk/​timesyncd-conf-update.sh Validates NTP server names and uses fixed-string matching.
lib/​rdk/​getPartnerId.sh Validates retrieved partner IDs and suppresses TR-181 stderr.
lib/​rdk/​getDeviceId.sh Reads partner bootstrap data directly from its source.
lib/​rdk/​getDeviceDetails.sh Adds atomic writes, file trust checks, and safer cache updates.
lib/​rdk/​getAccountId.sh Replaces account-ID character checks with an allowlist.

Review effort: Balanced

Comment on lines +626 to +627
if [ -e "$deviceDetailsCache" ] || [ -L "$deviceDetailsCache" ]; then
if [ -L "$deviceDetailsCache" ] || [ ! -O "$deviceDetailsCache" ]; then
Comment thread lib/rdk/getPartnerId.sh
Comment on lines +71 to +73
case "$partnerName" in
*[!A-Za-z0-9._-]*) partnerName="" ;;
esac
*) continue ;;
esac
file="/tmp/.$param"
if [ -f "$file" ] && [ ! -L "$file" ] && [ "$(head -n 1 "$file")" != "" ]; then
if grep -q "$host" /etc/systemd/timesyncd.conf; then
# Allowlist: hostnames are interpolated into a sed program below
case "$host" in
*[!A-Za-z0-9.-]*)
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