QID 980644

QID 980644: Python (pip) Security Update for bleach (GHSA-vv2x-vrpj-qqpq)

Security update has been released for bleach 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.

A [mutation XSS](https://cure53.de/fp170.pdf) affects users calling `bleach.clean` with all of:

* `svg` or `math` in the allowed tags
* `p` or `br` in allowed tags
* `style`, `title`, `noscript`, `script`, `textarea`, `noframes`, `iframe`, or `xmp` in allowed tags
* the keyword argument `strip_comments=False`

Note: none of the above tags are in the default allowed tags and `strip_comments` defaults to `True`.

  • CVSS V3 rated as Medium - 4.2 severity.
  • CVSS V2 rated as Medium - 5.4 severity.
  • Solution
    Users are encouraged to upgrade to bleach v3.3.0 or greater.

    Note: bleach v3.3.0 introduces a breaking change to escape HTML comments by default.Workaround:
    * modify `bleach.clean` calls to at least one of:
    * not allow the `style`, `title`, `noscript`, `script`, `textarea`, `noframes`, `iframe`, or `xmp` tag
    * not allow `svg` or `math` tags
    * not allow `p` or `br` tags
    * set `strip_comments=True`

    * A strong [Content-Security-Policy](https://developer.mozilla.org/en-US/docs/Web/HTTP/CSP) without `unsafe-inline` and `unsafe-eval` [`script-src`s](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy/script-src)) will also help mitigate the risk.
    Vendor References

    CVEs related to QID 980644

    Software Advisories
    Advisory ID Software Component Link
    GHSA-vv2x-vrpj-qqpq bleach URL Logo github.com/advisories/GHSA-vv2x-vrpj-qqpq