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

fix: handle disabled_sources in get_vendor_product_pairs #4208

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

ffontaine
Copy link
Contributor

@ffontaine ffontaine commented Jun 21, 2024

get_vendor_product_pairs function doesn't handle disabled sources passed by the user. As a result, the user can't disable a datasource (e.g., OSV) when parsing a python PKG-INFO file.

Fix this by passing enabled_sources from cli to version_scanner and then to cvedb. To achieve this functionality, source_nvd must also be added to enabled_sources when appropriate.

nosec must be added to disable this bandit warning:

>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.
   Severity: Medium   Confidence: Low
   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)
   Location: cve_bin_tool/cvedb.py:681:12
   More Info: https://bandit.readthedocs.io/en/1.7.4/plugins/b608_hardcoded_sql_expressions.html

Indeed, sources is retrieved from self.sources[i].source_name which
can't be updated by an attacker

@ffontaine ffontaine force-pushed the fix-get_vendor_product_pairs branch from d9649d6 to 6422696 Compare June 21, 2024 20:27
get_vendor_product_pairs function doesn't handle disabled sources passed
by the user. As a result, the user can't disable a datasource
(e.g., OSV) when parsing a python PKG-INFO file.

Fix this by passing enabled_sources from cli to version_scanner and then
to cvedb. To achieve this functionality, source_nvd must also be added
to enabled_sources when appropriate.

nosec must be added to disable this bandit warning:

>> Issue: [B608:hardcoded_sql_expressions] Possible SQL injection vector through string-based query construction.
   Severity: Medium   Confidence: Low
   CWE: CWE-89 (https://cwe.mitre.org/data/definitions/89.html)
   Location: cve_bin_tool/cvedb.py:681:12
   More Info: https://bandit.readthedocs.io/en/1.7.4/plugins/b608_hardcoded_sql_expressions.html

Indeed, sources is retrieved from self.sources[i].source_name which
can't be updated by an attacker

Signed-off-by: Fabrice Fontaine <fabrice.fontaine@orange.com>
@ffontaine ffontaine force-pushed the fix-get_vendor_product_pairs branch from 6422696 to 226a78b Compare June 24, 2024 08:20
Copy link
Contributor

@terriko terriko left a comment

Choose a reason for hiding this comment

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

THANK YOU. I've been bugged by the fact that the disabling only changes the download on several occasions, but since no one else seemed bothered I wasn't sure if anyone else would want it to work that way. Very excited to have this finally behave the way I'd expect.

@terriko terriko merged commit a8210b9 into intel:main Jun 24, 2024
22 checks passed
@ffontaine ffontaine deleted the fix-get_vendor_product_pairs branch June 24, 2024 18:51
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.

2 participants