Skip to content

Commit

Permalink
More documentation fixes.
Browse files Browse the repository at this point in the history
* Copy the security paragraph to security.rst
* Fix missing maintainer in docs/index.rst
* Fix incorrect emphasis markup
  • Loading branch information
Anteru committed Aug 20, 2022
1 parent a60ed3d commit 8a528f9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ but we will never be able to eliminate all bugs in this area.

Our recommendations are:

* Ensure that the Pygments process is _terminated_ after a reasonably short
* Ensure that the Pygments process is *terminated* after a reasonably short
timeout. In general Pygments should take seconds at most for reasonably-sized
input.
* _Limit_ the number of concurrent Pygments processes to avoid oversubscription
* *Limit* the number of concurrent Pygments processes to avoid oversubscription
of resources.

The Pygments authors will treat any bug resulting in long processing times with
Expand Down
1 change: 1 addition & 0 deletions doc/docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ Pygments documentation

changelog
authors
security

If you find bugs or have suggestions for the documentation, please submit them
on `GitHub <https://github.com/pygments/pygments>`_.
31 changes: 31 additions & 0 deletions doc/docs/security.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
Security considerations
-----------------------

Pygments provides no guarantees on execution time, which needs to be taken
into consideration when using Pygments to process arbitrary user inputs. For
example, if you have a web service which uses Pygments for highlighting, there
may be inputs which will cause the Pygments process to run "forever" and/or use
significant amounts of memory. This can subsequently be used to perform a
remote denial-of-service attack on the server if the processes are not
terminated quickly.

Unfortunately, it's practically impossible to harden Pygments itself against
those issues: Some regular expressions can result in "catastrophic
backtracking", but other bugs like incorrect matchers can also
cause similar problems, and there is no way to find them in an automated fashion
(short of solving the halting problem.) Pygments has extensive unit tests,
automated randomized testing, and is also tested by `OSS-Fuzz <https://github.com/google/oss-fuzz/tree/master/projects/pygments>`_,
but we will never be able to eliminate all bugs in this area.

Our recommendations are:

* Ensure that the Pygments process is *terminated* after a reasonably short
timeout. In general Pygments should take seconds at most for reasonably-sized
input.
* *Limit* the number of concurrent Pygments processes to avoid oversubscription
of resources.

The Pygments authors will treat any bug resulting in long processing times with
high priority -- it's one of those things that will be fixed in a patch release.
When reporting a bug where you suspect super-linear execution times, please make
sure to attach an input to reproduce it.
3 changes: 1 addition & 2 deletions doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ below.
The authors
-----------

Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*
and **Matthäus Chajdas**.
Pygments is maintained by **Georg Brandl**, e-mail address *georg*\ *@*\ *python.org*, **Matthäus Chajdas** and **Jean Abou-Samra**.

Many lexers and fixes have been contributed by **Armin Ronacher**, the rest of
the `Pocoo <https://dev.pocoo.org/>`_ team and **Tim Hatch**.
Expand Down

0 comments on commit 8a528f9

Please sign in to comment.