Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PUT /cve/{id} should not unconditionally modify Cve-Id collection #1278

Open
ElectricNroff opened this issue Sep 23, 2024 · 0 comments
Open

Comments

@ElectricNroff
Copy link
Contributor

if (cveId.state === CONSTANTS.CVE_STATES.REJECTED) {
result = await cveIdRepo.updateByCveId(id, { state: CONSTANTS.CVE_STATES.PUBLISHED })

versus
await cveIdRepo.updateByCveId(cveId, { state: newCveState })

(etc.)

Successful calls to updateCve always result in cveIdRepo.updateByCveId(cveId, { state: newCveState }) but should do that only if the state of the CVE Record is being changed from PUBLISHED to REJECTED, or from REJECTED to PUBLISHED. Otherwise, in realistic situations in which there are tens of thousands of PUT /cve/{id} calls, there can be tens of thousands of modified items in the Cve-Id collection even though the state remained PUBLISHED. This can potentially result in a large amount of processing time for some Secretariat processes that care about modified CVE IDs.

More generally, updateCna is behaving optimally because it sets the state to PUBLISHED only if was previously REJECTED. rejectExistingCve makes superfluous changes to the Cve-Id collection if the CNA is replacing one REJECTED record with a different REJECTED record. rejectCVE makes superfluous changes to the Cve-Id collection if the CNA is entering a new REJECTED CVE Record when the CVE ID happens to be in the REJECTED state already. submitCVE makes superfluous changes to the Cve-Id collection if the Secretariat is entering a new REJECTED CVE Record when the CVE ID happens to be in the REJECTED state already.

And, of course, submitCna is correct because there is no way for the CVE ID to already be in the PUBLISHED state during a successful call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Needs Triage
Development

No branches or pull requests

1 participant