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

Add Apache Log4j Advisories #1744

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

NucleonGodX
Copy link

This pull request addresses issue #586 by adding an importer for Apache Log4j advisories
image

Signed-off-by: NucleonGodX <racerpro41@gmail.com>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
@NucleonGodX NucleonGodX marked this pull request as draft January 15, 2025 06:58
@NucleonGodX NucleonGodX marked this pull request as ready for review January 17, 2025 11:12
@TG1999
Copy link
Contributor

TG1999 commented Jan 23, 2025

@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

Copy link
Member

@pombredanne pombredanne left a 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
Copy link
Member

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
Copy link
Member

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 = [
Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

"2.17.1",
]

try:
Copy link
Member

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)
Copy link
Member

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 = []
Copy link
Member

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>
Signed-off-by: NucleonGodX <racerpro41@gmail.com>
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