Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions classes/rdkv-community-configs.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ install_community_rfc_configs() {
if [ -f "${MANIFEST_PATH_RDK_IMAGES}/conf/community-rfc-configs.ini" ]; then
bbnote "Installing community RFC configs..."
install -D -m 0644 ${MANIFEST_PATH_RDK_IMAGES}/conf/community-rfc-configs.ini ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
if [ -n "${DAC_APPSTORE_URL}" ]; then
echo "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=${DAC_APPSTORE_URL}" >> ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The DAC_APPSTORE_URL variable is used directly in the echo command without validation or quoting. If the URL contains special shell characters (like semicolons, pipes, backticks, or dollar signs), this could lead to command injection or malformed configuration. Consider validating the URL format or properly quoting the variable expansion to prevent potential security issues.

Suggested change
echo "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=${DAC_APPSTORE_URL}" >> ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
# Validate DAC_APPSTORE_URL to avoid unsafe shell characters that could trigger command substitution.
if printf '%s' "${DAC_APPSTORE_URL}" | grep -q '[$`]' ; then
bbwarn "DAC_APPSTORE_URL contains unsafe characters (\$ or \`). Skipping DAC configuration."
else
printf 'Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=%s\n' "${DAC_APPSTORE_URL}" >> ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
fi

Copilot uses AI. Check for mistakes.
Comment on lines 25 to +27
Copy link

Copilot AI Feb 27, 2026

Choose a reason for hiding this comment

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

The code appends to the configuration file without ensuring the file ends with a newline. If the source file community-rfc-configs.ini doesn't end with a newline, the appended line will be concatenated to the last line of the file, potentially creating an invalid configuration. Consider adding a newline before appending, or checking if the file ends with a newline first.

Suggested change
install -D -m 0644 ${MANIFEST_PATH_RDK_IMAGES}/conf/community-rfc-configs.ini ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
if [ -n "${DAC_APPSTORE_URL}" ]; then
echo "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=${DAC_APPSTORE_URL}" >> ${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
config_file=${IMAGE_ROOTFS}/etc/rfcdefaults/community-rfc-configs.ini
install -D -m 0644 ${MANIFEST_PATH_RDK_IMAGES}/conf/community-rfc-configs.ini "${config_file}"
if [ -n "${DAC_APPSTORE_URL}" ]; then
# Ensure the config file ends with a newline before appending
if [ -s "${config_file}" ] && [ -n "$(tail -c1 "${config_file}" 2>/dev/null)" ]; then
echo >> "${config_file}"
fi
echo "Device.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=${DAC_APPSTORE_URL}" >> "${config_file}"

Copilot uses AI. Check for mistakes.
else
bbwarn "DAC_APPSTORE_URL is not set. Skipping DAC configuration."
fi
fi
}

Expand Down