METADATA 27 KB

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