diff options
Diffstat (limited to 'meta-python/recipes-devtools/python')
-rw-r--r-- | meta-python/recipes-devtools/python/python3-sqlparse/CVE-2023-30608.patch | 75 | ||||
-rw-r--r-- | meta-python/recipes-devtools/python/python3-sqlparse_0.4.2.bb | 1 |
2 files changed, 76 insertions, 0 deletions
diff --git a/meta-python/recipes-devtools/python/python3-sqlparse/CVE-2023-30608.patch b/meta-python/recipes-devtools/python/python3-sqlparse/CVE-2023-30608.patch new file mode 100644 index 0000000000..41dbf088e1 --- /dev/null +++ b/meta-python/recipes-devtools/python/python3-sqlparse/CVE-2023-30608.patch | |||
@@ -0,0 +1,75 @@ | |||
1 | From fa1cc25e1967228e5d47b9ddb626cc82dba92d7e Mon Sep 17 00:00:00 2001 | ||
2 | From: Andi Albrecht <albrecht.andi@gmail.com> | ||
3 | Date: Wed, 31 May 2023 12:29:07 +0000 | ||
4 | Subject: [PATCH] Remove unnecessary parts in regex for bad escaping. | ||
5 | |||
6 | The regex tried to deal with situations where escaping in the | ||
7 | SQL to be parsed was suspicious. | ||
8 | |||
9 | CVE: CVE-2023-30608 | ||
10 | |||
11 | Upstream-Status: Backport [https://github.com/andialbrecht/sqlparse/commit/c457abd5f097dd13fb21543381e7cfafe7d31cfb] | ||
12 | |||
13 | Signed-off-by: Narpat Mali <narpat.mali@windriver.com> | ||
14 | --- | ||
15 | CHANGELOG | 15 +++++++++++++++ | ||
16 | sqlparse/keywords.py | 4 ++-- | ||
17 | tests/test_split.py | 4 ++-- | ||
18 | 3 files changed, 19 insertions(+), 4 deletions(-) | ||
19 | |||
20 | diff --git a/CHANGELOG b/CHANGELOG | ||
21 | index 65e03fc..a584003 100644 | ||
22 | --- a/CHANGELOG | ||
23 | +++ b/CHANGELOG | ||
24 | @@ -1,3 +1,18 @@ | ||
25 | +Backport CVE-2023-30608 Fix | ||
26 | +--------------------------- | ||
27 | + | ||
28 | +Notable Changes | ||
29 | + | ||
30 | +* IMPORTANT: This release fixes a security vulnerability in the | ||
31 | + parser where a regular expression vulnerable to ReDOS (Regular | ||
32 | + Expression Denial of Service) was used. See the security advisory | ||
33 | + for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-rrm6-wvj7-cwh2 | ||
34 | + The vulnerability was discovered by @erik-krogh from GitHub | ||
35 | + Security Lab (GHSL). Thanks for reporting! | ||
36 | + | ||
37 | +* Fix regular expressions for string parsing. | ||
38 | + | ||
39 | + | ||
40 | Release 0.4.2 (Sep 10, 2021) | ||
41 | ---------------------------- | ||
42 | |||
43 | diff --git a/sqlparse/keywords.py b/sqlparse/keywords.py | ||
44 | index 6850628..4e97477 100644 | ||
45 | --- a/sqlparse/keywords.py | ||
46 | +++ b/sqlparse/keywords.py | ||
47 | @@ -66,9 +66,9 @@ SQL_REGEX = { | ||
48 | (r'(?![_A-ZÀ-Ü])-?(\d+(\.\d*)|\.\d+)(?![_A-ZÀ-Ü])', | ||
49 | tokens.Number.Float), | ||
50 | (r'(?![_A-ZÀ-Ü])-?\d+(?![_A-ZÀ-Ü])', tokens.Number.Integer), | ||
51 | - (r"'(''|\\\\|\\'|[^'])*'", tokens.String.Single), | ||
52 | + (r"'(''|\\'|[^'])*'", tokens.String.Single), | ||
53 | # not a real string literal in ANSI SQL: | ||
54 | - (r'"(""|\\\\|\\"|[^"])*"', tokens.String.Symbol), | ||
55 | + (r'"(""|\\"|[^"])*"', tokens.String.Symbol), | ||
56 | (r'(""|".*?[^\\]")', tokens.String.Symbol), | ||
57 | # sqlite names can be escaped with [square brackets]. left bracket | ||
58 | # cannot be preceded by word character or a right bracket -- | ||
59 | diff --git a/tests/test_split.py b/tests/test_split.py | ||
60 | index a9d7576..e79750e 100644 | ||
61 | --- a/tests/test_split.py | ||
62 | +++ b/tests/test_split.py | ||
63 | @@ -18,8 +18,8 @@ def test_split_semicolon(): | ||
64 | |||
65 | |||
66 | def test_split_backslash(): | ||
67 | - stmts = sqlparse.parse(r"select '\\'; select '\''; select '\\\'';") | ||
68 | - assert len(stmts) == 3 | ||
69 | + stmts = sqlparse.parse("select '\'; select '\'';") | ||
70 | + assert len(stmts) == 2 | ||
71 | |||
72 | |||
73 | @pytest.mark.parametrize('fn', ['function.sql', | ||
74 | -- | ||
75 | 2.40.0 | ||
diff --git a/meta-python/recipes-devtools/python/python3-sqlparse_0.4.2.bb b/meta-python/recipes-devtools/python/python3-sqlparse_0.4.2.bb index 0980ff9c24..b5cc41e730 100644 --- a/meta-python/recipes-devtools/python/python3-sqlparse_0.4.2.bb +++ b/meta-python/recipes-devtools/python/python3-sqlparse_0.4.2.bb | |||
@@ -6,6 +6,7 @@ LIC_FILES_CHKSUM = "file://LICENSE;md5=2b136f573f5386001ea3b7b9016222fc" | |||
6 | 6 | ||
7 | SRC_URI += "file://0001-sqlparse-change-shebang-to-python3.patch \ | 7 | SRC_URI += "file://0001-sqlparse-change-shebang-to-python3.patch \ |
8 | file://run-ptest \ | 8 | file://run-ptest \ |
9 | file://CVE-2023-30608.patch \ | ||
9 | " | 10 | " |
10 | 11 | ||
11 | SRC_URI[sha256sum] = "0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae" | 12 | SRC_URI[sha256sum] = "0c00730c74263a94e5a9919ade150dfc3b19c574389985446148402998287dae" |