Skip to contentSkip to conversation

python3-pymongo: upgrade 4.1.0 -> 4.1.1

PATCH New Gyorgy Sarvari 1 participant 5 messages Jan 30

lore
Share & tools
lore
#0 lore raw

PATCH 1/5 python3-pymongo: upgrade 4.1.0 -> 4.1.1

Changelog:
- Fixed a memory leak bug when calling decode_all() without a codec_options argument.
- Fixed a bug where decode_all() did not accept codec_options as a keyword argument.
- Fixed an oversight where type markers (py.typed files) were not included in our release distributions.
- Fixed a bug where pymongo would raise a “NameError: name sys is not defined” exception when attempting to parse a “mongodb+srv://” URI when the dnspython dependency was not installed.

---
 .../{python3-pymongo_4.1.0.bb => python3-pymongo_4.1.1.bb}      | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
 rename meta-python/recipes-devtools/python/{python3-pymongo_4.1.0.bb => python3-pymongo_4.1.1.bb} (91%)
meta-python/recipes-devtools/python/python3-pymongo_4.1.1.bb renamed from meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb +1 -1
similarity index 91%
rename from meta-python/recipes-devtools/python/python3-pymongo_4.1.0.bb
rename to meta-python/recipes-devtools/python/python3-pymongo_4.1.1.bb
index d47dfec50f..7bde4ff681 100644
@@ -8,7 +8,7 @@ HOMEPAGE = "http://github.com/mongodb/mongo-python-driver"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
 
-SRC_URI[sha256sum] = "dbba77bc0b706c7ee496fc75a6c6ed406d85f6091d5fec488a8944c3828e6462"
+SRC_URI[sha256sum] = "d7b8f25c9b0043cbaf77b8b895814e33e7a3c807a097377c07e1bd49946030d5"
 
 inherit pypi setuptools3
 
#1 lore raw

PATCH 2/5 python3-pymongo: patch CVE-2024-5629

Details: https://nvd.nist.gov/vuln/detail/CVE-2024-5629

Backport the patch that is indicated to solve the issue based on the upstream project's Jira ticket[1] (which comes from the NVD report).

[1]: https://jira.mongodb.org/browse/PYTHON-4305

---
 .../python3-pymongo/CVE-2024-5629.patch       | 49 +++++++++++++++++++
 .../python/python3-pymongo_4.1.1.bb           |  1 +
 2 files changed, 50 insertions(+)
 create mode 100644 meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch
meta-python/recipes-devtools/python/python3-pymongo/CVE-2024-5629.patch new file +49 -0
new file mode 100644
index 0000000000..0b0822a756
@@ -0,0 +1,49 @@
+From a9454ae060fffa609cc02b129441679b7d248d8f Mon Sep 17 00:00:00 2001
+From: Shane Harvey <[email protected]>
+Date: Wed, 27 Mar 2024 16:51:23 -0700
+Subject: [PATCH] PYTHON-4305 Fix bson size check (#1564)
+
+CVE: CVE-2024-5629
+Upstream-Status: Backport [https://github.com/mongodb/mongo-python-driver/commit/372b5d68d5a57ccc43b33407cd23f0bc79d99283]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ bson/_cbsonmodule.c | 11 +++++------
+ 1 file changed, 5 insertions(+), 6 deletions(-)
+
+diff --git a/bson/_cbsonmodule.c b/bson/_cbsonmodule.c
+index 1a296db..73370e2 100644
+--- a/bson/_cbsonmodule.c
++++ b/bson/_cbsonmodule.c
+@@ -2052,6 +2052,7 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
+             uint32_t c_w_s_size;
+             uint32_t code_size;
+             uint32_t scope_size;
++            uint32_t len;
+             PyObject* code;
+             PyObject* scope;
+             PyObject* code_type;
+@@ -2071,7 +2072,8 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
+             memcpy(&code_size, buffer + *position, 4);
+             code_size = BSON_UINT32_FROM_LE(code_size);
+             /* code_w_scope length + code length + code + scope length */
+-            if (!code_size || max < code_size || max < 4 + 4 + code_size + 4) {
++            len = 4 + 4 + code_size + 4;
++            if (!code_size || max < code_size || max < len || len < code_size) {
+                 goto invalid;
+             }
+             *position += 4;
+@@ -2089,12 +2091,9 @@ static PyObject* get_value(PyObject* self, PyObject* name, const char* buffer,
+ 
+             memcpy(&scope_size, buffer + *position, 4);
+             scope_size = BSON_UINT32_FROM_LE(scope_size);
+-            if (scope_size < BSON_MIN_SIZE) {
+-                Py_DECREF(code);
+-                goto invalid;
+-            }
+             /* code length + code + scope length + scope */
+-            if ((4 + code_size + 4 + scope_size) != c_w_s_size) {
++            len = 4 + 4 + code_size + scope_size;
++            if (scope_size < BSON_MIN_SIZE || len != c_w_s_size || len < scope_size) {
+                 Py_DECREF(code);
+                 goto invalid;
+             }
meta-python/recipes-devtools/python/python3-pymongo_4.1.1.bb +1 -0
index 7bde4ff681..d26ea5d2e8 100644
@@ -8,6 +8,7 @@ HOMEPAGE = "http://github.com/mongodb/mongo-python-driver"
 LICENSE = "Apache-2.0"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=86d3f3a95c324c9479bd8986968f4327"
 
+SRC_URI += "file://CVE-2024-5629.patch"
 SRC_URI[sha256sum] = "d7b8f25c9b0043cbaf77b8b895814e33e7a3c807a097377c07e1bd49946030d5"
 
 inherit pypi setuptools3
#2 lore raw

PATCH 3/5 python3-ecdsa: ignore CVE-2024-23342

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2024-23342

The issue won't be fixed, because it is not in the scope of the project. See also the discussion in the relevant Github issue[1].

[1]: https://github.com/tlsfuzzer/python-ecdsa/issues/330

---
 meta-python/recipes-devtools/python/python3-ecdsa_0.17.0.bb | 3 +++
 1 file changed, 3 insertions(+)
meta-python/recipes-devtools/python/python3-ecdsa_0.17.0.bb +3 -0
index 177019ccc2..9ce63c24b4 100644
@@ -13,3 +13,6 @@ inherit pypi setuptools3 python3native
 RDEPENDS:${PN} += "python3-six python3-gmpy2 python3-pbr"
 
 BBCLASSEXTEND = "native nativesdk"
+
+# won't fix: https://github.com/tlsfuzzer/python-ecdsa/issues/330
+CVE_CHECK_IGNORE = "CVE-2024-23342"
#3 lore raw

PATCH 4/5 libiec61850: patch CVE-2024-45969

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2024-45969

Backport the patch that is referenced by the NVD advisory.

---
 .../libiec61850/files/CVE-2024-45969.patch    | 31 +++++++++++++++++++
 .../libiec61850/libiec61850_1.5.1.bb          |  3 +-
 2 files changed, 33 insertions(+), 1 deletion(-)
 create mode 100644 meta-networking/recipes-connectivity/libiec61850/files/CVE-2024-45969.patch
meta-networking/recipes-connectivity/libiec61850/files/CVE-2024-45969.patch new file +31 -0
new file mode 100644
index 0000000000..d1dc8f0e6e
@@ -0,0 +1,31 @@
+From d1afa7d8946ff05f73440e1fb5c14adcd5058b0d Mon Sep 17 00:00:00 2001
+From: Michael Zillgith <[email protected]>
+Date: Wed, 27 Mar 2024 12:26:58 +0000
+Subject: [PATCH] - ACSE: added check for minimum message size (LIB61850-438)
+
+CVE: CVE-2024-45969
+Upstream-Status: Backport [https://github.com/mz-automation/libiec61850/commit/7afa40390b26ad1f4cf93deaa0052fe7e357ef33]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/mms/iso_acse/acse.c | 8 ++++++++
+ 1 file changed, 8 insertions(+)
+
+diff --git a/src/mms/iso_acse/acse.c b/src/mms/iso_acse/acse.c
+index 60b0f534..1f4d6eb9 100644
+--- a/src/mms/iso_acse/acse.c
++++ b/src/mms/iso_acse/acse.c
+@@ -420,6 +420,14 @@ AcseConnection_parseMessage(AcseConnection* self, ByteBuffer* message)
+ {
+     AcseIndication indication = ACSE_ERROR;
+ 
++    if (message == NULL || message->size < 1)
++    {
++        if (DEBUG_ACSE)
++            printf("ACSE: invalid message - no payload\n");
++
++        return ACSE_ERROR;
++    }
++
+     uint8_t* buffer = message->buffer;
+ 
+     int messageSize = message->size;
meta-networking/recipes-connectivity/libiec61850/libiec61850_1.5.1.bb +2 -1
index 3e5fc91dad..d36a3c9306 100644
@@ -18,7 +18,8 @@ SRCREV = "210cf30897631fe2006ac50483caf8fd616622a2"
 SRC_URI = "git://github.com/mz-automation/${BPN}.git;branch=v1.5;protocol=https \
            file://0001-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch \
            file://0001-pyiec61850-Use-CMAKE_INSTALL_LIBDIR-from-GNUInstallD.patch \
-"
+           file://CVE-2024-45969.patch \
+           "
 
 S = "${WORKDIR}/git"
 
#4 lore raw

PATCH 5/5 libiec61850: patch CVE-2024-45970

In reply to Gyorgy Sarvari

Details: https://nvd.nist.gov/vuln/detail/CVE-2024-45970

Backport the patch that is referenced by the NVD advisory.

---
 .../libiec61850/files/CVE-2024-45970.patch    | 71 +++++++++++++++++++
 .../libiec61850/libiec61850_1.5.1.bb          |  1 +
 2 files changed, 72 insertions(+)
 create mode 100644 meta-networking/recipes-connectivity/libiec61850/files/CVE-2024-45970.patch
meta-networking/recipes-connectivity/libiec61850/files/CVE-2024-45970.patch new file +71 -0
new file mode 100644
index 0000000000..81759438e1
@@ -0,0 +1,71 @@
+From 554e77c542f1c09b689907d5e2ea8bff4b2ad969 Mon Sep 17 00:00:00 2001
+From: Michael Zillgith <[email protected]>
+Date: Tue, 23 Jul 2024 18:50:15 +0100
+Subject: [PATCH] - fixed potential buffer overflows in MMS client file service
+ handling (LIB61850-449)
+
+CVE: CVE-2024-45970
+Upstream-Status: Backport [https://github.com/mz-automation/libiec61850/commit/ac925fae8e281ac6defcd630e9dd756264e9c5bc]
+Signed-off-by: Gyorgy Sarvari <[email protected]>
+---
+ src/mms/iso_mms/client/mms_client_files.c | 23 +++++++++++++++++++----
+ 1 file changed, 19 insertions(+), 4 deletions(-)
+
+diff --git a/src/mms/iso_mms/client/mms_client_files.c b/src/mms/iso_mms/client/mms_client_files.c
+index 307ab534..1aa8dff2 100644
+--- a/src/mms/iso_mms/client/mms_client_files.c
++++ b/src/mms/iso_mms/client/mms_client_files.c
+@@ -478,8 +478,13 @@ parseFileAttributes(uint8_t* buffer, int bufPos, int maxBufPos, uint32_t* fileSi
+             break;
+         case 0x81: /* lastModified */
+             {
+-                if (lastModified != NULL) {
++                if (lastModified != NULL)
++                {
+                     char gtString[40];
++
++                    if (length > sizeof(gtString) - 1)
++                        return false; /* lastModified string too long */
++
+                     memcpy(gtString, buffer + bufPos, length);
+                     gtString[length] = 0;
+                     *lastModified = Conversions_generalizedTimeToMsTime(gtString);
+@@ -506,12 +511,14 @@ parseDirectoryEntry(uint8_t* buffer, int bufPos, int maxBufPos, uint32_t invokeI
+     uint32_t fileSize = 0;
+     uint64_t lastModified = 0;
+ 
+-    while (bufPos < maxBufPos) {
++    while (bufPos < maxBufPos)
++    {
+         uint8_t tag = buffer[bufPos++];
+         int length;
+ 
+         bufPos = BerDecoder_decodeLength(buffer, &length, bufPos, maxBufPos);
+-        if (bufPos < 0) {
++        if (bufPos < 0)
++        {
+             if (DEBUG_MMS_CLIENT)
+                 printf("MMS_CLIENT: invalid length field\n");
+             return false;
+@@ -525,12 +532,20 @@ parseDirectoryEntry(uint8_t* buffer, int bufPos, int maxBufPos, uint32_t invokeI
+             tag = buffer[bufPos++];
+ 
+             bufPos = BerDecoder_decodeLength(buffer, &length, bufPos, maxBufPos);
+-            if (bufPos < 0) {
++            if (bufPos < 0)
++            {
+                 if (DEBUG_MMS_CLIENT)
+                     printf("MMS_CLIENT: invalid length field\n");
+                 return false;
+             }
+ 
++            if (length > (sizeof(fileNameMemory) - 1))
++            {
++                if (DEBUG_MMS_CLIENT)
++                    printf("MMS_CLIENT: filename too long\n");
++                return false;
++            }
++
+             memcpy(filename, buffer + bufPos, length);
+             filename[length] = 0;
+ 
meta-networking/recipes-connectivity/libiec61850/libiec61850_1.5.1.bb +1 -0
index d36a3c9306..ce6f79e996 100644
@@ -19,6 +19,7 @@ SRC_URI = "git://github.com/mz-automation/${BPN}.git;branch=v1.5;protocol=https
            file://0001-pyiec61850-don-t-break-CMAKE_INSTALL_PATH-by-trying-.patch \
            file://0001-pyiec61850-Use-CMAKE_INSTALL_LIBDIR-from-GNUInstallD.patch \
            file://CVE-2024-45969.patch \
+           file://CVE-2024-45970.patch \
            "
 
 S = "${WORKDIR}/git"