-
Notifications
You must be signed in to change notification settings - Fork 216
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
Add Apache Log4j Advisories #1744
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
@NucleonGodX thanks for your contributions, can you please use pipeline structure. https://github.com/aboutcode-org/vulnerablecode/blob/main/vulnerabilities/pipelines/nvd_importer.py check this for example |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! In addition to use the new pipelines, here are a few comments for your consideration. We also need some tests.
@@ -0,0 +1,252 @@ | |||
import logging |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the same header as in other files
@@ -0,0 +1,252 @@ | |||
import logging | |||
import xml.etree.ElementTree as ET |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider using the cyclonedx python library to parse this, and not parsing XML yourself
Parse the XML content and create AdvisoryData objects. | ||
""" | ||
advisories = [] | ||
version_mapping = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why use mapping? are you positively sure that these are forever all the known versions of log4j? Also this would not be a mapping, rather just a set of some versions?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added them from https://www.cvedetails.com/version-list/45/37215/1/Apache-Log4j.html?order=0.
"2.17.1", | ||
] | ||
|
||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why a try/except here?
] | ||
|
||
try: | ||
root = ET.fromstring(xml_content) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the cyclonedx parser.
|
||
class Log4jImprover(ValidVersionImprover): | ||
importer = ApacheLog4jImporter | ||
ignorable_versions = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We likely need some improver to get and expand the list of known versions
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
This pull request addresses issue #586 by adding an importer for Apache Log4j advisories
![image](https://private-user-images.githubusercontent.com/79140607/403287110-5fba6a11-649d-4822-9f06-3b4fcdb7cf8d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkzMDUzMzQsIm5iZiI6MTczOTMwNTAzNCwicGF0aCI6Ii83OTE0MDYwNy80MDMyODcxMTAtNWZiYTZhMTEtNjQ5ZC00ODIyLTlmMDYtM2I0ZmNkYjdjZjhkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjExVDIwMTcxNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWExZWYzYmU0N2MyNDc5YzdiNTQ2YmE1MDY0MWFhMTAyZTBhMjViZTkyMzVjZmNhMGQ5Y2Q1ZjRlYjE4OTVjNGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.8MypucEiRAaQDmaeXlgPf5iDscTBqZo4ftZntmbZSn0)