Skip to content
Myr

expand section on copy/paste security

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

authored by David Lord · committed by David Lord · parent 0b6a05f · Browse files · 1 file+16 added−9 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+16 added−9 removed

  • other:+16 added−9 removed

1 file+16 added−9 removed

modified:docs/security.rst+16 added-9 removed
257 unmodified lines
258 or upgrade your key incorrectly.259260- https://developer.mozilla.org/en-US/docs/Web/HTTP/Public_Key_Pinning261262Copy/Paste Security Issues263~~~~~~~~~~~~~~~~~~~~~~~~~~262265If your website allows users to upload their own code, hidden characters266such as the backspace character (``\b``, ``^H``) can cause the code to267have a different meaning when copy and pasted into terminals.263Copy/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 as270``import yosemite`` but becomes ``import os`` when pasted in a terminal.271``import yosemite`` in HTML, but the backspaces are applied when pasted272into a terminal, and it becomes ``import os``.273272Consider applying extra filtering, such as replacing all ``\b``273characters.274If 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", "")281279- https://security.stackexchange.com/q/39118282Most 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.