Openjdk importer branch - #1589
Conversation
Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
Add gsd test Signed-off-by: ziadhany <ziadhany2016@gmail.com> Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
|
@TG1999 @ambuj-1211 @ziadhany please review this pr |
keshav-space
left a comment
There was a problem hiding this comment.
Thanks @harmonicfunc, use the VulnerableCodeBaseImporterPipeline for new importers. See the detailed instructions below.
| from vulnerabilities.importer import VulnerabilitySeverity | ||
|
|
||
|
|
||
| class OpenJDKImporter(Importer): |
There was a problem hiding this comment.
@harmonicfunc We now have a new Importer design. We use aboutcode.pipeline for importers/Improver,
Move this file to vulnerabilities/pipelines directory and rename this file to openjdk_importer.py :
And start with something like this:
class OpenJDKImporterPipeline(VulnerableCodeBaseImporterPipeline):
"""Collect advisories from OpenJDK."""
root_url = "https://openjdk.org/groups/vulnerability/advisories/"
license_url = "https://openjdk.org/legal/"
spdx_license_expression = "CC-BY-4.0"
importer_name = "OpenJDK Importer"
@classmethod
def steps(cls):
return (
cls.fetch_advisory,
cls.collect_and_store_advisories,
cls.import_new_advisories,
)
def fetch_advisory(self):
self.log(f"Fetching {self.root_url}")
self.advisory_data = requests.get(self.root_url).text
def advisories_count(self) -> int:
# Use self.advisory_data to return the estimated AdvisoryData to be yielded by ``collect_advisories()``.
pass
def collect_advisories(self) -> Iterable[AdvisoryData]:
# Yield AdvisoryData by processing the self.advisory_data (this is similar to `advisory_data()` in old importer)
# Use self.log() to log info/errorsSee this pypa_importer.py pipeline for example https://github.com/aboutcode-org/vulnerablecode/blob/main/vulnerabilities/pipelines/pypa_importer.py.
Also we're in process of migrating our existing importers/imporvers to the new pipeline architecture see #1509
There was a problem hiding this comment.
@keshav-space this would be a nice addition/update to the doc ;)
There was a problem hiding this comment.
@pombredanne ack, will update the doc here https://vulnerablecode.readthedocs.io/en/latest/contributing.html#writing-an-importer
|
ok, on it |
Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
|
@keshav-space sorry but do i need to revamp or change logic parts of my code too?? |
…enjdk-importer-branch
Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
Signed-off-by: Alok Kumar Singh <singhalokkumar960@gmail.com>
|
@harmonicfunc the core logic does not need change, just the integration in a pipeline! |
for issue: #1496
Added a OpenJDK advisory importer that scrapes the vulnerability data from the link: https://openjdk.org/groups/vulnerability/advisories/ and then added the importer to importer registery