From 85d3e3160ad14182ca0b37b546769cc68f37020acdad00ccbe1843918df39718 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 20 Sep 2024 20:16:41 +0000 Subject: [PATCH 1/2] - Switch to Git source and update to version 3.2.0+git.1726768917.5eedea3: * Use non-deprecated argument name in test-suite * Fixed issue in `Bugzilla.fix_url` * Prep for release 3.3.0 * ci: bump actions/checkout from 3 to 4 * ci: bump actions/setup-python from 4 to 5 * Run functional RO tests in GitHub actions * man: Regenerate bugzilla.1 * man: Add section about `bugzillarc` * Allow bug creation with an explicitly empty list of groups (closes #210) * cli: Support `--field` and `--field-json` for `bugzilla attach` (#206) - Remove upstreamed patch 188-fix-api-key-leak.diff OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzilla?expand=0&rev=61 --- .gitattributes | 23 ++ .gitignore | 1 + 106-basic-auth.diff | 79 ++++++ 188-fix-api-key-leak.diff | 23 ++ _service | 15 + _servicedata | 4 + ...zilla-3.2.0+git.1726768917.5eedea3.obscpio | 3 + python-bugzilla-3.2.0.tar.gz | 3 + python-bugzilla.changes | 259 ++++++++++++++++++ python-bugzilla.obsinfo | 4 + python-bugzilla.spec | 86 ++++++ 11 files changed, 500 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 106-basic-auth.diff create mode 100644 188-fix-api-key-leak.diff create mode 100644 _service create mode 100644 _servicedata create mode 100644 python-bugzilla-3.2.0+git.1726768917.5eedea3.obscpio create mode 100644 python-bugzilla-3.2.0.tar.gz create mode 100644 python-bugzilla.changes create mode 100644 python-bugzilla.obsinfo create mode 100644 python-bugzilla.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/106-basic-auth.diff b/106-basic-auth.diff new file mode 100644 index 0000000..057da32 --- /dev/null +++ b/106-basic-auth.diff @@ -0,0 +1,79 @@ +--- + bugzilla/_backendxmlrpc.py | 14 ++++++++++++++ + bugzilla/base.py | 7 ++++++- + 2 files changed, 20 insertions(+), 1 deletion(-) + +--- a/bugzilla/_backendxmlrpc.py ++++ b/bugzilla/_backendxmlrpc.py +@@ -2,6 +2,7 @@ + # See the COPYING file in the top-level directory. + + from logging import getLogger ++import base64 + import sys + from xmlrpc.client import (Binary, Fault, ProtocolError, + ServerProxy, Transport) +@@ -127,6 +128,9 @@ class _BugzillaXMLRPCProxy(ServerProxy, + # pylint: enable=no-member + + return ret ++ ++ def clear_token(self): ++ self.__bugzillasession.set_token_value(None) + + + class _BackendXMLRPC(_BackendBase): +@@ -142,6 +146,16 @@ class _BackendXMLRPC(_BackendBase): + def is_xmlrpc(self): + return True + ++ def set_basic_auth(self, user, password): ++ """ ++ Set basic authentication method. ++ ++ :return: ++ """ ++ b64str = base64.b64encode("{}:{}".format(user, password).encode("utf-8")) ++ authstr = "Basic {}".format(b64str.decode("utf-8")) ++ self._bugzillasession._session.headers["Authorization"] = authstr ++ + def bugzilla_version(self): + return self._xmlrpc_proxy.Bugzilla.version() + +--- a/bugzilla/base.py ++++ b/bugzilla/base.py +@@ -177,7 +177,8 @@ 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, +- force_rest=False, force_xmlrpc=False, requests_session=None): ++ force_rest=False, force_xmlrpc=False, requests_session=None, ++ basic_auth=False): + """ + :param url: The bugzilla instance URL, which we will connect + to immediately. Most users will want to specify this at +@@ -210,6 +211,7 @@ class Bugzilla(object): + :param requests_session: An optional requests.Session object the + API will use to contact the remote bugzilla instance. This + way the API user can set up whatever auth bits they may need. ++ :param basic_auth: Use headers with HTTP Basic authentication + """ + if url == -1: + raise TypeError("Specify a valid bugzilla url, or pass url=None") +@@ -249,6 +251,7 @@ class Bugzilla(object): + + self._settokenfile(tokenfile) + self._setconfigpath(configpaths) ++ self._basic_auth = basic_auth + + if url: + self.connect(url) +@@ -601,6 +604,8 @@ class Bugzilla(object): + raise ValueError("missing username") + if not self.password: + raise ValueError("missing password") ++ if self._basic_auth: ++ self._backend.set_basic_auth(self.user, self.password) + + payload = {"login": self.user} + if restrict_login: diff --git a/188-fix-api-key-leak.diff b/188-fix-api-key-leak.diff new file mode 100644 index 0000000..446b0b4 --- /dev/null +++ b/188-fix-api-key-leak.diff @@ -0,0 +1,23 @@ +--- a/bugzilla/_session.py 2021-10-05 22:49:16.000000000 +0200 ++++ b/bugzilla/_session.py 2023-09-25 17:22:39.763856790 +0200 +@@ -97,14 +97,14 @@ + if "timeout" not in kwargs: + kwargs["timeout"] = timeout + +- response = self._session.request(*args, **kwargs) ++ try: ++ response = self._session.request(*args, **kwargs) + +- if self._is_xmlrpc: +- # Yes this still appears to matter for properly decoding unicode +- # code points in bugzilla.redhat.com content +- response.encoding = "UTF-8" ++ if self._is_xmlrpc: ++ # Yes this still appears to matter for properly decoding unicode ++ # code points in bugzilla.redhat.com content ++ response.encoding = "UTF-8" + +- try: + response.raise_for_status() + except Exception as e: + # Scrape the api key out of the returned exception string diff --git a/_service b/_service new file mode 100644 index 0000000..991c636 --- /dev/null +++ b/_service @@ -0,0 +1,15 @@ + + + 3.2.0+git + https://github.com/python-bugzilla/python-bugzilla.git + git + main + enable + + + + *.tar + gz + + + diff --git a/_servicedata b/_servicedata new file mode 100644 index 0000000..f74c978 --- /dev/null +++ b/_servicedata @@ -0,0 +1,4 @@ + + + https://github.com/python-bugzilla/python-bugzilla.git + 5eedea31bcef0f1ba7a22eb38aba1cdd9b3d7981 \ No newline at end of file diff --git a/python-bugzilla-3.2.0+git.1726768917.5eedea3.obscpio b/python-bugzilla-3.2.0+git.1726768917.5eedea3.obscpio new file mode 100644 index 0000000..b5d455d --- /dev/null +++ b/python-bugzilla-3.2.0+git.1726768917.5eedea3.obscpio @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:3833f041b64f4b8ff63ba60c6153337d72cf09994be2d8fb33953f93b74e77ff +size 851468 diff --git a/python-bugzilla-3.2.0.tar.gz b/python-bugzilla-3.2.0.tar.gz new file mode 100644 index 0000000..49146fc --- /dev/null +++ b/python-bugzilla-3.2.0.tar.gz @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:54967b21001e880b20c9303d5ac86b009142714ee6cdb473be363c41b207dd15 +size 113206 diff --git a/python-bugzilla.changes b/python-bugzilla.changes new file mode 100644 index 0000000..b29b01f --- /dev/null +++ b/python-bugzilla.changes @@ -0,0 +1,259 @@ +------------------------------------------------------------------- +Fri Sep 20 19:54:11 UTC 2024 - mcepl@cepl.eu + +- Switch to Git source and update to version 3.2.0+git.1726768917.5eedea3: + * Use non-deprecated argument name in test-suite + * Fixed issue in `Bugzilla.fix_url` + * Prep for release 3.3.0 + * ci: bump actions/checkout from 3 to 4 + * ci: bump actions/setup-python from 4 to 5 + * Run functional RO tests in GitHub actions + * man: Regenerate bugzilla.1 + * man: Add section about `bugzillarc` + * Allow bug creation with an explicitly empty list of groups (closes #210) + * cli: Support `--field` and `--field-json` for `bugzilla attach` (#206) +- Remove upstreamed patch 188-fix-api-key-leak.diff + +------------------------------------------------------------------- +Mon Sep 25 14:57:10 UTC 2023 - Julio González Gil + +- Fix API Key leak (bsc#1215718) +- Add: + * 188-fix-api-key-leak.diff + +------------------------------------------------------------------- +Wed Dec 21 08:41:46 UTC 2022 - Julio González Gil + +- Update to 3.2.0: + * Use soon-to-be-required Authorization header for RH bugzilla + * Remove cookie auth support + * Detect bugzilla.stage.redhat.com as RHBugzilla + * Add limit as option to build_query +- Modified: + * 106-basic-auth.diff + +------------------------------------------------------------------- +Tue Oct 26 10:25:23 UTC 2021 - Pablo Suárez Hernández + +- Fix problem with basic-auth patch for version higher than 3.0.0 (bsc#1098219) + +- Modified: + * 106-basic-auth.diff + +------------------------------------------------------------------- +Tue Oct 26 05:50:05 UTC 2021 - Matej Cepl + +- Revert removing of 106-basic-auth.diff + +------------------------------------------------------------------- +Thu Oct 21 17:55:23 UTC 2021 - Marina Latini + +- Obsolete python2-bugzilla + +------------------------------------------------------------------- +Thu Oct 21 13:49:24 UTC 2021 - Marina Latini + +- Disable python2 building, as the support was dropped with 3.0.0 + +------------------------------------------------------------------- +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 + +- Backport from upstream: HTTP Basic authentication feature (as used + by SUSE and openSUSE) (bsc#1098219) +- Add: + * 106-basic-auth.diff + +------------------------------------------------------------------- +Sun Sep 15 13:41:23 UTC 2019 - John Vandenberg + +- Update to v2.3.0 + * restrict-login support + * cli: Add support for private attachments + * Fix python3 deprecation warnings + * Drop python 3.3 support, minimum python3 is python 3.4 now + +------------------------------------------------------------------- +Thu Aug 16 09:32:14 UTC 2018 - mcepl@suse.com + +- Update to 2.2.0: + - Port tests to pytest + - cli: --cert Client side certificate support (Tobias Wolter) + - cli: add ability to post comment while sending attachment (Jeff Mahoney) + - cli: Add --comment-tag option + - cli: Add info --active-components + - Add a raw Product.get wrapper API + +------------------------------------------------------------------- +Mon May 7 15:13:13 UTC 2018 - dimstar@opensuse.org + +- Fix conflict for python-bugzillatools: we have to take extra care + for the single-spec rewritter not to conflict with + python2-bugzillatools in the end (which does not exist). + +------------------------------------------------------------------- +Wed May 2 07:10:38 UTC 2018 - tbechtold@suse.com + +- Add Conflicts for python-bugzillatools + +------------------------------------------------------------------- +Mon Apr 30 15:00:32 UTC 2018 - jengelh@inai.de + +- Trim history lesson and rhetoric wording from %description. + +------------------------------------------------------------------- +Wed Apr 25 10:36:02 UTC 2018 - tbechtold@suse.com + +- convert to singlespec +- use pypi as source +- update url + +------------------------------------------------------------------- +Wed Apr 25 10:21:27 UTC 2018 - tbechtold@suse.com + +- update to 2.1.0: + - Support for bugzilla 5 API Keys (Dustin J. Mitchell) + - bugzillarc can be used to set default URL for the cli tool + - Revive update_flags wrapper + - Bug fixes and minor improvements + - Several fixes for use with bugzilla 5 + - Bugzilla.bug_autorefresh now defaults to False + - Credentials are now cached in ~/.cache/python-bugzilla/ + - bin/bugzilla was converted to argparse + - bugzilla query --boolean_chart option is removed + - Unify command line flags across sub commands +- drop NovellBugzilla.patch (no longer needed) + +------------------------------------------------------------------- +Thu Jul 14 13:09:51 UTC 2016 - jsegitz@novell.com + +- Update to version 1.2.2 +- Added NovellBugzilla.patch to ensure it works with SUSE internal + bugzilla. + +------------------------------------------------------------------- +Tue Sep 23 12:32:08 UTC 2014 - bwiedemann@suse.com + +- update nvlbugzilla.py to reflect that server now has ver 4.4 + +------------------------------------------------------------------- +Thu Jun 27 16:29:47 UTC 2013 - jmatejek@suse.com + +- update to 0.9.0 + * CVE-2013-2191: Switch to pycurl to get SSL host and cert validation + (fixes bnc#825876) + * bugzilla: modify: add --dependson (Don Zickus) + * bugzilla: new: add --groups option (Paul Frields) + * bugzilla: modify: Allow setting nearly every bug parameter +- update to suse3 from gitorious + * remerged NovellBugzilla functionality + (upstream inclusion pending bnc#822053) + +------------------------------------------------------------------- +Fri May 24 18:36:22 UTC 2013 - jmatejek@suse.com + +- update to 0.8.0 + * support for Bugzilla 4 and above + * streamlined internals +- update to suse2 from gitorious + * include all suse patches + * use osc's methods to parse .oscrc + +------------------------------------------------------------------- +Wed May 22 12:13:06 UTC 2013 - speilicke@suse.com + +- Apply python-bugzilla-0.6.2-section.patch +- Cleanup spec file +- Package README + +------------------------------------------------------------------- +Thu May 16 13:01:19 UTC 2013 - werner@suse.de + +- Fix UL sections that is check also for URL without final slash + this may fix bnc#807901 + +------------------------------------------------------------------- +Thu Jan 3 17:33:50 UTC 2013 - toddrme2178@gmail.com + +- Fix building on SLES 11 + +------------------------------------------------------------------- +Tue Jan 31 17:07:33 UTC 2012 - jmatejek@suse.com + +- remove basic auth credentials from backtraces +- Novell Bugzilla is the default when using bugzilla command line tool + +------------------------------------------------------------------- +Fri Jan 27 17:53:03 UTC 2012 - jmatejek@suse.com + +- update to openSUSE-1 tag from openSUSE's git branch + * better handling of NovellBugzilla instances + * using HTTP basic auth instead of IChain + +------------------------------------------------------------------- +Fri Jul 29 09:04:07 UTC 2011 - mvyskocil@suse.cz + +- update to 0.6.2, rebased all patches + * backport --outputformat feature from git + +------------------------------------------------------------------- +Fri Jul 29 08:50:47 UTC 2011 - mvyskocil@suse.cz + +- add 0005-Add-Bugzilla34._query.patch fixing query command +- add 0020-allow-various-bnc-instances-in-NovellBugzilla.patch + +------------------------------------------------------------------- +Mon May 23 12:36:47 UTC 2011 - mvyskocil@suse.cz + +- update to 0.6.1 + * many new parameters for bugzilla command-line tool like --target_milestone, + --private, --status, --assignee, et all + * add support for Bugzilla 36 + * Unicode related fixes +- SUSE specific fixes + * novell bugzilla support in getBugzillaClassForURL + * obfuscated password support in oscrc + * move novell bugzilla to 3.4 + * xmlrpclib changes done in python 2.7 from master [bug#685842] +- create suse branch for stashing SUSE specific changes + https://gitorious.org/opensuse/python-bugzilla/commits/suse + +------------------------------------------------------------------- +Thu Jun 17 15:55:51 CEST 2010 - matejcik@suse.cz + +- recognize Novell bugzilla in default constructor + +------------------------------------------------------------------- +Wed Aug 26 09:18:54 UTC 2009 - mvyskocil@suse.cz + +- Added a patch with support of obfuscated passwords introduced in osc-0.121 + +------------------------------------------------------------------- +Wed Jul 22 08:52:01 CEST 2009 - mvyskocil@suse.cz + +- Initial packaging of python-bugzilla 0.5 with Novell Bugzilla patches + diff --git a/python-bugzilla.obsinfo b/python-bugzilla.obsinfo new file mode 100644 index 0000000..76e3926 --- /dev/null +++ b/python-bugzilla.obsinfo @@ -0,0 +1,4 @@ +name: python-bugzilla +version: 3.2.0+git.1726768917.5eedea3 +mtime: 1726768917 +commit: 5eedea31bcef0f1ba7a22eb38aba1cdd9b3d7981 diff --git a/python-bugzilla.spec b/python-bugzilla.spec new file mode 100644 index 0000000..4e28e1a --- /dev/null +++ b/python-bugzilla.spec @@ -0,0 +1,86 @@ +# +# spec file for package python-bugzilla +# +# Copyright (c) 2024 SUSE LLC +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via https://bugs.opensuse.org/ +# + + +%define oldpython python +%define skip_python2 1 +Name: python-bugzilla +Version: 3.2.0+git.1726768917.5eedea3 +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 +Source: python-bugzilla-%{version}.tar.gz +# PATCH-FIX-UPSTREAM 106-basic-auth.diff bsc#1098219 mcepl@suse.com +# Fix basic authentication on bugzilla.suse.com +Patch0: 106-basic-auth.diff +BuildRequires: %{python_module pytest} +BuildRequires: %{python_module requests} +BuildRequires: %{python_module responses} +BuildRequires: %{python_module setuptools} +BuildRequires: fdupes +BuildRequires: python-rpm-macros +Requires: python-requests +Requires(post): update-alternatives +Requires(postun): update-alternatives +Suggests: osc +Conflicts: %{oldpython}-bugzillatools +Obsoletes: python2-bugzilla +BuildArch: noarch +%python_subpackages + +%description +This is a Python module that provides a Python-ish interface to +Bugzilla over XMLRPC. It supports the Web Services provided by +upstream Bugzilla 3.0 and 3.2. + +It also includes a 'bugzilla' commandline client which can be used for quick, +ad-hoc bugzilla jiggery-pokery. + +%prep +%autosetup -p1 + +sed -i -e '1{/^#!\/usr\/bin\/env python/d}' bugzilla/_cli.py + +%build +export CFLAGS="%{optflags}" +%python_build + +%install +%python_install +%python_clone -a %{buildroot}%{_bindir}/bugzilla +%python_clone -a %{buildroot}%{_mandir}/man1/bugzilla.1 +%python_expand %fdupes %{buildroot}%{$python_sitelib} + +%post +%{python_install_alternative bugzilla bugzilla.1} + +%postun +%python_uninstall_alternative bugzilla + +%check +%pytest + +%files %{python_files} +%python_alternative %{_bindir}/bugzilla +%python_alternative %{_mandir}/man1/bugzilla.1%{ext_man} +%{python_sitelib}/bugzilla +%{python_sitelib}/python_bugzilla-3.3.0*-info + +%changelog From 747681d1d4ef438dfbe69ccafda215b60237b943ad0b3f77d27df852f4d0631d Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 20 Sep 2024 20:19:03 +0000 Subject: [PATCH 2/2] Add sle15_python_module_pythons OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-bugzilla?expand=0&rev=62 --- python-bugzilla.spec | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python-bugzilla.spec b/python-bugzilla.spec index 4e28e1a..eda62f0 100644 --- a/python-bugzilla.spec +++ b/python-bugzilla.spec @@ -17,7 +17,7 @@ %define oldpython python -%define skip_python2 1 +%{?sle15_python_module_pythons} Name: python-bugzilla Version: 3.2.0+git.1726768917.5eedea3 Release: 0