From e4a8dbf14440bd70d6afe21967adcbf2f8799168c4128bf047478d7d2c14efe5 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Wed, 30 Dec 2020 13:45:45 +0000 Subject: [PATCH] =?UTF-8?q?-=20Update=20to=203.0.2:=20=20=20-=20Fix=20API?= =?UTF-8?q?=20key=20leaking=20into=20requests=20exceptions=20=20=20-=20Ski?= =?UTF-8?q?p=20man=20page=20generation=20to=20fix=20build=20on=20Windows?= =?UTF-8?q?=20(Alexander=20Todorov)=20=20=20-=20Drop=20python2=20support?= =?UTF-8?q?=20=20=20-=20New=20option=20bugzilla=20modify=20--minor-update?= =?UTF-8?q?=20option=20=20=20-=20requests:=20use=20PYTHONBUGZILLA=5FREQUES?= =?UTF-8?q?TS=5FTIMEOUT=20env=20variable=20=20=20-=20xmlrpc:=20Don't=20add?= =?UTF-8?q?=20api=20key=20to=20passed=20in=20user=20dictionary=20=20=20-?= =?UTF-8?q?=20cli:=20Add=20query=20--extrafield,=20--includefield,=20--exc?= =?UTF-8?q?ludefield=20=20=20-=20Revive=20bugzilla.rhbugzilla.RHBugzilla?= =?UTF-8?q?=20import=20path=20=20=20-=20Bugzilla=20REST=20API=20support=20?= =?UTF-8?q?=20=20-=20Add=20--json=20command=20line=20output=20option=20=20?= =?UTF-8?q?=20-=20Add=20APIs=20for=20Bugzilla=20Groups=20(Pierre-Yves=20Ch?= =?UTF-8?q?ibon)=20=20=20-=20Add=20Bugzilla.get=5Frequests=5Fsession()=20A?= =?UTF-8?q?PI=20to=20access=20raw=20requests=20=20=20=20=20Session=20=20?= =?UTF-8?q?=20-=20Add=20Bugzilla.get=5Fxmlrpc=5Fproxy()=20API=20to=20acces?= =?UTF-8?q?s=20raw=20ServerProxy=20=20=20-=20Add=20Bugzilla=20requests=5Fs?= =?UTF-8?q?ession=3D=20init=20parameter=20to=20pass=20in=20auth,=20etc.=20?= =?UTF-8?q?=20=20-=20Add=20bugzilla=20attach=20--ignore-obsolete=20(=C4=8C?= =?UTF-8?q?estm=C3=ADr=20Kalina)=20=20=20-=20Add=20bugzilla=20login=20--ap?= =?UTF-8?q?i-key=20for=20API=20key=20prompting=20(Danilo=20C.=20L.=20de=20?= =?UTF-8?q?=20=20=20=20Paula)=20=20=20-=20Add=20bugzilla=20new=20--private?= =?UTF-8?q?=20-=20Remove=20106-basic-auth.diff,=20which=20is=20not=20neces?= =?UTF-8?q?sary=20anymore.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzilla?expand=0&rev=50 --- 106-basic-auth.diff | 104 ----------------------------------- python-bugzilla-2.3.0.tar.gz | 3 - python-bugzilla-3.0.2.tar.gz | 3 + python-bugzilla.changes | 25 +++++++++ python-bugzilla.spec | 9 ++- 5 files changed, 32 insertions(+), 112 deletions(-) delete mode 100644 106-basic-auth.diff delete mode 100644 python-bugzilla-2.3.0.tar.gz create mode 100644 python-bugzilla-3.0.2.tar.gz diff --git a/106-basic-auth.diff b/106-basic-auth.diff deleted file mode 100644 index b1ddac9..0000000 --- a/106-basic-auth.diff +++ /dev/null @@ -1,104 +0,0 @@ ---- a/bugzilla/base.py -+++ b/bugzilla/base.py -@@ -24,13 +24,13 @@ if sys.version_info[0] >= 3: - from collections.abc import Mapping - from configparser import ConfigParser - from http.cookiejar import LoadError, MozillaCookieJar -- from urllib.parse import urlparse, parse_qsl -+ from urllib.parse import urlparse, urlunparse, parse_qsl - from xmlrpc.client import Binary, Fault - else: - from collections import Mapping - from ConfigParser import SafeConfigParser as ConfigParser - from cookielib import LoadError, MozillaCookieJar -- from urlparse import urlparse, parse_qsl -+ from urlparse import urlparse, urlunparse, parse_qsl - from xmlrpclib import Binary, Fault - # pylint: enable=import-error - -@@ -215,13 +215,16 @@ class Bugzilla(object): - """ - Turn passed url into a bugzilla XMLRPC web url - """ -- if '://' not in url: -+ scheme, netloc, path, params, query, fragment = urlparse(url) -+ if not scheme: - log.debug('No scheme given for url, assuming https') -- url = 'https://' + url -- if url.count('/') < 3: -+ scheme = 'https' -+ -+ if not path: - log.debug('No path given for url, assuming /xmlrpc.cgi') -- url = url + '/xmlrpc.cgi' -- return url -+ path = 'xmlrpc.cgi' -+ -+ return urlunparse((scheme, netloc, path, params, query, fragment)) - - @staticmethod - def _listify(val): -@@ -234,7 +237,7 @@ class Bugzilla(object): - - def __init__(self, url=-1, user=None, password=None, cookiefile=-1, - sslverify=True, tokenfile=-1, use_creds=True, api_key=None, -- cert=None, configpaths=-1): -+ cert=None, configpaths=-1, basic_auth=False): - """ - :param url: The bugzilla instance URL, which we will connect - to immediately. Most users will want to specify this at -@@ -263,6 +266,7 @@ class Bugzilla(object): - to file or directory for custom certs. - :param api_key: A bugzilla5+ API key - :param configpaths: A list of possible bugzillarc locations. -+ :param basic_auth: Use headers with HTTP Basic authentication - """ - if url == -1: - raise TypeError("Specify a valid bugzilla url, or pass url=None") -@@ -300,6 +304,7 @@ class Bugzilla(object): - self.cookiefile = cookiefile - self.tokenfile = tokenfile - self.configpath = configpaths -+ self._basic_auth = basic_auth - - if url: - self.connect(url) -@@ -564,6 +569,9 @@ class Bugzilla(object): - """ - Backend login method for Bugzilla3 - """ -+ if self._basic_auth: -+ self._transport.set_basic_auth(user, password) -+ - payload = {'login': user, 'password': password} - if restrict_login: - payload['restrict_login'] = True -diff --git a/bugzilla/transport.py b/bugzilla/transport.py -index 12422bb..d750202 100644 ---- a/bugzilla/transport.py -+++ b/bugzilla/transport.py -@@ -4,6 +4,7 @@ - # option) any later version. See http://www.gnu.org/copyleft/gpl.html for - # the full text of the license. - -+import base64 - from logging import getLogger - import sys - -@@ -143,6 +144,16 @@ class _RequestsTransport(Transport): - if cert: - self.session.cert = cert - -+ def set_basic_auth(self, user, password): -+ """ -+ Set basic authentication method. -+ -+ :return: -+ """ -+ b64str = str(base64.b64encode("{}:{}".format(user, password))) -+ authstr = "Basic {}".format(b64str.encode("utf-8").decode("utf-8")) -+ self.request_defaults["headers"]["Authorization"] = authstr -+ - def parse_response(self, response): - """ - Parse XMLRPC response diff --git a/python-bugzilla-2.3.0.tar.gz b/python-bugzilla-2.3.0.tar.gz deleted file mode 100644 index 5f4c330..0000000 --- a/python-bugzilla-2.3.0.tar.gz +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:85c5c6a16f32cafe5cb25f54915d07bd9891d4469799a2c50ba1d936c11c0c61 -size 79002 diff --git a/python-bugzilla-3.0.2.tar.gz b/python-bugzilla-3.0.2.tar.gz new file mode 100644 index 0000000..2d060db --- /dev/null +++ b/python-bugzilla-3.0.2.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:f251da6d2317d57f8b4abf354e5200250cab7b3ea0a5f0c6eb67dce7240f6966 +size 115324 diff --git a/python-bugzilla.changes b/python-bugzilla.changes index ffb502e..ccce2f7 100644 --- a/python-bugzilla.changes +++ b/python-bugzilla.changes @@ -1,3 +1,28 @@ +------------------------------------------------------------------- +Wed Dec 30 13:25:13 UTC 2020 - Matej Cepl + +- Update to 3.0.2: + - Fix API key leaking into requests exceptions + - Skip man page generation to fix build on Windows (Alexander Todorov) + - Drop python2 support + - New option bugzilla modify --minor-update option + - requests: use PYTHONBUGZILLA_REQUESTS_TIMEOUT env variable + - xmlrpc: Don't add api key to passed in user dictionary + - cli: Add query --extrafield, --includefield, --excludefield + - Revive bugzilla.rhbugzilla.RHBugzilla import path + - Bugzilla REST API support + - Add --json command line output option + - Add APIs for Bugzilla Groups (Pierre-Yves Chibon) + - Add Bugzilla.get_requests_session() API to access raw requests + Session + - Add Bugzilla.get_xmlrpc_proxy() API to access raw ServerProxy + - Add Bugzilla requests_session= init parameter to pass in auth, etc. + - Add bugzilla attach --ignore-obsolete (Čestmír Kalina) + - Add bugzilla login --api-key for API key prompting (Danilo C. L. de + Paula) + - Add bugzilla new --private +- Remove 106-basic-auth.diff, which is not necessary anymore. + ------------------------------------------------------------------- Wed Oct 16 12:51:01 UTC 2019 - Julio González Gil diff --git a/python-bugzilla.spec b/python-bugzilla.spec index a24fafb..21ced4b 100644 --- a/python-bugzilla.spec +++ b/python-bugzilla.spec @@ -1,7 +1,7 @@ # # spec file for package python-bugzilla # -# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,14 +19,13 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} %define oldpython python Name: python-bugzilla -Version: 2.3.0 +Version: 3.0.2 Release: 0 Summary: Python library for Bugzilla License: GPL-2.0-or-later Group: Development/Libraries/Python URL: https://github.com/python-bugzilla/python-bugzilla Source: https://files.pythonhosted.org/packages/source/p/python-bugzilla/python-bugzilla-%{version}.tar.gz -Patch0: 106-basic-auth.diff BuildRequires: %{python_module pytest} BuildRequires: %{python_module requests} BuildRequires: %{python_module setuptools} @@ -49,8 +48,8 @@ It also includes a 'bugzilla' commandline client which can be used for quick, ad-hoc bugzilla jiggery-pokery. %prep -%setup -q -%patch0 -p1 +%autosetup -p1 + sed -i -e '1{/^#!\/usr\/bin\/env python/d}' bugzilla/_cli.py %build