File tree Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Expand file tree Collapse file tree 3 files changed +14
-4
lines changed Original file line number Diff line number Diff line change 1
1
Development Version
2
2
-------------------
3
3
4
+ Notable Changes
5
+
6
+ * IMPORTANT: This release fixes a security vulnerability in the
7
+ parser where a regular expression vulnerable to ReDOS (Regular
8
+ Expression Denial of Service) was used. See the security advisory
9
+ for details: https://github.com/andialbrecht/sqlparse/security/advisories/GHSA-rrm6-wvj7-cwh2
10
+ The vulnerability was discovered by @erik-krogh from GitHub
11
+ Security Lab (GHSL). Thanks for reporting!
12
+
4
13
Bug Fixes
5
14
6
15
* Revert a change from 0.4.0 that changed IN to be a comparison (issue694).
7
16
The primary expectation is that IN is treated as a keyword and not as a
8
17
comparison operator. That also follows the definition of reserved keywords
9
18
for the major SQL syntax definitions.
19
+ * Fix regular expressions for string parsing.
10
20
11
21
Other
12
22
Original file line number Diff line number Diff line change 59
59
(r'(?![_A-ZÀ-Ü])-?(\d+(\.\d*)|\.\d+)(?![_A-ZÀ-Ü])' ,
60
60
tokens .Number .Float ),
61
61
(r'(?![_A-ZÀ-Ü])-?\d+(?![_A-ZÀ-Ü])' , tokens .Number .Integer ),
62
- (r"'(''|\\\\|\\ '|[^'])*'" , tokens .String .Single ),
62
+ (r"'(''|\\'|[^'])*'" , tokens .String .Single ),
63
63
# not a real string literal in ANSI SQL:
64
- (r'"(""|\\\\|\\ "|[^"])*"' , tokens .String .Symbol ),
64
+ (r'"(""|\\"|[^"])*"' , tokens .String .Symbol ),
65
65
(r'(""|".*?[^\\]")' , tokens .String .Symbol ),
66
66
# sqlite names can be escaped with [square brackets]. left bracket
67
67
# cannot be preceded by word character or a right bracket --
Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ def test_split_semicolon():
18
18
19
19
20
20
def test_split_backslash ():
21
- stmts = sqlparse .parse (r "select '\\ '; select '\''; select '\\ \'';" )
22
- assert len (stmts ) == 3
21
+ stmts = sqlparse .parse ("select '\' ; select '\' ';" )
22
+ assert len (stmts ) == 2
23
23
24
24
25
25
@pytest .mark .parametrize ('fn' , ['function.sql' ,
You can’t perform that action at this time.
0 commit comments