Skip to content

RDKEMW-23527 : Inherit extract-sha-cve bbclass for CVE support - Addition of CVE middleware paths - #164

Open
jomothomas wants to merge 12 commits into
developfrom
feature/RDKOSS974Demo
Open

jomothomas wants to merge 12 commits into
developfrom
feature/RDKOSS974Demo

Conversation

@jomothomas

@jomothomas jomothomas commented Aug 11, 2026

Copy link
Copy Markdown

This PR adds the CVE feed paths to Middleware which get SHA256 checksums

Changes:

Addition of the CVE feedback paths for middleware artifacts corresponding to IPK feeds
Added CVE_LAYER_COMMON_PATH_MIDDLEWARE for usage in local conf

@jomothomas
jomothomas requested a review from a team as a code owner August 11, 2026 17:28
Copilot AI lite review requested due to automatic review settings August 11, 2026 17:28

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.

Pull request overview

This PR extends the machine include configuration to add CVE feed artifact URLs alongside existing middleware IPK feed URIs, aiming to expose CVE tarballs for middleware artifacts.

Changes:

  • Appends middleware CVE tarball entries to CVE_LAYER_FEED_PATH for the base middleware feed and the OSS middleware feed.
  • Adds an include of conf/dynamic_sha.inc (presumably to provide per-artifact SHA256 values).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
conf/machine/include/oss_mw.inc Adds an OSS middleware CVE feed entry and includes conf/dynamic_sha.inc.
conf/machine/include/middleware.inc Adds a middleware CVE feed entry, includes OSS middleware include conditionally, and includes conf/dynamic_sha.inc.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread conf/machine/include/oss_mw.inc Outdated
Comment thread conf/machine/include/oss_mw.inc Outdated
Comment thread conf/machine/include/middleware.inc Outdated
Comment thread conf/machine/include/middleware.inc Outdated
Copilot AI review requested due to automatic review settings August 12, 2026 21:41

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (4)

conf/machine/include/middleware.inc:19

  • This file includes conf/dynamic_sha.inc, but that file is not present anywhere in the repository, so SHA population (and/or parsing) won’t work as intended. Either add conf/dynamic_sha.inc in this PR (defining the referenced *_SHA256SUM vars), or update the include to point to the correct existing file.
include conf/dynamic_sha.inc

conf/machine/include/oss_mw.inc:11

  • This file includes conf/dynamic_sha.inc, but that file is not present anywhere in the repository. If this include is meant to define MW_OSS_SHA256SUM, it needs to be added in this PR or the include path corrected.
include conf/dynamic_sha.inc

conf/machine/include/oss_mw.inc:8

  • CVE_LAYER_COMMON_PATH_MIDDLEWARE is already set in middleware.inc, so using ?= here means the OSS CVE feed can end up using the non-OSS path. Also, the CVE tarball URL here doesn’t mirror the OSS IPK layout (missing /${MW_OSS}/), and the filename appends -middleware twice because MW_OSS already includes that suffix.
CVE_LAYER_COMMON_PATH_MIDDLEWARE ?= "${MW_OSS_IPK_PATH}"
MW_OSS_IPK_SERVER_PATH = "${RDK_ARTIFACTS_BASE_URL}/${MW_OSS_IPK_PATH}/${RDK_MW_ARCH}/${MW_OSS}/ipks/${BUILD_VARIANT}"
CVE_LAYER_FEED_PATH += " ${MW_OSS}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/debug/${MW_OSS}-middleware.tgz;sha256sum=${MW_OSS_SHA256SUM}"

conf/machine/include/middleware.inc:13

  • MIDDLEWARE_ARCH_SHA256SUM is not defined anywhere in this layer (it only appears in this new reference), so the generated feed entry will likely contain an empty sha256sum= value. If the SHA is optional, it should be conditionally appended; if it’s required, it needs to be defined (e.g., via an included .inc that is actually present).
CVE_LAYER_FEED_PATH += " ${MIDDLEWARE_ARCH}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/debug/${MIDDLEWARE_ARCH}.tgz;sha256sum=${MIDDLEWARE_ARCH_SHA256SUM}"

Copilot AI review requested due to automatic review settings August 13, 2026 19:32

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.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Suppressed comments (3)

conf/machine/include/middleware.inc:13

  • This layer currently has no conf/dynamic_sha.inc (and there are no other definitions of *_SHA256SUM variables in this repo), but the new CVE feed URL appends ;sha256sum=${MIDDLEWARE_ARCH_SHA256SUM}. Unless another layer in the build provides conf/dynamic_sha.inc and defines these variables, the checksum parameter will expand empty, which can break CVE feed consumers. Ensure the checksum include file is actually provided (or define the SHA256SUM variables in this layer) and consider using require if the file is mandatory.
CVE_LAYER_FEED_PATH += " ${MIDDLEWARE_ARCH}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/debug/${MIDDLEWARE_ARCH}.tgz;sha256sum=${MIDDLEWARE_ARCH_SHA256SUM}"

conf/machine/include/oss_mw.inc:8

  • CVE_LAYER_COMMON_PATH_MIDDLEWARE is also set in middleware.inc (line 11) with ?=; when oss_mw.inc is included from middleware.inc, this ?= will not override it. As a result, overriding MW_OSS_IPK_PATH will not affect the OSS CVE feed URL here (it will keep using the non-OSS path). Use a distinct variable for the OSS CVE common path (or an override) and reference that in CVE_LAYER_FEED_PATH.
CVE_LAYER_COMMON_PATH_MIDDLEWARE ?= "${MW_OSS_IPK_PATH}"
MW_OSS_IPK_SERVER_PATH = "${RDK_ARTIFACTS_BASE_URL}/${MW_OSS_IPK_PATH}/${RDK_MW_ARCH}/${MW_OSS}/ipks/${BUILD_VARIANT}"
CVE_LAYER_FEED_PATH += " ${MW_OSS}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/debug/${MW_OSS}.tgz;sha256sum=${MW_OSS_SHA256SUM}"

conf/machine/include/oss_mw.inc:11

  • oss_mw.inc is only included from middleware.inc in this layer, and middleware.inc already includes conf/dynamic_sha.inc (line 19). Including it again here causes the file to be parsed twice and risks duplicate/overriding variable definitions; keep the include in one place.
include conf/dynamic_sha.inc

@jomothomas jomothomas changed the title Feature/rdkoss974 demo RDKOSS-954: Auto generated CVE reports-Addition of CVE middleware paths and customizable middleware CVE folder Aug 14, 2026
@jomothomas jomothomas changed the title RDKOSS-954: Auto generated CVE reports-Addition of CVE middleware paths and customizable middleware CVE folder RDKEMW-23527 : Inherit extract-sha-cve bbclass for CVE support - Addition of CVE middleware paths Aug 14, 2026
Copilot AI review requested due to automatic review settings September 10, 2026 11:02

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 shared CVE_LAYER_COMMON_PATH_MIDDLEWARE defaulting is order-dependent between includes and can yield incorrect CVE feed URLs when middleware and OSS paths diverge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review details

Suppressed comments (2)

conf/machine/include/oss_mw.inc:26

  • CVE_LAYER_COMMON_PATH_MIDDLEWARE is being defaulted here based on MW_OSS_IPK_PATH, but it is also defaulted in middleware.inc based on MW_IPK_PATH. Because oss_mw.inc is included from middleware.inc earlier in parse order, whichever file runs first will “win”, which can produce incorrect CVE feed URLs if MW_IPK_PATH and MW_OSS_IPK_PATH are ever set differently. Consider setting this default in only one place, or using separate variables (e.g., CVE_LAYER_COMMON_PATH_MIDDLEWARE and CVE_LAYER_COMMON_PATH_MWOSS).
    if d.getVar("CVE_CHECK_ENABLED") == "1":
        if not d.getVar("CVE_LAYER_COMMON_PATH_MIDDLEWARE"):
            d.setVar("CVE_LAYER_COMMON_PATH_MIDDLEWARE", "${MW_OSS_IPK_PATH}")

        d.setVar("CVE_FEED_URL_MWOSS", "${MW_OSS}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/${BUILD_VARIANT}/${MW_OSS}.tgz")
        d.appendVar("CVE_LAYER_FEED_PATH", " ${CVE_FEED_URL_MWOSS};sha256sum=${MW_OSS_SHA256SUM}")

conf/machine/include/middleware.inc:34

  • CVE_LAYER_COMMON_PATH_MIDDLEWARE is defaulted here from MW_IPK_PATH, but it is also defaulted in oss_mw.inc from MW_OSS_IPK_PATH. Since oss_mw.inc is included earlier in this file, its defaulting can take precedence, leading to an unexpected CVE feed path for the non-OSS middleware feed when these paths diverge. Consider defaulting the shared path in a single place, or use distinct override variables per feed.
    if d.getVar("CVE_CHECK_ENABLED") == "1":
        if not d.getVar("CVE_LAYER_COMMON_PATH_MIDDLEWARE"):
            d.setVar("CVE_LAYER_COMMON_PATH_MIDDLEWARE", "${MW_IPK_PATH}")

        d.setVar("CVE_FEED_URL_MIDDLEWARE", "${MIDDLEWARE_ARCH}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/${RDK_MW_ARCH}/tarball/cve/${BUILD_VARIANT}/${MIDDLEWARE_ARCH}.tgz")
        d.appendVar("CVE_LAYER_FEED_PATH", " ${CVE_FEED_URL_MIDDLEWARE};sha256sum=${MIDDLEWARE_ARCH_SHA256SUM}")
  • Files reviewed: 2/2 changed files
  • Comments generated: 2
  • Review effort level: Lite

Comment on lines +18 to +22
#The following section will be only enabled if CVE_CHECK is set

# Check whether CVE-check is globally inherited
CVE_CHECK_ENABLED = "${@bb.utils.contains('INHERIT', 'cve-check', '1', '0', d)}"

Comment on lines +10 to +13
#The following section will be only enabled if CVE_CHECK is set

# Check whether CVE-check is globally inherited
CVE_CHECK_ENABLED = "${@bb.utils.contains('INHERIT', 'cve-check', '1', '0', d)}"
Copilot AI review requested due to automatic review settings September 11, 2026 16:47

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.

🔵 Needs a closer look

Moderate issues remain around duplicate inclusion and the undeclared dynamic SHA provider dependency.

Review details

Suppressed comments (3)

conf/machine/include/middleware.inc:25

  • When STACK_LAYER_OSS_SUPPORT is enabled, middleware.inc includes oss_mw.inc at line 16, so conf/dynamic_sha.inc is included once from oss_mw.inc and then included again here. BitBake does not deduplicate include directives; any anonymous Python, task, or variable side effects in that externally supplied file can therefore be applied twice and duplicate the SHA/feed setup. Keep this include in one common location (or explicitly guard the second include) so OSS configurations parse it only once.
CVE_CONF_INCLUDE = "${@bb.utils.contains('CVE_CHECK_ENABLED', '1', 'conf/dynamic_sha.inc', '', d)}"
include ${CVE_CONF_INCLUDE}

conf/machine/include/middleware.inc:25

  • When CVE checking is enabled, this include relies on conf/dynamic_sha.inc being supplied by the external auxiliary layer, but this layer's conf/layer.conf still declares only core in LAYERDEPENDS_middleware-release. A consumer can therefore enable this layer and cve-check without the provider, leaving the checksum variables unavailable and the CVE feed configuration broken. Add the provider to the layer dependency (or otherwise make that dependency explicit) with this change.
CVE_CONF_INCLUDE = "${@bb.utils.contains('CVE_CHECK_ENABLED', '1', 'conf/dynamic_sha.inc', '', d)}"
include ${CVE_CONF_INCLUDE}

conf/machine/include/oss_mw.inc:17

  • This CVE-enabled path also depends on conf/dynamic_sha.inc from the external auxiliary layer, while conf/layer.conf declares only core in LAYERDEPENDS_middleware-release. Without the provider layer, the checksum variable used below is unavailable and the OSS CVE feed is invalid. Add the provider to the layer dependency or make that dependency explicit.
CVE_CONF_INCLUDE = "${@bb.utils.contains('CVE_CHECK_ENABLED', '1', 'conf/dynamic_sha.inc', '', d)}"
include ${CVE_CONF_INCLUDE}
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 13, 2026 21:21

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.

🔵 Needs a closer look

Unresolved dependency, variable-expansion, and architecture-path issues block approval.

Review details

Suppressed comments (5)

conf/machine/include/middleware.inc:25

  • This new parse-time include depends on conf/dynamic_sha.inc being supplied by another layer, but conf/layer.conf:8 still declares only core as a dependency. A build that enables CVE checking without the auxiliary layer will fail while parsing this file; declare the provider layer in LAYERDEPENDS or keep the include in this layer.
CVE_CONF_INCLUDE = "${@bb.utils.contains('CVE_CHECK_ENABLED', '1', 'conf/dynamic_sha.inc', '', d)}"
include ${CVE_CONF_INCLUDE}

conf/machine/include/middleware.inc:29

  • CVE_CHECK_ENABLED is assigned with a lazy ${@...} expansion, but getVar is called without the expansion flag here. In BitBake this compares the raw expression with "1", so even when cve-check is inherited this block is skipped and the middleware CVE feed is never appended. Read the variable with expansion (or test INHERIT directly).
    if d.getVar("CVE_CHECK_ENABLED") == "1":

conf/machine/include/oss_mw.inc:17

  • This OSS-specific include also requires the externally provided conf/dynamic_sha.inc, while conf/layer.conf:8 declares only core. Without the auxiliary layer on BBPATH, enabling CVE checking makes OSS configurations fail at parse time; declare the provider layer as a dependency or vendor the include here.
CVE_CONF_INCLUDE = "${@bb.utils.contains('CVE_CHECK_ENABLED', '1', 'conf/dynamic_sha.inc', '', d)}"
include ${CVE_CONF_INCLUDE}

conf/machine/include/oss_mw.inc:21

  • CVE_CHECK_ENABLED is assigned with a lazy ${@...} expansion, but getVar is called without the expansion flag here. In BitBake this compares the raw expression with "1", so even when cve-check is inherited this block is skipped and the OSS middleware CVE feed is never appended. Read the variable with expansion (or test INHERIT directly).
    if d.getVar("CVE_CHECK_ENABLED") == "1":

conf/machine/include/oss_mw.inc:25

  • MW_OSS is derived from get_oss_arch(d) and is used as the feed architecture, but this URL hard-codes the rdk-arm7ve tarball name. For any other supported OSS architecture, the feed key and artifact path will refer to different artifacts (or a nonexistent file), so build the filename from the same architecture variable instead.
        d.setVar("CVE_FEED_URL_MWOSS", "${MW_OSS}##${RDK_ARTIFACTS_BASE_URL}/${CVE_LAYER_COMMON_PATH_MIDDLEWARE}/xione-uk/tarball/cve/${BUILD_VARIANT}/rdk-arm7ve-oss-middleware.tgz")
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 15, 2026 11:46

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.

🟢 Approval recommended

No unresolved review issues were identified.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Copilot AI review requested due to automatic review settings September 15, 2026 13:36

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.

🟢 Approval recommended

No unresolved issues were identified, and the changes are assessed as ready for approval.

Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

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.

3 participants