mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-07-02 03:52:49 -05:00
Sanitise control characters from paste data by default.
This is a mild security measure against malicious clipboard-writing. It's only mild, because of course there are situations in which even a sanitised paste could be successfully malicious (imagine someone managing to write the traditional 'rm -rf' command into your clipboard when you were going to paste to a shell prompt); but it at least allows pasting into typical text editors without also allowing the control sequence that exits the editor UI and returns to the shell prompt. This is a configurable option, because there's no well defined line to be drawn between acceptable and unacceptable pastes, and it's very plausible that users will have sensible use cases for pasting things outside the list of permitted characters, or cases in which they know they trust the clipboard-writer. I for one certainly find it useful on occasion to deliberately construct a paste containing control sequences that automate a terminal-based UI. While I'm at it, when bracketed paste mode is enabled, we also prevent pasting of data that includes the 'end bracketed paste' sequence somewhere in the middle. I really _hope_ nobody was treating bracketed paste mode as a key part of their security boundary, but then again, I also can't imagine that anyone had an actually sensible use case for deliberately making a bracketed paste be only partly bracketed, and it's an easy change while I'm messing about in this area anyway.
This commit is contained in:
Reference in New Issue
Block a user