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 11Development Version
22-------------------
33
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+
413Bug Fixes
514
615* Revert a change from 0.4.0 that changed IN to be a comparison (issue694).
716 The primary expectation is that IN is treated as a keyword and not as a
817 comparison operator. That also follows the definition of reserved keywords
918 for the major SQL syntax definitions.
19+ * Fix regular expressions for string parsing.
1020
1121Other
1222
Original file line number Diff line number Diff line change 5959 (r'(?![_A-ZÀ-Ü])-?(\d+(\.\d*)|\.\d+)(?![_A-ZÀ-Ü])' ,
6060 tokens .Number .Float ),
6161 (r'(?![_A-ZÀ-Ü])-?\d+(?![_A-ZÀ-Ü])' , tokens .Number .Integer ),
62- (r"'(''|\\\\|\\ '|[^'])*'" , tokens .String .Single ),
62+ (r"'(''|\\'|[^'])*'" , tokens .String .Single ),
6363 # not a real string literal in ANSI SQL:
64- (r'"(""|\\\\|\\ "|[^"])*"' , tokens .String .Symbol ),
64+ (r'"(""|\\"|[^"])*"' , tokens .String .Symbol ),
6565 (r'(""|".*?[^\\]")' , tokens .String .Symbol ),
6666 # sqlite names can be escaped with [square brackets]. left bracket
6767 # 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():
1818
1919
2020def 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
2323
2424
2525@pytest .mark .parametrize ('fn' , ['function.sql' ,
You can’t perform that action at this time.
0 commit comments