RDKMVE-1815: add support for populating DAC AppStore URL in RFC from DAC_APPSTORE_URL#93
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a build-time hook in the community RFC defaults installation step to optionally populate a DAC AppStore ConfigURL from the DAC_APPSTORE_URL BitBake variable, so images can embed a deployment-specific URL without modifying the checked-in community-rfc-configs.ini.
Changes:
- When installing
community-rfc-configs.iniinto the rootfs, appendDevice.DeviceInfo.X_RDKCENTRAL-COM_RFC.DAC.ConfigURL=<value>ifDAC_APPSTORE_URLis non-empty.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 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 |
There was a problem hiding this comment.
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.
| 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 |
| 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 |
There was a problem hiding this comment.
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.
| 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}" |
No description provided.