Display clipboard contents in the multiple line warning dialog box when pasting into Terminal #11106

Closed
opened 2026-01-31 02:38:48 +00:00 by claunia · 6 comments
Owner

Originally created by @tfennel on GitHub (Oct 21, 2020).

Evil Copy Paste Protection!

Background

It just recently came to my attention that you can do some scary stuff by hiding evil commands inside seemingly safe commands copied from the internet!
As a mostly copy paste developer, I copy things all the time! I never even thought I could copy something and what actually ended up on my clipboard would be something else!

See this site for details:
https://briantracy.xyz/writing/copy-paste-shell.html
This is the tweet that lead to me learning about this:
https://twitter.com/JGamblin/status/1317987698825625600?s=19

So basically, you can copy one thing and then end up pasting another!

What to do?

Well, @cinnamon-msft let me know Terminal already does this:
warning

So what if it also showed the contents of the clipboard so you could see what's really on the clipboard? Like this:
warning2

That's it! That's the idea!

Originally created by @tfennel on GitHub (Oct 21, 2020). # Evil Copy Paste Protection! ## Background It just recently came to my attention that you can do some scary stuff by hiding evil commands inside seemingly safe commands copied from the internet! As a mostly copy paste developer, I copy things all the time! I never even thought I could copy something and what actually ended up on my clipboard would be something else! **See this site for details:** [https://briantracy.xyz/writing/copy-paste-shell.html](https://briantracy.xyz/writing/copy-paste-shell.html) **This is the tweet that lead to me learning about this:** [https://twitter.com/JGamblin/status/1317987698825625600?s=19](https://twitter.com/JGamblin/status/1317987698825625600?s=19) So basically, you can copy one thing and then end up pasting another! ## What to do? Well, @cinnamon-msft let me know Terminal already does this: ![warning](https://user-images.githubusercontent.com/18040091/96785147-3c779900-13a3-11eb-92e5-64b2d687cee5.png) So what if it also **showed** the contents of the clipboard so you could see what's really on the clipboard? Like this: ![warning2](https://user-images.githubusercontent.com/18040091/96785783-2c13ee00-13a4-11eb-87ff-dfdc40ffe0f0.png) That's it! That's the idea!
Author
Owner

@DHowett commented on GitHub (Oct 21, 2020):

I think we had a discussion about this at the time; my stance was summed up with this image:

image

Do we have a better solution?

@DHowett commented on GitHub (Oct 21, 2020): I think we had a discussion about this at the time; my stance was summed up with this image: ![image](https://user-images.githubusercontent.com/189190/96786878-ba3ca400-13a5-11eb-9ba6-2bcc551590aa.png) Do we have a better solution?
Author
Owner

@tfennel commented on GitHub (Oct 21, 2020):

Maybe show the first 100 characters, snip with ellipsis then have a "Show full clipboard" link that parents out a bigger display window?
warning3

@tfennel commented on GitHub (Oct 21, 2020): Maybe show the first 100 characters, snip with ellipsis then have a "Show full clipboard" link that parents out a bigger display window? ![warning3](https://user-images.githubusercontent.com/18040091/96794233-b06d6d80-13b2-11eb-8b32-e12e8b6b2b12.png)
Author
Owner

@ghost commented on GitHub (Nov 9, 2020):

Hi. I'm trying to convert to winrt::hstring from winrt::Windows::Foundation::IAsyncOperation<winrt::hstring> that I got from GetTextAsync() so that I can bind to Terminalpage.idl, but, I can't. Is there better way ?

@ghost commented on GitHub (Nov 9, 2020): Hi. I'm trying to convert to `winrt::hstring` from `winrt::Windows::Foundation::IAsyncOperation<winrt::hstring>` that I got from `GetTextAsync()` so that I can bind to Terminalpage.idl, but, I can't. Is there better way ?
Author
Owner

@mpela81 commented on GitHub (Nov 10, 2020):

(I'm not author or expert so feel free to discard my comment 😄)
@Hegunumo Doesn't TerminalPage::_PasteFromClipboardHandler() already read text from GetTextAsync()? As the operation is asynchronous it has to co_await to get the string from it.

@mpela81 commented on GitHub (Nov 10, 2020): (I'm not author or expert so feel free to discard my comment 😄) @Hegunumo Doesn't `TerminalPage::_PasteFromClipboardHandler()` already read text from `GetTextAsync()`? As the operation is asynchronous it has to `co_await` to get the string from it.
Author
Owner

@DHowett commented on GitHub (Jan 12, 2021):

@tfennel how's the gif in #8744 strike ya?

@DHowett commented on GitHub (Jan 12, 2021): @tfennel how's the gif in #8744 strike ya?
Author
Owner

@ghost commented on GitHub (Jan 28, 2021):

:tada:This issue was addressed in #8744, which has now been successfully released as Windows Terminal Preview v1.6.10272.0.🎉

Handy links:

@ghost commented on GitHub (Jan 28, 2021): :tada:This issue was addressed in #8744, which has now been successfully released as `Windows Terminal Preview v1.6.10272.0`.:tada: Handy links: * [Release Notes](https://github.com/microsoft/terminal/releases/tag/v1.6.10272.0) * [Store Download](https://www.microsoft.com/store/apps/9n8g5rfz9xk3?cid=storebadge&ocid=badge)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#11106