diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 72681b560e..1c779cd67c 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -9,7 +9,8 @@ * Please see the [README](README.md#schema) for more documentation on the YAML Schema. * Prior to submitting a pull request, run the tests: - +* Advisory filename and the root of the `url:` field must + be equal `(as of 5/10/2026).` ``` bundle install bundle exec rspec diff --git a/spec/advisory_example.rb b/spec/advisory_example.rb index 6097bbfd4a..3c43ddf838 100644 --- a/spec/advisory_example.rb +++ b/spec/advisory_example.rb @@ -106,6 +106,24 @@ it { expect(subject).to be_kind_of(String) } it { expect(subject).to_not match(%r{\Ahttp(s)?://osvdb\.org}) } it { expect(subject).not_to be_empty } + + it "has a filename that matches the root of the url field" do + url = advisory["url"] + + # Extract last path segment from URL + url_root = File.basename(URI.parse(url).path) + + # Extract filename without extension + filename_root = File.basename(path, ".yml") + + # 5/24/2026: May 9, 2026 is earliest start date with no failed checks. + start_date = Date.new(2026, 5, 9) + # Skip advisories older than start_date and old OSVDB advisories. + if advisory["date"] >= start_date and !filename_root.start_with?("OSVDB") + expect(filename_root).to eq(url_root), + "Expected filename '#{filename_root}' DOES NOT to match URL root '#{url_root}'" + end + end end describe "title" do