@@ -39,7 +39,12 @@ class ElixirSecurityImporterPipeline(VulnerableCodeBaseImporterPipelineV2):
3939
4040 @classmethod
4141 def steps (cls ):
42- return (cls .collect_and_store_advisories ,)
42+ return (cls .clone , cls .collect_and_store_advisories , cls .clean_downloads )
43+
44+ def clean_downloads (self ):
45+ if self .vcs_response :
46+ self .log (f"Removing cloned repository" )
47+ self .vcs_response .delete ()
4348
4449 def clone (self ):
4550 self .log (f"Cloning `{ self .repo_url } `" )
@@ -62,6 +67,9 @@ def collect_advisories(self) -> Iterable[AdvisoryData]:
6267
6368 def process_file (self , file , base_path ) -> Iterable [AdvisoryData ]:
6469 relative_path = str (file .relative_to (base_path )).strip ("/" )
70+ path_segments = str (file ).split ("/" )
71+ # use the last two segments as the advisory ID
72+ advisory_id = "/" .join (path_segments [- 2 :]).replace (".yml" , "" )
6573 advisory_url = (
6674 f"https://github.com/dependabot/elixir-security-advisories/blob/master/{ relative_path } "
6775 )
@@ -114,8 +122,8 @@ def process_file(self, file, base_path) -> Iterable[AdvisoryData]:
114122 date_published = dateparser .parse (yaml_file .get ("disclosure_date" ))
115123
116124 yield AdvisoryData (
117- advisory_id = cve_id ,
118- aliases = [],
125+ advisory_id = advisory_id ,
126+ aliases = [cve_id ],
119127 summary = summary ,
120128 references_v2 = references ,
121129 affected_packages = affected_packages ,
0 commit comments