METADATA 31 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294
  1. Metadata-Version: 2.4
  2. Name: bleach
  3. Version: 6.3.0
  4. Summary: An easy safelist-based HTML-sanitizing tool.
  5. Home-page: https://github.com/mozilla/bleach
  6. Maintainer: Will Kahn-Greene
  7. Maintainer-email: willkg@mozilla.com
  8. License: Apache Software License
  9. Classifier: Development Status :: 5 - Production/Stable
  10. Classifier: Environment :: Web Environment
  11. Classifier: Intended Audience :: Developers
  12. Classifier: Operating System :: OS Independent
  13. Classifier: Programming Language :: Python
  14. Classifier: Programming Language :: Python :: 3 :: Only
  15. Classifier: Programming Language :: Python :: 3
  16. Classifier: Programming Language :: Python :: 3.10
  17. Classifier: Programming Language :: Python :: 3.11
  18. Classifier: Programming Language :: Python :: 3.12
  19. Classifier: Programming Language :: Python :: 3.13
  20. Classifier: Programming Language :: Python :: 3.14
  21. Classifier: Programming Language :: Python :: Implementation :: CPython
  22. Classifier: Programming Language :: Python :: Implementation :: PyPy
  23. Classifier: Topic :: Software Development :: Libraries :: Python Modules
  24. Requires-Python: >=3.10
  25. Description-Content-Type: text/x-rst
  26. License-File: LICENSE
  27. License-File: bleach/_vendor/html5lib-1.1.dist-info/LICENSE
  28. Requires-Dist: webencodings
  29. Provides-Extra: css
  30. Requires-Dist: tinycss2<1.5,>=1.1.0; extra == "css"
  31. Dynamic: classifier
  32. Dynamic: description
  33. Dynamic: description-content-type
  34. Dynamic: home-page
  35. Dynamic: license
  36. Dynamic: license-file
  37. Dynamic: maintainer
  38. Dynamic: maintainer-email
  39. Dynamic: provides-extra
  40. Dynamic: requires-dist
  41. Dynamic: requires-python
  42. Dynamic: summary
  43. ======
  44. Bleach
  45. ======
  46. .. image:: https://github.com/mozilla/bleach/workflows/Test/badge.svg
  47. :target: https://github.com/mozilla/bleach/actions?query=workflow%3ATest
  48. .. image:: https://github.com/mozilla/bleach/workflows/Lint/badge.svg
  49. :target: https://github.com/mozilla/bleach/actions?query=workflow%3ALint
  50. .. image:: https://badge.fury.io/py/bleach.svg
  51. :target: http://badge.fury.io/py/bleach
  52. **NOTE: 2023-01-23: Bleach is deprecated.** See issue:
  53. `<https://github.com/mozilla/bleach/issues/698>`__
  54. Bleach is an allowed-list-based HTML sanitizing library that escapes or strips
  55. markup and attributes.
  56. Bleach can also linkify text safely, applying filters that Django's ``urlize``
  57. filter cannot, and optionally setting ``rel`` attributes, even on links already
  58. in the text.
  59. Bleach is intended for sanitizing text from *untrusted* sources. If you find
  60. yourself jumping through hoops to allow your site administrators to do lots of
  61. things, you're probably outside the use cases. Either trust those users, or
  62. don't.
  63. Because it relies on html5lib_, Bleach is as good as modern browsers at dealing
  64. with weird, quirky HTML fragments. And *any* of Bleach's methods will fix
  65. unbalanced or mis-nested tags.
  66. The version on GitHub_ is the most up-to-date and contains the latest bug
  67. fixes. You can find full documentation on `ReadTheDocs`_.
  68. :Code: https://github.com/mozilla/bleach
  69. :Documentation: https://bleach.readthedocs.io/
  70. :Issue tracker: https://github.com/mozilla/bleach/issues
  71. :License: Apache License v2; see LICENSE file
  72. Reporting Bugs
  73. ==============
  74. For regular bugs, please report them `in our issue tracker
  75. <https://github.com/mozilla/bleach/issues>`_.
  76. If you believe that you've found a security vulnerability, please `file a secure
  77. bug report in our bug tracker
  78. <https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&product=Webtools&component=Bleach-security&groups=webtools-security>`_
  79. or send an email to *security AT mozilla DOT org*.
  80. For more information on security-related bug disclosure and the PGP key to use
  81. for sending encrypted mail or to verify responses received from that address,
  82. please read our wiki page at
  83. `<https://www.mozilla.org/en-US/security/#For_Developers>`_.
  84. Security
  85. ========
  86. Bleach is a security-focused library.
  87. We have a responsible security vulnerability reporting process. Please use
  88. that if you're reporting a security issue.
  89. Security issues are fixed in private. After we land such a fix, we'll do a
  90. release.
  91. For every release, we mark security issues we've fixed in the ``CHANGES`` in
  92. the **Security issues** section. We include any relevant CVE links.
  93. Installing Bleach
  94. =================
  95. Bleach is available on PyPI_, so you can install it with ``pip``::
  96. $ pip install bleach
  97. Upgrading Bleach
  98. ================
  99. .. warning::
  100. Before doing any upgrades, read through `Bleach Changes
  101. <https://bleach.readthedocs.io/en/latest/changes.html>`_ for backwards
  102. incompatible changes, newer versions, etc.
  103. Bleach follows `semver 2`_ versioning. Vendored libraries will not
  104. be changed in patch releases.
  105. Basic use
  106. =========
  107. The simplest way to use Bleach is:
  108. .. code-block:: python
  109. >>> import bleach
  110. >>> bleach.clean('an <script>evil()</script> example')
  111. u'an &lt;script&gt;evil()&lt;/script&gt; example'
  112. >>> bleach.linkify('an http://example.com url')
  113. u'an <a href="http://example.com" rel="nofollow">http://example.com</a> url'
  114. Code of Conduct
  115. ===============
  116. This project and repository is governed by Mozilla's code of conduct and
  117. etiquette guidelines. For more details please see the `CODE_OF_CONDUCT.md
  118. </CODE_OF_CONDUCT.md>`_
  119. .. _html5lib: https://github.com/html5lib/html5lib-python
  120. .. _GitHub: https://github.com/mozilla/bleach
  121. .. _ReadTheDocs: https://bleach.readthedocs.io/
  122. .. _PyPI: https://pypi.org/project/bleach/
  123. .. _semver 2: https://semver.org/
  124. Bleach changes
  125. ==============
  126. Version 6.3.0 (October 27th, 2025)
  127. ----------------------------------
  128. **Backwards incompatible changes**
  129. * Dropped support for Python 3.9. (#756)
  130. **Security fixes**
  131. None
  132. **Bug fixes**
  133. * Add support for Python 3.14. (#758)
  134. * Fix wbr handling. (#488)
  135. Version 6.2.0 (October 29th, 2024)
  136. ----------------------------------
  137. **Backwards incompatible changes**
  138. * Dropped support for Python 3.8. (#737)
  139. **Security fixes**
  140. None
  141. **Bug fixes**
  142. * Add support for Python 3.13. (#736)
  143. * Remove six depdenncy. (#618)
  144. * Update known-good versions for tinycss2. (#732)
  145. * Fix additional < followed by characters and EOF issues. (#728)
  146. Version 6.1.0 (October 6th, 2023)
  147. ---------------------------------
  148. **Backwards incompatible changes**
  149. * Dropped support for Python 3.7. (#709)
  150. **Security fixes**
  151. None
  152. **Bug fixes**
  153. * Add support for Python 3.12. (#710)
  154. * Fix linkify with arrays in querystring (#436)
  155. * Handle more cases with < followed by character data (#705)
  156. * Fix entities inside a tags in linkification (#704)
  157. * Update cap for tinycss2 to <1.3 (#702)
  158. * Updated Sphinx requirement
  159. * Add dependabot for github actions and update github actions
  160. Version 6.0.0 (January 23rd, 2023)
  161. ----------------------------------
  162. **Backwards incompatible changes**
  163. * ``bleach.clean``, ``bleach.sanitizer.Cleaner``,
  164. ``bleach.html5lib_shim.BleachHTMLParser``: the ``tags`` and ``protocols``
  165. arguments were changed from lists to sets.
  166. Old pre-6.0.0:
  167. .. code-block:: python
  168. bleach.clean(
  169. "some text",
  170. tags=["a", "p", "img"],
  171. # ^ ^ list
  172. protocols=["http", "https"],
  173. # ^ ^ list
  174. )
  175. New 6.0.0 and later:
  176. .. code-block:: python
  177. bleach.clean(
  178. "some text",
  179. tags={"a", "p", "img"},
  180. # ^ ^ set
  181. protocols={"http", "https"},
  182. # ^ ^ set
  183. )
  184. * ``bleach.linkify``, ``bleach.linkifier.Linker``: the ``skip_tags`` and
  185. ``recognized_tags`` arguments were changed from lists to sets.
  186. Old pre-6.0.0:
  187. .. code-block:: python
  188. bleach.linkify(
  189. "some text",
  190. skip_tags=["pre"],
  191. # ^ ^ list
  192. )
  193. linker = Linker(
  194. skip_tags=["pre"],
  195. # ^ ^ list
  196. recognized_tags=html5lib_shim.HTML_TAGS + ["custom-element"],
  197. # ^ ^ ^ list
  198. # |
  199. # | list concatenation
  200. )
  201. New 6.0.0 and later:
  202. .. code-block:: python
  203. bleach.linkify(
  204. "some text",
  205. skip_tags={"pre"},
  206. # ^ ^ set
  207. )
  208. linker = Linker(
  209. skip_tags={"pre"},
  210. # ^ ^ set
  211. recognized_tags=html5lib_shim.HTML_TAGS | {"custom-element"},
  212. # ^ ^ ^ set
  213. # |
  214. # | union operator
  215. )
  216. * ``bleach.sanitizer.BleachSanitizerFilter``: ``strip_allowed_elements`` is now
  217. ``strip_allowed_tags``. We now use "tags" everywhere rather than a mishmash
  218. of "tags" in some places and "elements" in others.
  219. **Security fixes**
  220. None
  221. **Bug fixes**
  222. * Add support for Python 3.11. (#675)
  223. * Fix API weirness in ``BleachSanitizerFilter``. (#649)
  224. We're using "tags" instead of "elements" everywhere--no more weird
  225. overloading of "elements" anymore.
  226. Also, it no longer calls the superclass constructor.
  227. * Add warning when ``css_sanitizer`` isn't set, but the ``style``
  228. attribute is allowed. (#676)
  229. * Fix linkify handling of character entities. (#501)
  230. * Rework dev dependencies to use ``requirements-dev.txt`` and
  231. ``requirements-flake8.txt`` instead of extras.
  232. * Fix project infrastructure to be tox-based so it's easier to have CI
  233. run the same things we're running in development and with flake8
  234. in an isolated environment.
  235. * Update action versions in CI.
  236. * Switch to f-strings where possible. Make tests parametrized to be
  237. easier to read/maintain.
  238. Version 5.0.1 (June 27th, 2022)
  239. -------------------------------
  240. **Security fixes**
  241. None
  242. **Bug fixes**
  243. * Add missing comma to tinycss2 require. Thank you, @shadchin!
  244. * Add url parse tests based on wpt url tests. (#688)
  245. * Support scheme-less urls if "https" is in allow list. (#662)
  246. * Handle escaping ``<`` in edge cases where it doesn't start a tag. (#544)
  247. * Fix reference warnings in docs. (#660)
  248. * Correctly urlencode email address parts. Thank you, @larseggert! (#659)
  249. Version 5.0.0 (April 7th, 2022)
  250. -------------------------------
  251. **Backwards incompatible changes**
  252. * ``clean`` and ``linkify`` now preserve the order of HTML attributes. Thank
  253. you, @askoretskly! (#566)
  254. * Drop support for Python 3.6. Thank you, @hugovk! (#629)
  255. * CSS sanitization in style tags is completely different now. If you're using
  256. Bleach ``clean`` to sanitize css in style tags, you'll need to update your
  257. code and you'll need to install the ``css`` extras::
  258. pip install 'bleach[css]'
  259. See `the documentation on sanitizing CSS for how to do it
  260. <https://bleach.readthedocs.io/en/latest/clean.html#sanitizing-css>`_. (#633)
  261. **Security fixes**
  262. None
  263. **Bug fixes**
  264. * Rework dev dependencies. We no longer have
  265. ``requirements-dev.in``/``requirements-dev.txt``. Instead, we're using
  266. ``dev`` extras.
  267. See `development docs <https://bleach.readthedocs.io/en/latest/dev.html>`_
  268. for more details. (#620)
  269. * Add newline when dropping block-level tags. Thank you, @jvanasco! (#369)
  270. Version 4.1.0 (August 25th, 2021)
  271. ---------------------------------
  272. **Features**
  273. * Python 3.9 support
  274. **Security fixes**
  275. None
  276. **Bug fixes**
  277. * Update sanitizer clean to use vendored 3.6.14 stdlib urllib.parse to
  278. fix test failures on Python 3.9. (#536)
  279. Version 4.0.0 (August 3rd, 2021)
  280. --------------------------------
  281. **Backwards incompatible changes**
  282. * Drop support for unsupported Python versions <3.6. (#520)
  283. **Security fixes**
  284. None
  285. **Features**
  286. * fix attribute name in the linkify docs (thanks @CheesyFeet!)
  287. Version 3.3.1 (July 14th, 2021)
  288. -------------------------------
  289. **Security fixes**
  290. None
  291. **Features**
  292. * add more tests for CVE-2021-23980 / GHSA-vv2x-vrpj-qqpq
  293. * bump python version to 3.8 for tox doc, vendorverify, and lint targets
  294. * update bug report template tag
  295. * update vendorverify script to detect and fail when extra files are vendored
  296. * update release process docs to check vendorverify passes locally
  297. **Bug fixes**
  298. * remove extra vendored django present in the v3.3.0 whl (#595)
  299. * duplicate h1 header doc fix (thanks Nguyễn Gia Phong / @McSinyx!)
  300. Version 3.3.0 (February 1st, 2021)
  301. ----------------------------------
  302. **Backwards incompatible changes**
  303. * clean escapes HTML comments even when strip_comments=False
  304. **Security fixes**
  305. * Fix bug 1621692 / GHSA-m6xf-fq7q-8743. See the advisory for details.
  306. **Features**
  307. None
  308. **Bug fixes**
  309. None
  310. Version 3.2.3 (January 26th, 2021)
  311. ----------------------------------
  312. **Security fixes**
  313. None
  314. **Features**
  315. None
  316. **Bug fixes**
  317. * fix clean and linkify raising ValueErrors for certain inputs. Thank you @Google-Autofuzz.
  318. Version 3.2.2 (January 20th, 2021)
  319. ----------------------------------
  320. **Security fixes**
  321. None
  322. **Features**
  323. * Migrate CI to Github Actions. Thank you @hugovk.
  324. **Bug fixes**
  325. * fix linkify raising an IndexError on certain inputs. Thank you @Google-Autofuzz.
  326. Version 3.2.1 (September 18th, 2020)
  327. ------------------------------------
  328. **Security fixes**
  329. None
  330. **Features**
  331. None
  332. **Bug fixes**
  333. * change linkifier to add rel="nofollow" as documented. Thank you @mitar.
  334. * suppress html5lib sanitizer DeprecationWarnings (#557)
  335. Version 3.2.0 (September 16th, 2020)
  336. ------------------------------------
  337. **Security fixes**
  338. None
  339. **Features**
  340. None
  341. **Bug fixes**
  342. * ``html5lib`` dependency to version 1.1.0. Thank you Sam Sneddon.
  343. * update tests_website terminology. Thank you Thomas Grainger.
  344. Version 3.1.5 (April 29th, 2020)
  345. --------------------------------
  346. **Security fixes**
  347. None
  348. **Features**
  349. None
  350. **Bug fixes**
  351. * replace missing ``setuptools`` dependency with ``packaging``. Thank you Benjamin Peterson.
  352. Version 3.1.4 (March 24th, 2020)
  353. --------------------------------
  354. **Security fixes**
  355. * ``bleach.clean`` behavior parsing style attributes could result in a
  356. regular expression denial of service (ReDoS).
  357. Calls to ``bleach.clean`` with an allowed tag with an allowed
  358. ``style`` attribute were vulnerable to ReDoS. For example,
  359. ``bleach.clean(..., attributes={'a': ['style']})``.
  360. This issue was confirmed in Bleach versions v3.1.3, v3.1.2, v3.1.1,
  361. v3.1.0, v3.0.0, v2.1.4, and v2.1.3. Earlier versions used a similar
  362. regular expression and should be considered vulnerable too.
  363. Anyone using Bleach <=v3.1.3 is encouraged to upgrade.
  364. https://bugzilla.mozilla.org/show_bug.cgi?id=1623633
  365. **Backwards incompatible changes**
  366. * Style attributes with dashes, or single or double quoted values are
  367. cleaned instead of passed through.
  368. **Features**
  369. None
  370. **Bug fixes**
  371. None
  372. Version 3.1.3 (March 17th, 2020)
  373. --------------------------------
  374. **Security fixes**
  375. None
  376. **Backwards incompatible changes**
  377. * Drop support for Python 3.4. Thank you, @hugovk!
  378. * Drop deprecated ``setup.py test`` support. Thank you, @jdufresne! (#507)
  379. **Features**
  380. * Add support for Python 3.8. Thank you, @jdufresne!
  381. * Add support for PyPy 7. Thank you, @hugovk!
  382. * Add pypy3 testing to tox and travis. Thank you, @jdufresne!
  383. **Bug fixes**
  384. * Add relative link to code of conduct. (#442)
  385. * Fix typo: curren -> current in tests/test_clean.py Thank you, timgates42! (#504)
  386. * Fix handling of non-ascii style attributes. Thank you, @sekineh! (#426)
  387. * Simplify tox configuration. Thank you, @jdufresne!
  388. * Make documentation reproducible. Thank you, @lamby!
  389. * Fix typos in code comments. Thank you, @zborboa-g!
  390. * Fix exception value testing. Thank you, @mastizada!
  391. * Fix parser-tags NoneType exception. Thank you, @bope!
  392. * Improve TLD support in linkify. Thank you, @pc-coholic!
  393. Version 3.1.2 (March 11th, 2020)
  394. --------------------------------
  395. **Security fixes**
  396. * ``bleach.clean`` behavior parsing embedded MathML and SVG content
  397. with RCDATA tags did not match browser behavior and could result in
  398. a mutation XSS.
  399. Calls to ``bleach.clean`` with ``strip=False`` and ``math`` or
  400. ``svg`` tags and one or more of the RCDATA tags ``script``,
  401. ``noscript``, ``style``, ``noframes``, ``iframe``, ``noembed``, or
  402. ``xmp`` in the allowed tags whitelist were vulnerable to a mutation
  403. XSS.
  404. This security issue was confirmed in Bleach version v3.1.1. Earlier
  405. versions are likely affected too.
  406. Anyone using Bleach <=v3.1.1 is encouraged to upgrade.
  407. https://bugzilla.mozilla.org/show_bug.cgi?id=1621692
  408. **Backwards incompatible changes**
  409. None
  410. **Features**
  411. None
  412. **Bug fixes**
  413. None
  414. Version 3.1.1 (February 13th, 2020)
  415. -----------------------------------
  416. **Security fixes**
  417. * ``bleach.clean`` behavior parsing ``noscript`` tags did not match
  418. browser behavior.
  419. Calls to ``bleach.clean`` allowing ``noscript`` and one or more of
  420. the raw text tags (``title``, ``textarea``, ``script``, ``style``,
  421. ``noembed``, ``noframes``, ``iframe``, and ``xmp``) were vulnerable
  422. to a mutation XSS.
  423. This security issue was confirmed in Bleach versions v2.1.4, v3.0.2,
  424. and v3.1.0. Earlier versions are probably affected too.
  425. Anyone using Bleach <=v3.1.0 is highly encouraged to upgrade.
  426. https://bugzilla.mozilla.org/show_bug.cgi?id=1615315
  427. **Backwards incompatible changes**
  428. None
  429. **Features**
  430. None
  431. **Bug fixes**
  432. None
  433. Version 3.1.0 (January 9th, 2019)
  434. ---------------------------------
  435. **Security fixes**
  436. None
  437. **Backwards incompatible changes**
  438. None
  439. **Features**
  440. * Add ``recognized_tags`` argument to the linkify ``Linker`` class. This
  441. fixes issues when linkifying on its own and having some tags get escaped.
  442. It defaults to a list of HTML5 tags. Thank you, Chad Birch! (#409)
  443. **Bug fixes**
  444. * Add ``six>=1.9`` to requirements. Thank you, Dave Shawley (#416)
  445. * Fix cases where attribute names could have invalid characters in them.
  446. (#419)
  447. * Fix problems with ``LinkifyFilter`` not being able to match links
  448. across ``&amp;``. (#422)
  449. * Fix ``InputStreamWithMemory`` when the ``BleachHTMLParser`` is
  450. parsing ``meta`` tags. (#431)
  451. * Fix doctests. (#357)
  452. Version 3.0.2 (October 11th, 2018)
  453. ----------------------------------
  454. **Security fixes**
  455. None
  456. **Backwards incompatible changes**
  457. None
  458. **Features**
  459. None
  460. **Bug fixes**
  461. * Merge ``Characters`` tokens after sanitizing them. This fixes issues in the
  462. ``LinkifyFilter`` where it was only linkifying parts of urls. (#374)
  463. Version 3.0.1 (October 9th, 2018)
  464. ---------------------------------
  465. **Security fixes**
  466. None
  467. **Backwards incompatible changes**
  468. None
  469. **Features**
  470. * Support Python 3.7. It supported Python 3.7 just fine, but we added 3.7 to
  471. the list of Python environments we test so this is now officially supported.
  472. (#377)
  473. **Bug fixes**
  474. * Fix ``list`` object has no attribute ``lower`` in ``clean``. (#398)
  475. * Fix ``abbr`` getting escaped in ``linkify``. (#400)
  476. Version 3.0.0 (October 3rd, 2018)
  477. ---------------------------------
  478. **Security fixes**
  479. None
  480. **Backwards incompatible changes**
  481. * A bunch of functions were moved from one module to another.
  482. These were moved from ``bleach.sanitizer`` to ``bleach.html5lib_shim``:
  483. * ``convert_entity``
  484. * ``convert_entities``
  485. * ``match_entity``
  486. * ``next_possible_entity``
  487. * ``BleachHTMLSerializer``
  488. * ``BleachHTMLTokenizer``
  489. * ``BleachHTMLParser``
  490. These functions and classes weren't documented and aren't part of the
  491. public API, but people read code and might be using them so we're
  492. considering it an incompatible API change.
  493. If you're using them, you'll need to update your code.
  494. **Features**
  495. * Bleach no longer depends on html5lib. html5lib==1.0.1 is now vendored into
  496. Bleach. You can remove it from your requirements file if none of your other
  497. requirements require html5lib.
  498. This means Bleach will now work fine with other libraries that depend on
  499. html5lib regardless of what version of html5lib they require. (#386)
  500. **Bug fixes**
  501. * Fixed tags getting added when using clean or linkify. This was a
  502. long-standing regression from the Bleach 2.0 rewrite. (#280, #392)
  503. * Fixed ``<isindex>`` getting replaced with a string. Now it gets escaped or
  504. stripped depending on whether it's in the allowed tags or not. (#279)
  505. Version 2.1.4 (August 16th, 2018)
  506. ---------------------------------
  507. **Security fixes**
  508. None
  509. **Backwards incompatible changes**
  510. * Dropped support for Python 3.3. (#328)
  511. **Features**
  512. None
  513. **Bug fixes**
  514. * Handle ambiguous ampersands in correctly. (#359)
  515. Version 2.1.3 (March 5th, 2018)
  516. -------------------------------
  517. **Security fixes**
  518. * Attributes that have URI values weren't properly sanitized if the
  519. values contained character entities. Using character entities, it
  520. was possible to construct a URI value with a scheme that was not
  521. allowed that would slide through unsanitized.
  522. This security issue was introduced in Bleach 2.1. Anyone using
  523. Bleach 2.1 is highly encouraged to upgrade.
  524. https://bugzilla.mozilla.org/show_bug.cgi?id=1442745
  525. **Backwards incompatible changes**
  526. None
  527. **Features**
  528. None
  529. **Bug fixes**
  530. * Fixed some other edge cases for attribute URI value sanitizing and
  531. improved testing of this code.
  532. Version 2.1.2 (December 7th, 2017)
  533. ----------------------------------
  534. **Security fixes**
  535. None
  536. **Backwards incompatible changes**
  537. None
  538. **Features**
  539. None
  540. **Bug fixes**
  541. * Support html5lib-python 1.0.1. (#337)
  542. * Add deprecation warning for supporting html5lib-python < 1.0.
  543. * Switch to semver.
  544. Version 2.1.1 (October 2nd, 2017)
  545. ---------------------------------
  546. **Security fixes**
  547. None
  548. **Backwards incompatible changes**
  549. None
  550. **Features**
  551. None
  552. **Bug fixes**
  553. * Fix ``setup.py`` opening files when ``LANG=``. (#324)
  554. Version 2.1 (September 28th, 2017)
  555. ----------------------------------
  556. **Security fixes**
  557. * Convert control characters (backspace particularly) to "?" preventing
  558. malicious copy-and-paste situations. (#298)
  559. See `<https://github.com/mozilla/bleach/issues/298>`_ for more details.
  560. This affects all previous versions of Bleach. Check the comments on that
  561. issue for ways to alleviate the issue if you can't upgrade to Bleach 2.1.
  562. **Backwards incompatible changes**
  563. * Redid versioning. ``bleach.VERSION`` is no longer available. Use the string
  564. version at ``bleach.__version__`` and parse it with
  565. ``pkg_resources.parse_version``. (#307)
  566. * clean, linkify: linkify and clean should only accept text types; thank you,
  567. Janusz! (#292)
  568. * clean, linkify: accept only unicode or utf-8-encoded str (#176)
  569. **Features**
  570. **Bug fixes**
  571. * ``bleach.clean()`` no longer unescapes entities including ones that are missing
  572. a ``;`` at the end which can happen in urls and other places. (#143)
  573. * linkify: fix http links inside of mailto links; thank you, sedrubal! (#300)
  574. * clarify security policy in docs (#303)
  575. * fix dependency specification for html5lib 1.0b8, 1.0b9, and 1.0b10; thank you,
  576. Zoltán! (#268)
  577. * add Bleach vs. html5lib comparison to README; thank you, Stu Cox! (#278)
  578. * fix KeyError exceptions on tags without href attr; thank you, Alex Defsen!
  579. (#273)
  580. * add test website and scripts to test ``bleach.clean()`` output in browser;
  581. thank you, Greg Guthe!
  582. Version 2.0 (March 8th, 2017)
  583. -----------------------------
  584. **Security fixes**
  585. * None
  586. **Backwards incompatible changes**
  587. * Removed support for Python 2.6. (#206)
  588. * Removed support for Python 3.2. (#224)
  589. * Bleach no longer supports html5lib < 0.99999999 (8 9s).
  590. This version is a rewrite to use the new sanitizing API since the old
  591. one was dropped in html5lib 0.99999999 (8 9s).
  592. If you're using 0.9999999 (7 9s) upgrade to 0.99999999 (8 9s) or higher.
  593. If you're using 1.0b8 (equivalent to 0.9999999 (7 9s)), upgrade to 1.0b9
  594. (equivalent to 0.99999999 (8 9s)) or higher.
  595. * ``bleach.clean`` and friends were rewritten
  596. ``clean`` was reimplemented as an html5lib filter and happens at a different
  597. step in the HTML parsing -> traversing -> serializing process. Because of
  598. that, there are some differences in clean's output as compared with previous
  599. versions.
  600. Amongst other things, this version will add end tags even if the tag in
  601. question is to be escaped.
  602. * ``bleach.clean`` and friends attribute callables now take three arguments:
  603. tag, attribute name and attribute value. Previously they only took attribute
  604. name and attribute value.
  605. All attribute callables will need to be updated.
  606. * ``bleach.linkify`` was rewritten
  607. ``linkify`` was reimplemented as an html5lib Filter. As such, it no longer
  608. accepts a ``tokenizer`` argument.
  609. The callback functions for adjusting link attributes now takes a namespaced
  610. attribute.
  611. Previously you'd do something like this::
  612. def check_protocol(attrs, is_new):
  613. if not attrs.get('href', '').startswith('http:', 'https:')):
  614. return None
  615. return attrs
  616. Now it's more like this::
  617. def check_protocol(attrs, is_new):
  618. if not attrs.get((None, u'href'), u'').startswith(('http:', 'https:')):
  619. # ^^^^^^^^^^^^^^^
  620. return None
  621. return attrs
  622. Further, you need to make sure you're always using unicode values. If you
  623. don't then html5lib will raise an assertion error that the value is not
  624. unicode.
  625. All linkify filters will need to be updated.
  626. * ``bleach.linkify`` and friends had a ``skip_pre`` argument--that's been
  627. replaced with a more general ``skip_tags`` argument.
  628. Before, you might do::
  629. bleach.linkify(some_text, skip_pre=True)
  630. The equivalent with Bleach 2.0 is::
  631. bleach.linkify(some_text, skip_tags=['pre'])
  632. You can skip other tags, too, like ``style`` or ``script`` or other places
  633. where you don't want linkification happening.
  634. All uses of linkify that use ``skip_pre`` will need to be updated.
  635. **Changes**
  636. * Supports Python 3.6.
  637. * Supports html5lib >= 0.99999999 (8 9s).
  638. * There's a ``bleach.sanitizer.Cleaner`` class that you can instantiate with your
  639. favorite clean settings for easy reuse.
  640. * There's a ``bleach.linkifier.Linker`` class that you can instantiate with your
  641. favorite linkify settings for easy reuse.
  642. * There's a ``bleach.linkifier.LinkifyFilter`` which is an htm5lib filter that
  643. you can pass as a filter to ``bleach.sanitizer.Cleaner`` allowing you to clean
  644. and linkify in one pass.
  645. * ``bleach.clean`` and friends can now take a callable as an attributes arg value.
  646. * Tons of bug fixes.
  647. * Cleaned up tests.
  648. * Documentation fixes.
  649. Version 1.5 (November 4th, 2016)
  650. --------------------------------
  651. **Security fixes**
  652. * None
  653. **Backwards incompatible changes**
  654. * clean: The list of ``ALLOWED_PROTOCOLS`` now defaults to http, https and
  655. mailto.
  656. Previously it was a long list of protocols something like ed2k, ftp, http,
  657. https, irc, mailto, news, gopher, nntp, telnet, webcal, xmpp, callto, feed,
  658. urn, aim, rsync, tag, ssh, sftp, rtsp, afs, data. (#149)
  659. **Changes**
  660. * clean: Added ``protocols`` to arguments list to let you override the list of
  661. allowed protocols. Thank you, Andreas Malecki! (#149)
  662. * linkify: Fix a bug involving periods at the end of an email address. Thank you,
  663. Lorenz Schori! (#219)
  664. * linkify: Fix linkification of non-ascii ports. Thank you Alexandre, Macabies!
  665. (#207)
  666. * linkify: Fix linkify inappropriately removing node tails when dropping nodes.
  667. (#132)
  668. * Fixed a test that failed periodically. (#161)
  669. * Switched from nose to py.test. (#204)
  670. * Add test matrix for all supported Python and html5lib versions. (#230)
  671. * Limit to html5lib ``>=0.999,!=0.9999,!=0.99999,<0.99999999`` because 0.9999
  672. and 0.99999 are busted.
  673. * Add support for ``python setup.py test``. (#97)
  674. Version 1.4.3 (May 23rd, 2016)
  675. ------------------------------
  676. **Security fixes**
  677. * None
  678. **Changes**
  679. * Limit to html5lib ``>=0.999,<0.99999999`` because of impending change to
  680. sanitizer api. #195
  681. Version 1.4.2 (September 11, 2015)
  682. ----------------------------------
  683. **Changes**
  684. * linkify: Fix hang in linkify with ``parse_email=True``. (#124)
  685. * linkify: Fix crash in linkify when removing a link that is a first-child. (#136)
  686. * Updated TLDs.
  687. * linkify: Don't remove exterior brackets when linkifying. (#146)
  688. Version 1.4.1 (December 15, 2014)
  689. ---------------------------------
  690. **Changes**
  691. * Consistent order of attributes in output.
  692. * Python 3.4 support.
  693. Version 1.4 (January 12, 2014)
  694. ------------------------------
  695. **Changes**
  696. * linkify: Update linkify to use etree type Treewalker instead of simpletree.
  697. * Updated html5lib to version ``>=0.999``.
  698. * Update all code to be compatible with Python 3 and 2 using six.
  699. * Switch to Apache License.
  700. Version 1.3
  701. -----------
  702. * Used by Python 3-only fork.
  703. Version 1.2.2 (May 18, 2013)
  704. ----------------------------
  705. * Pin html5lib to version 0.95 for now due to major API break.
  706. Version 1.2.1 (February 19, 2013)
  707. ---------------------------------
  708. * ``clean()`` no longer considers ``feed:`` an acceptable protocol due to
  709. inconsistencies in browser behavior.
  710. Version 1.2 (January 28, 2013)
  711. ------------------------------
  712. * ``linkify()`` has changed considerably. Many keyword arguments have been
  713. replaced with a single callbacks list. Please see the documentation for more
  714. information.
  715. * Bleach will no longer consider unacceptable protocols when linkifying.
  716. * ``linkify()`` now takes a tokenizer argument that allows it to skip
  717. sanitization.
  718. * ``delinkify()`` is gone.
  719. * Removed exception handling from ``_render``. ``clean()`` and ``linkify()`` may
  720. now throw.
  721. * ``linkify()`` correctly ignores case for protocols and domain names.
  722. * ``linkify()`` correctly handles markup within an <a> tag.
  723. Version 1.1.5
  724. -------------
  725. Version 1.1.4
  726. -------------
  727. Version 1.1.3 (July 10, 2012)
  728. -----------------------------
  729. * Fix parsing bare URLs when parse_email=True.
  730. Version 1.1.2 (June 1, 2012)
  731. ----------------------------
  732. * Fix hang in style attribute sanitizer. (#61)
  733. * Allow ``/`` in style attribute values.
  734. Version 1.1.1 (February 17, 2012)
  735. ---------------------------------
  736. * Fix tokenizer for html5lib 0.9.5.
  737. Version 1.1.0 (October 24, 2011)
  738. --------------------------------
  739. * ``linkify()`` now understands port numbers. (#38)
  740. * Documented character encoding behavior. (#41)
  741. * Add an optional target argument to ``linkify()``.
  742. * Add ``delinkify()`` method. (#45)
  743. * Support subdomain whitelist for ``delinkify()``. (#47, #48)
  744. Version 1.0.4 (September 2, 2011)
  745. ---------------------------------
  746. * Switch to SemVer git tags.
  747. * Make ``linkify()`` smarter about trailing punctuation. (#30)
  748. * Pass ``exc_info`` to logger during rendering issues.
  749. * Add wildcard key for attributes. (#19)
  750. * Make ``linkify()`` use the ``HTMLSanitizer`` tokenizer. (#36)
  751. * Fix URLs wrapped in parentheses. (#23)
  752. * Make ``linkify()`` UTF-8 safe. (#33)
  753. Version 1.0.3 (June 14, 2011)
  754. -----------------------------
  755. * ``linkify()`` works with 3rd level domains. (#24)
  756. * ``clean()`` supports vendor prefixes in style values. (#31, #32)
  757. * Fix ``linkify()`` email escaping.
  758. Version 1.0.2 (June 6, 2011)
  759. ----------------------------
  760. * ``linkify()`` supports email addresses.
  761. * ``clean()`` supports callables in attributes filter.
  762. Version 1.0.1 (April 12, 2011)
  763. ------------------------------
  764. * ``linkify()`` doesn't drop trailing slashes. (#21)
  765. * ``linkify()`` won't linkify 'libgl.so.1'. (#22)