QID 980660

QID 980660: Python (pip) Security Update for sqlparse (GHSA-p5w8-wqhj-9hhf)

Security update has been released for sqlparse to fix the vulnerability.

Note: The preceding description block is extracted directly from the security advisory. Using automation, we have attempted to clean and format it as much as possible without introducing additional issues.

The formatter function that strips comments from a SQL contains a regular expression that is vulnerable to [ReDoS](https://owasp.org/www-community/attacks/Regular_expression_Denial_of_Service_-_ReDoS) (Regular Expression Denial of Service). The regular expression may cause exponential backtracking on strings containing many repetitions of '\r\n' in SQL comments.

  • CVSS V3 rated as High - 7.5 severity.
  • CVSS V2 rated as Medium - 5 severity.
  • Solution
    The issues has been fixed in sqlparse 0.4.2.Workaround:
    Only the formatting feature that removes comments from SQL statements is affected by this regular expression. As a workaround don't use the `sqlformat.format` function with keyword `strip_comments=True` or the `--strip-comments` command line flag when using the `sqlformat` command line tool.
    Vendor References

    CVEs related to QID 980660

    Software Advisories
    Advisory ID Software Component Link
    GHSA-p5w8-wqhj-9hhf sqlparse URL Logo github.com/advisories/GHSA-p5w8-wqhj-9hhf