Skip to content
Myr

Merge pull request #3633 from kx-chen/add-copy-paste-security

Before adoption: this commit came in with the history the project adopted, so no landing records it.

security.rst: Add section on copy/paste security

authored by David Lord · committed by GitHub · parents 93dd170, 51686f5 · Browse files · 1 file+26 added−0 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+26 added−0 removed

  • other:+26 added−0 removed

1 file+26 added−0 removed

modified:docs/security.rst+26 added
256 unmodified lines
257 Be careful when enabling this, as it is very difficult to undo if you set up258 or upgrade your key incorrectly.259260- https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning261262263Copy/Paste to Terminal264----------------------265266Hidden characters such as the backspace character (``\b``, ``^H``) can267cause text to render differently in HTML than how it is interpreted if268`pasted into a terminal <https://security.stackexchange.com/q/39118>`__.269270For example, ``import y\bose\bm\bi\bt\be\b`` renders as271``import yosemite`` in HTML, but the backspaces are applied when pasted272into a terminal, and it becomes ``import os``.273274If you expect users to copy and paste untrusted code from your site,275such as from comments posted by users on a technical blog, consider276applying extra filtering, such as replacing all ``\b`` characters.277278.. code-block:: python279280 body = body.replace("\b", "")281282Most modern terminals will warn about and remove hidden characters when283pasting, so this isn't strictly necessary. It's also possible to craft284dangerous commands in other ways that aren't possible to filter.285Depending on your site's use case, it may be good to show a warning286about copying code in general.