@@ -166,7 +166,6 @@ def get_oss_info_from_pkg_info(pkg_info):
166166
167167
168168def analyze_jar_file (path_to_find_bin , path_to_exclude ):
169- remove_owasp_item = []
170169 owasp_items = {}
171170 remove_vulnerability_items = []
172171 vulnerability_items = {}
@@ -261,14 +260,22 @@ def analyze_jar_file(path_to_find_bin, path_to_exclude):
261260 vulnerability_items = get_vulnerability_info (file_with_path , vulnerability , vulnerability_items , remove_vulnerability_items )
262261
263262 if oss_name != "" or oss_ver != "" or oss_license != "" or oss_dl_url != "" :
264- oss = OssItem (oss_name , oss_ver , oss_license , oss_dl_url )
265- oss .comment = "OWASP result"
263+ oss_list_for_file = owasp_items .get (file_with_path , [])
266264
267- remove_owasp_item = owasp_items .get (file_with_path )
268- if remove_owasp_item :
269- remove_owasp_item .append (oss )
270- else :
271- owasp_items [file_with_path ] = [oss ]
265+ existing_oss = None
266+ for item in oss_list_for_file :
267+ if item .name == oss_name and item .version == oss_ver :
268+ existing_oss = item
269+ break
270+
271+ if not existing_oss :
272+ oss = OssItem (oss_name , oss_ver , oss_license , oss_dl_url )
273+ oss .comment = "OWASP result"
274+
275+ if file_with_path in owasp_items :
276+ owasp_items [file_with_path ].append (oss )
277+ else :
278+ owasp_items [file_with_path ] = [oss ]
272279 except Exception as ex :
273280 logger .debug (f"Error to get depency Info in jar_contets: { ex } " )
274281 success = False
0 commit comments