Skip to content

Commit

Permalink
[api] adapt CVE issue tracking
Browse files Browse the repository at this point in the history
catch cve-.. and CVE-.. ids
  • Loading branch information
adrianschroeter committed Jan 12, 2015
1 parent e31f2ca commit b02d8b6
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
32 changes: 32 additions & 0 deletions src/api/db/migrate/20150112135426_adapt_cve_tracker.rb
@@ -0,0 +1,32 @@
class AdaptCveTracker < ActiveRecord::Migration

def up
t=IssueTracker.find_by_name('cve')
t.regex='(?:cve|CVE)-(\d\d\d\d-\d+)'
t.label="CVE-@@@"
t.save
Delayed::Worker.delay_jobs = true
IssueTracker.write_to_backend

t.issues.each do |i|
i.name.gsub!(/^CVE-/,'')
i.name.gsub!(/^cve-/,'')
i.save
end
end

def down
t=IssueTracker.find_by_name('cve')
t.regex='(CVE-\d\d\d\d-\d+)'
t.label="@@@"
t.save
Delayed::Worker.delay_jobs = true
IssueTracker.write_to_backend

t.issues.each do |i|
i.name = "CVE-" + i.name
i.save
end
end

end
2 changes: 1 addition & 1 deletion src/api/db/seeds.rb
Expand Up @@ -146,7 +146,7 @@
IssueTracker.where(name: 'boost').first_or_create(description: 'Boost Trac', kind: 'trac', regex: 'boost#(\d+)', url: 'https://svn.boost.org/trac/boost/', label: 'boost#@@@', show_url: 'https://svn.boost.org/trac/boost/ticket/@@@')
IssueTracker.where(name: 'bco').first_or_create(description: 'Clutter Project Bugzilla', kind: 'bugzilla', regex: 'bco#(\d+)', url: 'http://bugzilla.clutter-project.org/', label: 'bco#@@@', show_url: 'http://bugzilla.clutter-project.org/show_bug.cgi?id=@@@')
IssueTracker.where(name: 'RT').first_or_create(description: 'CPAN Bugs', kind: 'other', regex: 'RT#(\d+)', url: 'https://rt.cpan.org/', label: 'RT#@@@', show_url: 'http://rt.cpan.org/Public/Bug/Display.html?id=@@@')
IssueTracker.where(name: 'cve').first_or_create(description: 'CVE Numbers', kind: 'cve', regex: '(CVE-\d\d\d\d-\d+)', url: 'http://cve.mitre.org/', label: '@@@', show_url: 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=@@@')
IssueTracker.where(name: 'cve').first_or_create(description: 'CVE Numbers', kind: 'cve', regex: 'CVE-(\d\d\d\d-\d+)', url: 'http://cve.mitre.org/', label: 'CVE-@@@', show_url: 'http://cve.mitre.org/cgi-bin/cvename.cgi?name=@@@')
IssueTracker.where(name: 'deb').first_or_create(description: 'Debian Bugzilla', kind: 'bugzilla', regex: 'deb#(\d+)', url: 'http://bugs.debian.org/', label: 'deb#@@@', show_url: 'http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=@@@')
IssueTracker.where(name: 'fdo').first_or_create(description: 'Freedesktop.org Bugzilla', kind: 'bugzilla', regex: 'fdo#(\d+)', url: 'https://bugs.freedesktop.org/', label: 'fdo#@@@', show_url: 'https://bugs.freedesktop.org/show_bug.cgi?id=@@@')
IssueTracker.where(name: 'GCC').first_or_create(description: 'GCC Bugzilla', kind: 'bugzilla', regex: 'GCC#(\d+)', url: 'http://gcc.gnu.org/bugzilla/', label: 'GCC#@@@', show_url: 'http://gcc.gnu.org/bugzilla/show_bug.cgi?id=@@@')
Expand Down

0 comments on commit b02d8b6

Please sign in to comment.