2323from vulnerabilities .importer import VulnerabilitySeverity
2424from vulnerabilities .severity_systems import SCORING_SYSTEMS
2525from vulnerabilities .utils import build_description
26+ from vulnerabilities .utils import get_advisory_url
2627from vulnerabilities .utils import load_yaml
2728
2829logger = logging .getLogger (__name__ )
@@ -60,13 +61,18 @@ def advisory_data(self) -> Iterable[AdvisoryData]:
6061 if file_path .name .startswith ("OSVDB-" ):
6162 continue
6263 raw_data = load_yaml (file_path )
63- yield parse_ruby_advisory (raw_data , subdir )
64+ advisory_url = get_advisory_url (
65+ file = file_path ,
66+ base_path = base_path ,
67+ url = "https://github.com/rubysec/ruby-advisory-db/blob/master/" ,
68+ )
69+ yield parse_ruby_advisory (raw_data , subdir , advisory_url )
6470 finally :
6571 if self .vcs_response :
6672 self .vcs_response .delete ()
6773
6874
69- def parse_ruby_advisory (record , schema_type ):
75+ def parse_ruby_advisory (record , schema_type , advisory_url ):
7076 """
7177 Parse a ruby advisory file and return an AdvisoryData or None.
7278 Each advisory file contains the advisory information in YAML format.
@@ -86,6 +92,7 @@ def parse_ruby_advisory(record, schema_type):
8692 affected_packages = get_affected_packages (record , purl ),
8793 references = get_references (record ),
8894 date_published = get_publish_time (record ),
95+ url = advisory_url ,
8996 )
9097
9198 elif schema_type == "rubies" :
@@ -100,6 +107,7 @@ def parse_ruby_advisory(record, schema_type):
100107 affected_packages = get_affected_packages (record , purl ),
101108 references = get_references (record ),
102109 date_published = get_publish_time (record ),
110+ url = advisory_url ,
103111 )
104112
105113
0 commit comments