aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Helmert III <ajak@gentoo.org>2021-07-05 15:27:13 -0500
committerJohn Helmert III <ajak@gentoo.org>2021-07-05 15:28:01 -0500
commitbe4a8b7e8023688a31e931b46fc3ef8651a290a5 (patch)
treecad1a5b6a597f298dff7f1828ea378f616920370
parentIntroduce setuptools boilerplate (diff)
downloadsecurity-be4a8b7e8023688a31e931b46fc3ef8651a290a5.tar.gz
security-be4a8b7e8023688a31e931b46fc3ef8651a290a5.tar.bz2
security-be4a8b7e8023688a31e931b46fc3ef8651a290a5.zip
glsatool: drop, accidentally added, not ready yet
Signed-off-by: John Helmert III <ajak@gentoo.org>
-rwxr-xr-xbin/glsatool74
1 files changed, 0 insertions, 74 deletions
diff --git a/bin/glsatool b/bin/glsatool
deleted file mode 100755
index 4582a40..0000000
--- a/bin/glsatool
+++ /dev/null
@@ -1,74 +0,0 @@
-#!/usr/bin/env python
-
-import argparse
-import os
-import re
-import typing
-
-import bugzilla
-import bracex
-import pkgcore.config
-from pkgcore.ebuild import atom
-import requests
-
-from cvetool import CVETool
-
-PKG_SEPARATORS = re.compile(r':\s|[\s,;(){}[\]]')
-GLSAMAKER_URI = 'https://glsamaker.gentoo.org'
-bgo = bugzilla.Bugzilla('https://bugs.gentoo.org')
-repo = pkgcore.config.load_config().repo['gentoo']
-
-
-class GLSATool:
- """ Utility to ease GLSA handling in GLSAMaker """
-
- def __init__(self, auth):
- self.auth = auth
-
- # https://github.com/mgorny/kuroneko/blob/master/kuroneko/scraper.py#L80
- def find_package_specs(s: str) -> typing.Iterable[atom.atom]:
- """Find potentially valid package specifications in given string."""
- words = set()
- # consider all possible expansions
- for exp in bracex.iexpand(s):
- words.update(PKG_SEPARATORS.split(exp))
- for w in words:
- # skip anything that couldn't be cat/pkg early
- if '/' not in w:
- continue
- try:
- yield atom.atom(w)
- except MalformedAtom:
- continue
-
- def new_glsa(auth, title, bugs):
- post = requests.post(GLSAMAKER_URI + '/glsas',
- data={'title': title + ' [DRAFT]',
- 'bugs': ','.join(bugs),
- 'access': 'public',
- 'import_references': '1',
- 'what': 'request', # ???
- 'authenticity_token': 'k75YYdGlcL+dlZS7RKXSVxKaKl2tiiMvwWlReFtKzt3NCKDE2AeskkrZ851xJB7uCBRUTpstV+/aqUTEx3MfIQ=='},
- headers={'Authorization': 'Basic ' + auth})
- if not post.ok:
- import pdb; pdb.set_trace()
-
-
-def get_auth():
- authpath = os.path.join(os.path.expanduser('~'), '.config', 'cvetool_auth')
- if 'CVETOOL_AUTH' in os.environ:
- return os.environ['CVETOOL_AUTH']
- elif os.path.isfile(authpath):
- with open(authpath, 'r') as authfile:
- return authfile.readlines()[0]
-
-
-if __name__ == '__main__':
- parser = argparse.ArgumentParser()
- parser.add_argument('-b', '--bugs', required=True, nargs='+')
- parser.add_argument('-t', '--title', required=True)
- args = parser.parse_args()
- auth = get_auth()
- for bug in args.bugs:
- CVETool(auth, 'dobug', [bug])
- new_glsa(auth, args.title, args.bugs)