Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
tfennel opened this issue Oct 21, 2020 · 6 comments · Fixed by #8744
Closed
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.

Comments

@tfennel
Copy link
Member

tfennel commented 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!

@tfennel tfennel added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Oct 21, 2020
@ghost ghost added Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Oct 21, 2020
@zadjii-msft zadjii-msft added Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. and removed Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. labels Oct 21, 2020
@ghost ghost removed the Needs-Tag-Fix Doesn't match tag requirements label Oct 21, 2020
@zadjii-msft zadjii-msft added this to the Terminal Backlog milestone Oct 21, 2020
@DHowett
Copy link
Member

DHowett commented 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?

@tfennel
Copy link
Member Author

tfennel commented 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

@DHowett DHowett added Help Wanted We encourage anyone to jump in on these. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Oct 23, 2020
@ghost
Copy link

ghost commented 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 ?

@mpela81
Copy link
Contributor

mpela81 commented 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.

@ghost ghost added the In-PR This issue has a related PR label Jan 11, 2021
@DHowett
Copy link
Member

DHowett commented Jan 12, 2021

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

@ghost ghost closed this as completed in #8744 Jan 12, 2021
@ghost ghost removed the In-PR This issue has a related PR label Jan 12, 2021
ghost pushed a commit that referenced this issue Jan 12, 2021
When we display a dialog to warn the user that they are doing a
multi-line paste, we show the clipboard contents

The contents are shown in a scroll viewer with a fixed maximum height.

Closes #7997
@ghost ghost added the Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release. label Jan 12, 2021
@ghost
Copy link

ghost commented Jan 28, 2021

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

Handy links:

mpela81 pushed a commit to mpela81/terminal that referenced this issue Jan 28, 2021
…oft#8744)

When we display a dialog to warn the user that they are doing a
multi-line paste, we show the clipboard contents

The contents are shown in a scroll viewer with a fixed maximum height.

Closes microsoft#7997
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-UserInterface Issues pertaining to the user interface of the Console or Terminal Help Wanted We encourage anyone to jump in on these. Issue-Task It's a feature request, but it doesn't really need a major design. Product-Terminal The new Windows Terminal. Resolution-Fix-Committed Fix is checked in, but it might be 3-4 weeks until a release.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants