From ccb1143781f5e67593468cbdd089a38237487c6e Mon Sep 17 00:00:00 2001 From: Raphael Geissert Date: Mon, 20 Aug 2012 02:21:33 +0000 Subject: Add --no-blanks option and default to not specifying a Version git-svn-id: svn+ssh://svn.debian.org/svn/secure-testing@19985 e39458fd-73e7-0310-bf30-c45bca0a0e42 --- bin/report-vuln | 33 ++++++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 9 deletions(-) (limited to 'bin/report-vuln') diff --git a/bin/report-vuln b/bin/report-vuln index 8825887c68..acbdcc0bfd 100755 --- a/bin/report-vuln +++ b/bin/report-vuln @@ -106,7 +106,7 @@ def get_cve(id): return ret + '\n' -def gen_text(pkg, cveid): +def gen_text(pkg, cveid, include_version = False, severity = 'FILLINSEVERITY'): vuln_suff = 'y' cve_suff = '' time_w = 'was' @@ -117,14 +117,15 @@ def gen_text(pkg, cveid): vuln_suff = 'ies' time_w = 'were' - header = '''Package: %s -Version: FILLINAFFECTEDVERSION -Severity: FILLINSEVERITY + header = '''Package: %s\n''' % (pkg) + if include_version: + header += 'Version: FILLINAFFECTEDVERSION\n' + header += '''Severity: %s Tags: security Hi, the following vulnerabilit%s %s published for %s. -''' % (pkg, vuln_suff, time_w, pkg) +''' % (severity, vuln_suff, time_w, pkg) footer = '''If you fix the vulnerabilit%s please also make sure to include the CVE (Common Vulnerabilities & Exposures) id%s in your changelog entry. @@ -152,20 +153,31 @@ For further information see:''' % (vuln_suff, cve_suff) print '\nhttp://security-tracker.debian.org/tracker/source-package/%s' % (pkg) print '(issues without CVE id are assigned a TEMP one, but it may change over time)\n' + if not include_version: + print '''Please adjust the affected versions in the BTS as needed.\n''' + def error(msg): print 'error: ' + msg sys.exit(1) def usage(): - print sys.argv[0], ' ' + print sys.argv[0], '[--no-blanks] ' sys.exit(0) def main(): if len(sys.argv) < 3: usage() - pkg = sys.argv[1] - cve = sys.argv[2:] + blanks = True + if sys.argv[1] == '--no-blanks': + if len(sys.argv) < 4: + usage() + blanks = False + pkg = sys.argv[2] + cve = sys.argv[3:] + else: + pkg = sys.argv[1] + cve = sys.argv[2:] # check for valid parameters p = re.compile('^[a-z].*') @@ -178,7 +190,10 @@ def main(): if not c.match(arg) and not temp_id.match(arg): error(arg + ' does not seem to be a valid CVE id') - gen_text(pkg, cve) + if blanks: + gen_text(pkg, cve) + else: + gen_text(pkg, cve, False, 'grave') if __name__ == '__main__': main() -- cgit v1.2.3