cve-update-nvd2-native: allow setting resultsPerPage
PATCH 1/1 cve-update-nvd2-native: allow setting resultsPerPage
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
meta/recipes-core/meta/cve-update-nvd2-native.bb +14 -0
@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before giving up CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is 2000. +# Lowering this value can help avoid incomplete read errors during bulk NVD updates. +CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?= "${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}" CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"
@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d, database_time): api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max = int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX")) + if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of %d, capping" % results_per_page_max) + results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:
Signature · 1 line
2.34.1
Hello,
Thanks for looking at this!
Quoted 8 lines · Awais Belal via lists.openembedded.org
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
What value are you using? Especially in the last few days...
Quoted 23 lines
Signed-off-by Awais B <[email protected]>--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)meta/recipes-core/meta/cve-update-nvd2-native.bb +5
-0@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before giving up CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is 2000. +# Lowering this value can help avoid incomplete read errors during bulk NVD updates. +CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?= "${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}" CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time): · line 226
Quoted 5 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d, database_time): api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max = int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX"))
I'm not sure CVE_DB_RESULTS_PER_PAGE_MAX should be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.
Quoted 10 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +7
-0+ if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of %d, capping" % results_per_page_max) + results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:
Signature · 2 lines
Yoann Congal Smile ECS
Hi Yoann,
Thanks for picking this up
Quoted 1 line
What value are you using? Especially in the last few days...
I've seen much better results with a cap of 500/1000 than the default of 2000.
Quoted 4 lines
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.
Well it is a valid request parameter for starters. This allows the users to control it from the configurations rather than hard coding to any limits someone sees fitting for their environment so more flexibility. Not setting the variable defaults to the limits recommended by NVD however my analysis shows that these days due to bulk updates on the NVD side the fetch has failed most of the time due to an "incomplete read" error.
Quoted 73 lines · Yoann Congal
Hello,
Thanks for looking at this!
Quoted 8 lines · Awais Belal via lists.openembedded.org
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
What value are you using? Especially in the last few days...
Review
Quoted 7 lines
Signed-off-by Awais B <[email protected]>--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)(quoted diff) +0
-0b/meta/recipes-core/meta/cve-update-nvd2-native.bb
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 38
Quoted 9 lines
index
945bd1d927..5d8b76e62c100644meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before giving up CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is 2000. +# Lowering this value can help avoid incomplete read errors during bulkNVD updates.
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?="${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}"
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time): · line 226
Quoted 8 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d, database_time): api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max =int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX"))
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +4
-0+ if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of %d,capping" %
results_per_page_max)meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time): · line 236
Quoted 6 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+ results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:--
Yoann Congal
Smile ECS
Signature · 2 lines
Regards, Awais Belal
Quoted 14 lines · Awais Belal
Hi Yoann,
Thanks for picking this up
Quoted 1 line
What value are you using? Especially in the last few days...
I've seen much better results with a cap of 500/1000 than the default of 2000.
Quoted 4 lines
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.
Quoted 6 lines
Well it is a valid request parameter for starters. This allows the users to control it from the configurations rather than hard coding to any limits someone sees fitting for their environment so more flexibility. Not setting the variable defaults to the limits recommended by NVD however my analysis shows that these days due to bulk updates on the NVD side the fetch has failed most of the time due to an "incomplete read" error.
I agree that a configurable CVE_DB_RESULTS_PER_PAGE looks like a good idea.
I was questionning why CVE_DB_RESULTS_PER_PAGE*_MAX* (notice the _MAX) should be. Seems to me that this is a limit imposed by NVD itself and I don't see a reason to set it to a different value than 2000 (as given by NVD).
Quoted 76 lines · Yoann Congal
Quoted 74 lines
Hello,
Thanks for looking at this!
Quoted 8 lines · Awais Belal via lists.openembedded.org
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
What value are you using? Especially in the last few days...
Review
Quoted 7 lines
Signed-off-by Awais B <[email protected]>--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)(quoted diff) +0
-0b/meta/recipes-core/meta/cve-update-nvd2-native.bb
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 38
Quoted 9 lines
index
945bd1d927..5d8b76e62c100644meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before giving up CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is 2000. +# Lowering this value can help avoid incomplete read errors during bulkNVD updates.
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?="${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}"
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time): · line 226
Quoted 8 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d, database_time): api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max =int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX"))
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +4
-0+ if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of %d,capping" %
results_per_page_max)meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time): · line 236
Quoted 6 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+ results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:--
Yoann Congal
Smile ECS
Signature · 2 lines
Yoann Congal Smile ECS
Quoted 4 lines
I was questionning why CVE_DB_RESULTS_PER_PAGE*_MAX* (notice the
_MAX) should be. Seems to me that this is a limit imposed by NVD itself and I don't see a reason to set it to a different value than 2000 (as given by NVD).
Ah, sorry for misreading your comment earlier. I went with a configurable max for flexibility purposes as well. Consider a scenario where someone would want to limit the max as well for whatever reason. Even in this scenario if the NVD limits change all we'd need to do is update a single variable rather than having to change multiple locations, we could also use a local var for that but then it won't cover point 1. Still if you think this is over engineered please let me know.
Quoted 121 lines · Yoann Congal
Quoted 9 lines · Awais Belal
Hi Yoann,
Thanks for picking this up
Quoted 1 line
What value are you using? Especially in the last few days...
I've seen much better results with a cap of 500/1000 than the default of 2000.
Quoted 6 lines
Quoted 4 lines
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.Well it is a valid request parameter for starters. This allows the users
to
Quoted 2 lines
control it from the configurations rather than hard coding to any limits someone sees fitting for their environment so more flexibility. Not
setting
Quoted 1 line
the variable defaults to the limits recommended by NVD however my
analysis
Quoted 2 lines
shows that these days due to bulk updates on the NVD side the fetch has failed most of the time due to an "incomplete read" error.
I agree that a configurable
CVE_DB_RESULTS_PER_PAGElooks like a good idea.I was questionning why CVE_DB_RESULTS_PER_PAGE*_MAX* (notice the
_MAX) should be. Seems to me that this is a limit imposed by NVD itself and I don't see a reason to set it to a different value than 2000 (as given by NVD).Quoted 2 lines
On Thu, Jun 25, 2026 at 4:43 PM Yoann Congal <[email protected]>
Quoted 24 lines · wrote:
Quoted 24 lines
Hello,
Thanks for looking at this!
Quoted 8 lines · Awais Belal via lists.openembedded.org
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
What value are you using? Especially in the last few days...
Quoted 6 lines
Signed-off-by Awais B <[email protected]>--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Quoted 7 lines
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +0
-0b/meta/recipes-core/meta/cve-update-nvd2-native.bb
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 34
Quoted 5 lines
index
945bd1d927..5d8b76e62c100644meta/recipes-core/meta/cve-update-nvd2-native.bb +0
-0@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before givingup
Quoted 3 lines
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +1
-0CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is2000.
Quoted 1 line
Quoted 1 line
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 38
Quoted 1 line
meta/recipes-core/meta/cve-update-nvd2-native.bb +1
-0+# Lowering this value can help avoid incomplete read errors duringbulk
Quoted 9 lines
Quoted 9 lines
NVD updates.
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?="${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}"
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d,
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +0
-0CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d,
database_time):Quoted 12 lines
Quoted 12 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 5 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max =int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX"))
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.Quoted 4 lines
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +4
-0+ if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of%d,
Quoted 9 lines
Quoted 9 lines
capping" %
results_per_page_max)Quoted 6 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+ results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:Quoted 5 lines
Quoted 5 lines
--
Yoann Congal
Smile ECS--
Yoann Congal
Smile ECS
Signature · 2 lines
Regards, Awais Belal
Quoted 5 lines · Awais Belal
Quoted 4 lines
I was questionning why CVE_DB_RESULTS_PER_PAGE*_MAX* (notice the
_MAX) should be. Seems to me that this is a limit imposed by NVD itself and I don't see a reason to set it to a different value than 2000 (as given by NVD).
Quoted 7 lines
Ah, sorry for misreading your comment earlier. I went with a configurable max for flexibility purposes as well. Consider a scenario where someone would want to limit the max as well for whatever reason. Even in this scenario if the NVD limits change all we'd need to do is update a single variable rather than having to change multiple locations, we could also use a local var for that but then it won't cover point 1. Still if you think this is over engineered please let me know.
I still think this is over engineered. I can't imagine a reason in "whatever reason".
To be clear, what I suggest is:
RESULTS_PER_PAGE_MAX = 2000 # imposed by NVD
if results_per_page > RESULTS_PER_PAGE_MAX:
...
(2000 only writen once, no "multiple locations" to update)
Quoted 124 lines · Yoann Congal
Quoted 122 lines · Awais Belal
Quoted 9 lines
Hi Yoann,
Thanks for picking this up
Quoted 1 line
What value are you using? Especially in the last few days...
I've seen much better results with a cap of 500/1000 than the default of 2000.
Quoted 6 lines
Quoted 4 lines
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.Well it is a valid request parameter for starters. This allows the users
to
Quoted 2 lines
control it from the configurations rather than hard coding to any limits someone sees fitting for their environment so more flexibility. Not
setting
Quoted 1 line
the variable defaults to the limits recommended by NVD however my
analysis
Quoted 2 lines
shows that these days due to bulk updates on the NVD side the fetch has failed most of the time due to an "incomplete read" error.
I agree that a configurable
CVE_DB_RESULTS_PER_PAGElooks like a good idea.I was questionning why CVE_DB_RESULTS_PER_PAGE*_MAX* (notice the
_MAX) should be. Seems to me that this is a limit imposed by NVD itself and I don't see a reason to set it to a different value than 2000 (as given by NVD).Quoted 2 lines
On Thu, Jun 25, 2026 at 4:43 PM Yoann Congal <[email protected]>
Quoted 24 lines · wrote:
Quoted 24 lines
Hello,
Thanks for looking at this!
Quoted 8 lines · Awais Belal via lists.openembedded.org
From: Awais B <[email protected]>
It is seen that during bulk updates on the NVD side the server struggles to keep up with the default/max of 2000 entries per page and we see a lot of incomplete read errors resulting in proper db sync failures most of the times. Lowering the per page value noticably increases the reliability of the process and hence should ideally be configurable.
What value are you using? Especially in the last few days...
Quoted 6 lines
Signed-off-by Awais B <[email protected]>--- meta/recipes-core/meta/cve-update-nvd2-native.bb | 14 ++++++++++++++ 1 file changed, 14 insertions(+)Quoted 7 lines
Quoted 7 lines
Review
Quoted 1 line
(quoted diff) +0
-0b/meta/recipes-core/meta/cve-update-nvd2-native.bb
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 34
Quoted 5 lines
index
945bd1d927..5d8b76e62c100644meta/recipes-core/meta/cve-update-nvd2-native.bb +0
-0@@ -34,6 +34,11 @@ CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" # Number of attempts for each http query to nvd server before givingup
Quoted 3 lines
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +1
-0CVE_DB_UPDATE_ATTEMPTS ?= "5" +# Maximum number of CVE records per API response. Default/max is2000.
Quoted 1 line
Quoted 1 line
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000" · line 38
Quoted 1 line
meta/recipes-core/meta/cve-update-nvd2-native.bb +1
-0+# Lowering this value can help avoid incomplete read errors duringbulk
Quoted 9 lines
Quoted 9 lines
NVD updates.
meta/recipes-core/meta/cve-update-nvd2-native.bb CVE_DB_INCR_UPDATE_AGE_THRES ?= "10368000"
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+CVE_DB_RESULTS_PER_PAGE ?= "" +CVE_DB_RESULTS_PER_PAGE_MAX ?= "2000" + CVE_CHECK_DB_DLDIR_FILE ?="${DL_DIR}/CVE_CHECK/${CVE_CHECK_DB_FILENAME}"
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d,
Quoted 3 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +0
-0CVE_CHECK_DB_DLDIR_LOCK ?= "${CVE_CHECK_DB_DLDIR_FILE}.lock" CVE_CHECK_DB_TEMP_FILE ?= "${CVE_CHECK_DB_FILE}.tmp"@@ -217,6 +222,15 @@ def update_db_file(db_tmp_file, d,
database_time):Quoted 12 lines
Quoted 12 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 5 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +2
-0api_key = d.getVar("NVDCVE_API_KEY") or None attempts = int(d.getVar("CVE_DB_UPDATE_ATTEMPTS")) + results_per_page = d.getVar("CVE_DB_RESULTS_PER_PAGE") + results_per_page_max =int(d.getVar("CVE_DB_RESULTS_PER_PAGE_MAX"))
I'm not sure
CVE_DB_RESULTS_PER_PAGE_MAXshould be a bitbake variable (I don't see a reason for it to be configurable). Can you simplify the code a little by making it a constant in the code instead? We already have a handfull of hardcoded limits from NVD.Quoted 4 lines
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb def update_db_file(db_tmp_file, d, database_time):
Quoted 4 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +4
-0+ if results_per_page: + results_per_page = int(results_per_page) + if results_per_page > results_per_page_max: + bb.warn("CVE_DB_RESULTS_PER_PAGE exceeds maximum of%d,
Quoted 9 lines
Quoted 9 lines
capping" %
results_per_page_max)Quoted 6 lines
meta/recipes-core/meta/cve-update-nvd2-native.bb +3
-0+ results_per_page = results_per_page_max + req_args['resultsPerPage'] = results_per_page + # Recommended by NVD wait_time = 6 if api_key:Quoted 5 lines
Quoted 5 lines
--
Yoann Congal
Smile ECS--
Yoann Congal
Smile ECS
Signature · 2 lines
Yoann Congal Smile ECS