2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
lib,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
fetchpatch,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# build-system
|
|
|
|
setuptools,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# dependencies
|
|
|
|
ecdsa,
|
|
|
|
rsa,
|
|
|
|
pyasn1,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# optional-dependencies
|
|
|
|
cryptography,
|
|
|
|
pycrypto,
|
|
|
|
pycryptodome,
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
# tests
|
|
|
|
pytestCheckHook,
|
2020-04-24 23:36:52 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "python-jose";
|
2021-07-14 22:03:04 +00:00
|
|
|
version = "3.3.0";
|
2023-11-16 04:20:00 +00:00
|
|
|
pyproject = true;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "mpdavis";
|
2021-07-14 22:03:04 +00:00
|
|
|
repo = pname;
|
2020-04-24 23:36:52 +00:00
|
|
|
rev = version;
|
2023-03-15 16:39:30 +00:00
|
|
|
hash = "sha256-6VGC6M5oyGCOiXcYp6mpyhL+JlcYZKIqOQU9Sm/TkKM=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
patches = [
|
|
|
|
(fetchpatch {
|
|
|
|
name = "CVE-2024-33663.patch";
|
|
|
|
url = "https://build.opensuse.org/public/source/openSUSE:Factory/python-python-jose/CVE-2024-33663.patch?rev=36cd8815411620042f56a3b81599b341";
|
|
|
|
hash = "sha256-uxOCa7Lg82zY2nuHzw6CbcymCKUodITrFU3lLY1XMFU=";
|
|
|
|
})
|
|
|
|
(fetchpatch {
|
|
|
|
name = "CVE-2024-33664.patch";
|
|
|
|
url = "https://build.opensuse.org/public/source/openSUSE:Factory/python-python-jose/CVE-2024-33664.patch?rev=36cd8815411620042f56a3b81599b341";
|
|
|
|
hash = "sha256-wx/U1T7t7TloP+dMXxGxEVB3bMC7e6epmN8RE8FKksM=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace setup.py \
|
|
|
|
--replace '"pytest-runner",' ""
|
|
|
|
'';
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeBuildInputs = [ setuptools ];
|
2023-11-16 04:20:00 +00:00
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
propagatedBuildInputs = [
|
|
|
|
ecdsa
|
|
|
|
pyasn1
|
|
|
|
rsa
|
|
|
|
];
|
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
passthru.optional-dependencies = {
|
2024-06-05 15:53:02 +00:00
|
|
|
cryptography = [ cryptography ];
|
|
|
|
pycrypto = [ pycrypto ];
|
|
|
|
pycryptodome = [ pycryptodome ];
|
2023-11-16 04:20:00 +00:00
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "jose" ];
|
2020-11-03 02:18:15 +00:00
|
|
|
|
2023-11-16 04:20:00 +00:00
|
|
|
nativeCheckInputs = [
|
|
|
|
pytestCheckHook
|
2024-05-15 15:35:15 +00:00
|
|
|
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
|
|
|
|
|
|
|
|
disabledTests = [
|
|
|
|
# https://github.com/mpdavis/python-jose/issues/348
|
|
|
|
"TestBackendEcdsaCompatibility"
|
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2023-11-16 04:20:00 +00:00
|
|
|
changelog = "https://github.com/mpdavis/python-jose/releases/tag/${version}";
|
2020-04-24 23:36:52 +00:00
|
|
|
homepage = "https://github.com/mpdavis/python-jose";
|
2024-06-20 14:57:18 +00:00
|
|
|
description = "JOSE implementation in Python";
|
2020-04-24 23:36:52 +00:00
|
|
|
license = licenses.mit;
|
2021-07-14 22:03:04 +00:00
|
|
|
maintainers = with maintainers; [ jhhuh ];
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|