Bump bleach from 6.1.0 to 6.2.0 (#2438)

* Bump bleach from 6.1.0 to 6.2.0

Bumps [bleach](https://github.com/mozilla/bleach) from 6.1.0 to 6.2.0.
- [Changelog](https://github.com/mozilla/bleach/blob/main/CHANGES)
- [Commits](https://github.com/mozilla/bleach/compare/v6.1.0...v6.2.0)

---
updated-dependencies:
- dependency-name: bleach
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* Update bleach==6.2.0

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

[skip ci]
This commit is contained in:
dependabot[bot] 2024-11-19 10:00:24 -08:00 committed by GitHub
parent be2e63e7e0
commit eb2c372d82
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
18 changed files with 53 additions and 21 deletions

View file

@ -11,9 +11,9 @@ from bleach.sanitizer import (
# yyyymmdd # yyyymmdd
__releasedate__ = "20231006" __releasedate__ = "20241029"
# x.y.z or x.y.z.dev0 -- semver # x.y.z or x.y.z.dev0 -- semver
__version__ = "6.1.0" __version__ = "6.2.0"
__all__ = ["clean", "linkify"] __all__ = ["clean", "linkify"]

View file

@ -1,7 +1,7 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
from six.moves import http_client, urllib from bleach.six_shim import http_client, urllib
import codecs import codecs
import re import re

View file

@ -1,6 +1,6 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import unichr as chr from bleach.six_shim import unichr as chr
from collections import deque, OrderedDict from collections import deque, OrderedDict
from sys import version_info from sys import version_info

View file

@ -1,5 +1,5 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
from bisect import bisect_left from bisect import bisect_left

View file

@ -7,7 +7,7 @@ try:
except ImportError: except ImportError:
from collections import Mapping from collections import Mapping
from six import text_type, PY3 from bleach.six_shim import text_type, PY3
if PY3: if PY3:
import xml.etree.ElementTree as default_etree import xml.etree.ElementTree as default_etree

View file

@ -1,6 +1,6 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
from . import base from . import base
from ..constants import namespaces, voidElements from ..constants import namespaces, voidElements

View file

@ -12,7 +12,7 @@ import re
import warnings import warnings
from xml.sax.saxutils import escape, unescape from xml.sax.saxutils import escape, unescape
from six.moves import urllib_parse as urlparse from bleach.six_shim import urllib_parse as urlparse
from . import base from . import base
from ..constants import namespaces, prefixes from ..constants import namespaces, prefixes

View file

@ -1,5 +1,5 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import with_metaclass, viewkeys from bleach.six_shim import viewkeys
import types import types
@ -423,7 +423,7 @@ def getPhases(debug):
return type return type
# pylint:disable=unused-argument # pylint:disable=unused-argument
class Phase(with_metaclass(getMetaclass(debug, log))): class Phase(metaclass=getMetaclass(debug, log)):
"""Base class for helper object that implements each phase of processing """Base class for helper object that implements each phase of processing
""" """
__slots__ = ("parser", "tree", "__startTagCache", "__endTagCache") __slots__ = ("parser", "tree", "__startTagCache", "__endTagCache")

View file

@ -1,5 +1,5 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
import re import re

View file

@ -1,5 +1,5 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
from ..constants import scopingElements, tableInsertModeElements, namespaces from ..constants import scopingElements, tableInsertModeElements, namespaces

View file

@ -1,7 +1,7 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
# pylint:disable=protected-access # pylint:disable=protected-access
from six import text_type from bleach.six_shim import text_type
import re import re

View file

@ -28,7 +28,7 @@ from . import etree as etree_builders
from .. import _ihatexml from .. import _ihatexml
import lxml.etree as etree import lxml.etree as etree
from six import PY3, binary_type from bleach.six_shim import PY3, binary_type
fullTree = True fullTree = True

View file

@ -3,7 +3,7 @@ from __future__ import absolute_import, division, unicode_literals
from collections import OrderedDict from collections import OrderedDict
import re import re
from six import string_types from bleach.six_shim import string_types
from . import base from . import base
from .._utils import moduleFactoryFactory from .._utils import moduleFactoryFactory

View file

@ -1,5 +1,5 @@
from __future__ import absolute_import, division, unicode_literals from __future__ import absolute_import, division, unicode_literals
from six import text_type from bleach.six_shim import text_type
from collections import OrderedDict from collections import OrderedDict

View file

@ -7,8 +7,12 @@ set -o pipefail
BLEACH_VENDOR_DIR=${BLEACH_VENDOR_DIR:-"."} BLEACH_VENDOR_DIR=${BLEACH_VENDOR_DIR:-"."}
DEST=${DEST:-"."} DEST=${DEST:-"."}
# Install with no dependencies
pip install --no-binary all --no-compile --no-deps -r "${BLEACH_VENDOR_DIR}/vendor.txt" --target "${DEST}" pip install --no-binary all --no-compile --no-deps -r "${BLEACH_VENDOR_DIR}/vendor.txt" --target "${DEST}"
# Apply patches
(cd "${DEST}" && patch -p2 < 01_html5lib_six.patch)
# install Python 3.6.14 urllib.urlparse for #536 # install Python 3.6.14 urllib.urlparse for #536
curl --proto '=https' --tlsv1.2 -o "${DEST}/parse.py" https://raw.githubusercontent.com/python/cpython/v3.6.14/Lib/urllib/parse.py curl --proto '=https' --tlsv1.2 -o "${DEST}/parse.py" https://raw.githubusercontent.com/python/cpython/v3.6.14/Lib/urllib/parse.py
(cd "${DEST}" && sha256sum parse.py > parse.py.SHA256SUM) (cd "${DEST}" && sha256sum parse.py > parse.py.SHA256SUM)

View file

@ -396,16 +396,25 @@ class BleachHTMLTokenizer(HTMLTokenizer):
# name that abruptly ends, but we should treat that like # name that abruptly ends, but we should treat that like
# character data # character data
yield {"type": TAG_TOKEN_TYPE_CHARACTERS, "data": self.stream.get_tag()} yield {"type": TAG_TOKEN_TYPE_CHARACTERS, "data": self.stream.get_tag()}
elif last_error_token["data"] in ( elif last_error_token["data"] in (
"duplicate-attribute",
"eof-in-attribute-name", "eof-in-attribute-name",
"eof-in-attribute-value-no-quotes", "eof-in-attribute-value-no-quotes",
"expected-end-of-tag-but-got-eof",
): ):
# Handle the case where the text being parsed ends with < # Handle the case where the text being parsed ends with <
# followed by a series of characters and then space and then # followed by characters and then space and then:
# more characters. It's treated as a tag name followed by an #
# * more characters
# * more characters repeated with a space between (e.g. "abc abc")
# * more characters and then a space and then an EOF (e.g. "abc def ")
#
# These cases are treated as a tag name followed by an
# attribute that abruptly ends, but we should treat that like # attribute that abruptly ends, but we should treat that like
# character data. # character data instead.
yield {"type": TAG_TOKEN_TYPE_CHARACTERS, "data": self.stream.get_tag()} yield {"type": TAG_TOKEN_TYPE_CHARACTERS, "data": self.stream.get_tag()}
else: else:
yield last_error_token yield last_error_token

19
lib/bleach/six_shim.py Normal file
View file

@ -0,0 +1,19 @@
"""
Replacement module for what html5lib uses six for.
"""
import http.client
import operator
import urllib
PY3 = True
binary_type = bytes
string_types = (str,)
text_type = str
unichr = chr
viewkeys = operator.methodcaller("keys")
http_client = http.client
urllib = urllib
urllib_parse = urllib.parse

View file

@ -1,7 +1,7 @@
apscheduler==3.10.1 apscheduler==3.10.1
arrow==1.3.0 arrow==1.3.0
beautifulsoup4==4.12.3 beautifulsoup4==4.12.3
bleach==6.1.0 bleach==6.2.0
certifi==2024.8.30 certifi==2024.8.30
cheroot==10.0.1 cheroot==10.0.1
cherrypy==18.10.0 cherrypy==18.10.0