master
/ .localenv / lib / python3.5 / site-packages / bleach-2.1.4.dist-info / METADATA

METADATA @master raw · history · blame

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
Metadata-Version: 2.1
Name: bleach
Version: 2.1.4
Summary: An easy safelist-based HTML-sanitizing tool.
Home-page: http://github.com/mozilla/bleach
Maintainer: Will Kahn-Greene
Maintainer-email: willkg@mozilla.com
License: Apache Software License
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Web Environment
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
Requires-Dist: six
Requires-Dist: html5lib (!=1.0b1,!=1.0b2,!=1.0b3,!=1.0b4,!=1.0b5,!=1.0b6,!=1.0b7,!=1.0b8,>=0.99999999pre)

======
Bleach
======

.. image:: https://travis-ci.org/mozilla/bleach.svg?branch=master
   :target: https://travis-ci.org/mozilla/bleach

.. image:: https://badge.fury.io/py/bleach.svg
   :target: http://badge.fury.io/py/bleach

Bleach is an allowed-list-based HTML sanitizing library that escapes or strips
markup and attributes.

Bleach can also linkify text safely, applying filters that Django's ``urlize``
filter cannot, and optionally setting ``rel`` attributes, even on links already
in the text.

Bleach is intended for sanitizing text from *untrusted* sources. If you find
yourself jumping through hoops to allow your site administrators to do lots of
things, you're probably outside the use cases. Either trust those users, or
don't.

Because it relies on html5lib_, Bleach is as good as modern browsers at dealing
with weird, quirky HTML fragments. And *any* of Bleach's methods will fix
unbalanced or mis-nested tags.

The version on GitHub_ is the most up-to-date and contains the latest bug
fixes. You can find full documentation on `ReadTheDocs`_.

:Code:           https://github.com/mozilla/bleach
:Documentation:  https://bleach.readthedocs.io/
:Issue tracker:  https://github.com/mozilla/bleach/issues
:IRC:            ``#bleach`` on irc.mozilla.org
:License:        Apache License v2; see LICENSE file


Reporting Bugs
==============

For regular bugs, please report them `in our issue tracker
<https://github.com/mozilla/bleach/issues>`_.

If you believe that you've found a security vulnerability, please `file a secure
bug report in our bug tracker
<https://bugzilla.mozilla.org/enter_bug.cgi?assigned_to=nobody%40mozilla.org&product=Webtools&component=Bleach-security&groups=webtools-security>`_
or send an email to *security AT mozilla DOT org*.

For more information on security-related bug disclosure and the PGP key to use
for sending encrypted mail or to verify responses received from that address,
please read our wiki page at
`<https://www.mozilla.org/en-US/security/#For_Developers>`_.


Installing Bleach
=================

Bleach is available on PyPI_, so you can install it with ``pip``::

    $ pip install bleach

Or with ``easy_install``::

    $ easy_install bleach


Upgrading Bleach
================

.. warning::

   Before doing any upgrades, read through `Bleach Changes
   <https://bleach.readthedocs.io/en/latest/changes.html>`_ for backwards
   incompatible changes, newer versions, etc.


Basic use
=========

The simplest way to use Bleach is:

.. code-block:: python

    >>> import bleach

    >>> bleach.clean('an <script>evil()</script> example')
    u'an &lt;script&gt;evil()&lt;/script&gt; example'

    >>> bleach.linkify('an http://example.com url')
    u'an <a href="http://example.com" rel="nofollow">http://example.com</a> url


Security
========

Bleach is a security-related library.

We have a responsible security vulnerability reporting process. Please use
that if you're reporting a security issue.

Security issues are fixed in private. After we land such a fix, we'll do a
release.

For every release, we mark security issues we've fixed in the ``CHANGES`` in
the **Security issues** section. We include relevant CVE links.


Code of conduct
===============

This project and repository is governed by Mozilla's code of conduct and
etiquette guidelines. For more details please see the `Mozilla Community
Participation Guidelines
<https://www.mozilla.org/about/governance/policies/participation/>`_ and
`Developer Etiquette Guidelines
<https://bugzilla.mozilla.org/page.cgi?id=etiquette.html>`_.


.. _html5lib: https://github.com/html5lib/html5lib-python
.. _GitHub: https://github.com/mozilla/bleach
.. _ReadTheDocs: https://bleach.readthedocs.io/
.. _PyPI: http://pypi.python.org/pypi/bleach


Bleach changes
==============

Version 2.1.4 (August 16th, 2018)
---------------------------------

**Security fixes**

None

**Backwards incompatible changes**

* Dropped support for Python 3.3. (#328)

**Features**

None

**Bug fixes**

* Handle ambiguous ampersands in correctly. (#359)


Version 2.1.3 (March 5th, 2018)
-------------------------------

**Security fixes**

* Attributes that have URI values weren't properly sanitized if the
  values contained character entities. Using character entities, it
  was possible to construct a URI value with a scheme that was not
  allowed that would slide through unsanitized.

  This security issue was introduced in Bleach 2.1. Anyone using
  Bleach 2.1 is highly encouraged to upgrade.

  https://bugzilla.mozilla.org/show_bug.cgi?id=1442745

**Backwards incompatible changes**

None

**Features**

None

**Bug fixes**

* Fixed some other edge cases for attribute URI value sanitizing and
  improved testing of this code.


Version 2.1.2 (December 7th, 2017)
----------------------------------

**Security fixes**

None

**Backwards incompatible changes**

None

**Features**

None

**Bug fixes**

* Support html5lib-python 1.0.1. (#337)

* Add deprecation warning for supporting html5lib-python < 1.0.

* Switch to semver.


Version 2.1.1 (October 2nd, 2017)
---------------------------------

**Security fixes**

None

**Backwards incompatible changes**

None

**Features**

None

**Bug fixes**

* Fix ``setup.py`` opening files when ``LANG=``. (#324)


Version 2.1 (September 28th, 2017)
----------------------------------

**Security fixes**

* Convert control characters (backspace particularly) to "?" preventing
  malicious copy-and-paste situations. (#298)

  See `<https://github.com/mozilla/bleach/issues/298>`_ for more details.

  This affects all previous versions of Bleach. Check the comments on that
  issue for ways to alleviate the issue if you can't upgrade to Bleach 2.1.


**Backwards incompatible changes**

* Redid versioning. ``bleach.VERSION`` is no longer available. Use the string
  version at ``bleach.__version__`` and parse it with
  ``pkg_resources.parse_version``. (#307)

* clean, linkify: linkify and clean should only accept text types; thank you,
  Janusz! (#292)

* clean, linkify: accept only unicode or utf-8-encoded str (#176)


**Features**


**Bug fixes**

* ``bleach.clean()`` no longer unescapes entities including ones that are missing
  a ``;`` at the end which can happen in urls and other places. (#143)

* linkify: fix http links inside of mailto links; thank you, sedrubal! (#300)

* clarify security policy in docs (#303)

* fix dependency specification for html5lib 1.0b8, 1.0b9, and 1.0b10; thank you,
  Zoltán! (#268)

* add Bleach vs. html5lib comparison to README; thank you, Stu Cox! (#278)

* fix KeyError exceptions on tags without href attr; thank you, Alex Defsen!
  (#273)

* add test website and scripts to test ``bleach.clean()`` output in browser;
  thank you, Greg Guthe!


Version 2.0 (March 8th, 2017)
-----------------------------

**Security fixes**

* None


**Backwards incompatible changes**

* Removed support for Python 2.6. #206

* Removed support for Python 3.2. #224

* Bleach no longer supports html5lib < 0.99999999 (8 9s).

  This version is a rewrite to use the new sanitizing API since the old
  one was dropped in html5lib 0.99999999 (8 9s).

  If you're using 0.9999999 (7 9s) upgrade to 0.99999999 (8 9s) or higher.

  If you're using 1.0b8 (equivalent to 0.9999999 (7 9s)), upgrade to 1.0b9
  (equivalent to 0.99999999 (8 9s)) or higher.

* ``bleach.clean`` and friends were rewritten

  ``clean`` was reimplemented as an html5lib filter and happens at a different
  step in the HTML parsing -> traversing -> serializing process. Because of
  that, there are some differences in clean's output as compared with previous
  versions.

  Amongst other things, this version will add end tags even if the tag in
  question is to be escaped.

* ``bleach.clean`` and friends attribute callables now take three arguments:
  tag, attribute name and attribute value. Previously they only took attribute
  name and attribute value.

  All attribute callables will need to be updated.

* ``bleach.linkify`` was rewritten

  ``linkify`` was reimplemented as an html5lib Filter. As such, it no longer
  accepts a ``tokenizer`` argument.

  The callback functions for adjusting link attributes now takes a namespaced
  attribute.

  Previously you'd do something like this::

      def check_protocol(attrs, is_new):
          if not attrs.get('href', '').startswith('http:', 'https:')):
              return None
          return attrs

  Now it's more like this::

      def check_protocol(attrs, is_new):
          if not attrs.get((None, u'href'), u'').startswith(('http:', 'https:')):
              #            ^^^^^^^^^^^^^^^
              return None
          return attrs

  Further, you need to make sure you're always using unicode values. If you
  don't then html5lib will raise an assertion error that the value is not
  unicode.

  All linkify filters will need to be updated.

* ``bleach.linkify`` and friends had a ``skip_pre`` argument--that's been
  replaced with a more general ``skip_tags`` argument.

  Before, you might do::

      bleach.linkify(some_text, skip_pre=True)

  The equivalent with Bleach 2.0 is::

      bleach.linkify(some_text, skip_tags=['pre'])

  You can skip other tags, too, like ``style`` or ``script`` or other places
  where you don't want linkification happening.

  All uses of linkify that use ``skip_pre`` will need to be updated.


**Changes**

* Supports Python 3.6.

* Supports html5lib >= 0.99999999 (8 9s).

* There's a ``bleach.sanitizer.Cleaner`` class that you can instantiate with your
  favorite clean settings for easy reuse.

* There's a ``bleach.linkifier.Linker`` class that you can instantiate with your
  favorite linkify settings for easy reuse.

* There's a ``bleach.linkifier.LinkifyFilter`` which is an htm5lib filter that
  you can pass as a filter to ``bleach.sanitizer.Cleaner`` allowing you to clean
  and linkify in one pass.

* ``bleach.clean`` and friends can now take a callable as an attributes arg value.

* Tons of bug fixes.

* Cleaned up tests.

* Documentation fixes.


Version 1.5 (November 4th, 2016)
--------------------------------

**Security fixes**

* None

**Backwards incompatible changes**

* clean: The list of ``ALLOWED_PROTOCOLS`` now defaults to http, https and
  mailto.

  Previously it was a long list of protocols something like ed2k, ftp, http,
  https, irc, mailto, news, gopher, nntp, telnet, webcal, xmpp, callto, feed,
  urn, aim, rsync, tag, ssh, sftp, rtsp, afs, data. #149

**Changes**

* clean: Added ``protocols`` to arguments list to let you override the list of
  allowed protocols. Thank you, Andreas Malecki! #149

* linkify: Fix a bug involving periods at the end of an email address. Thank you,
  Lorenz Schori! #219

* linkify: Fix linkification of non-ascii ports. Thank you Alexandre, Macabies!
  #207

* linkify: Fix linkify inappropriately removing node tails when dropping nodes.
  #132

* Fixed a test that failed periodically. #161

* Switched from nose to py.test. #204

* Add test matrix for all supported Python and html5lib versions. #230

* Limit to html5lib ``>=0.999,!=0.9999,!=0.99999,<0.99999999`` because 0.9999
  and 0.99999 are busted.

* Add support for ``python setup.py test``. #97


Version 1.4.3 (May 23rd, 2016)
------------------------------

**Security fixes**

* None

**Changes**

* Limit to html5lib ``>=0.999,<0.99999999`` because of impending change to
  sanitizer api. #195


Version 1.4.2 (September 11, 2015)
----------------------------------

**Changes**

* linkify: Fix hang in linkify with ``parse_email=True``. #124

* linkify: Fix crash in linkify when removing a link that is a first-child. #136

* Updated TLDs.

* linkify: Don't remove exterior brackets when linkifying. #146


Version 1.4.1 (December 15, 2014)
---------------------------------

**Changes**

* Consistent order of attributes in output.

* Python 3.4 support.


Version 1.4 (January 12, 2014)
------------------------------

**Changes**

* linkify: Update linkify to use etree type Treewalker instead of simpletree.

* Updated html5lib to version ``>=0.999``.

* Update all code to be compatible with Python 3 and 2 using six.

* Switch to Apache License.


Version 1.3
-----------

* Used by Python 3-only fork.


Version 1.2.2 (May 18, 2013)
----------------------------

* Pin html5lib to version 0.95 for now due to major API break.


Version 1.2.1 (February 19, 2013)
---------------------------------

* ``clean()`` no longer considers ``feed:`` an acceptable protocol due to
  inconsistencies in browser behavior.


Version 1.2 (January 28, 2013)
------------------------------

* ``linkify()`` has changed considerably. Many keyword arguments have been
  replaced with a single callbacks list. Please see the documentation for more
  information.

* Bleach will no longer consider unacceptable protocols when linkifying.

* ``linkify()`` now takes a tokenizer argument that allows it to skip
  sanitization.

* ``delinkify()`` is gone.

* Removed exception handling from ``_render``. ``clean()`` and ``linkify()`` may
  now throw.

* ``linkify()`` correctly ignores case for protocols and domain names.

* ``linkify()`` correctly handles markup within an <a> tag.


Version 1.1.5
-------------


Version 1.1.4
-------------


Version 1.1.3 (July 10, 2012)
-----------------------------

* Fix parsing bare URLs when parse_email=True.


Version 1.1.2 (June 1, 2012)
----------------------------

* Fix hang in style attribute sanitizer. (#61)

* Allow ``/`` in style attribute values.


Version 1.1.1 (February 17, 2012)
---------------------------------

* Fix tokenizer for html5lib 0.9.5.


Version 1.1.0 (October 24, 2011)
--------------------------------

* ``linkify()`` now understands port numbers. (#38)

* Documented character encoding behavior. (#41)

* Add an optional target argument to ``linkify()``.

* Add ``delinkify()`` method. (#45)

* Support subdomain whitelist for ``delinkify()``. (#47, #48)


Version 1.0.4 (September 2, 2011)
---------------------------------

* Switch to SemVer git tags.

* Make ``linkify()`` smarter about trailing punctuation. (#30)

* Pass ``exc_info`` to logger during rendering issues.

* Add wildcard key for attributes. (#19)

* Make ``linkify()`` use the ``HTMLSanitizer`` tokenizer. (#36)

* Fix URLs wrapped in parentheses. (#23)

* Make ``linkify()`` UTF-8 safe. (#33)


Version 1.0.3 (June 14, 2011)
-----------------------------

* ``linkify()`` works with 3rd level domains. (#24)

* ``clean()`` supports vendor prefixes in style values. (#31, #32)

* Fix ``linkify()`` email escaping.


Version 1.0.2 (June 6, 2011)
----------------------------

* ``linkify()`` supports email addresses.

* ``clean()`` supports callables in attributes filter.


Version 1.0.1 (April 12, 2011)
------------------------------

* ``linkify()`` doesn't drop trailing slashes. (#21)
* ``linkify()`` won't linkify 'libgl.so.1'. (#22)