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

Optional confirmations for multi-line paste and very long paste #4873

Closed
rebane2001 opened this issue Mar 24, 2022 · 10 comments
Closed

Optional confirmations for multi-line paste and very long paste #4873

rebane2001 opened this issue Mar 24, 2022 · 10 comments

Comments

@rebane2001
Copy link

Is your feature request related to a problem? Please describe.
Pasting into a terminal can cause security issues when the clipboard content is multiline, and performance issues when the content is too long.

Describe the solution you'd like
As many other terminals do, it would be great to have an (optional) confirmation when pasting multiline or long content, preferably with a preview. Here is an example of how it can be implemented:

image
image

Of course it wouldn't have to be an external dialog box, this is just an example.

Describe alternatives you've considered
The bracketed paste feature can protect a shell, but this is dependent on the shell supporting it. This is a non-issue for your local shell, but it becomes a problem when SSHing into servers with bracketed paste not enabled. For example, bash in a default Ubuntu Server install does not have bracketed paste enabled, and the busybox sh binary does not support the feature at all. Doing the paste-checking in the terminal emulator instead applies the protection everywhere.

Additional context
This should be an optional configurable feature, as some people find bracketed paste sufficient.

@kovidgoyal
Copy link
Owner

Not something I care about personally. I have never seen an actual
problem caused by pasting anything in a shell in real world usage in over
thirty decades despite all the internet fulminations about it. So I lack
the motivation to implement this. But patches are most welcome. You can
use the confirmation for allowing programs to read from the clipboard as
a guide to implementing it.

@page-down
Copy link
Contributor

Thanks for adding this new feature.
This looks like it could be applied to drag and drop files (URLs with or without newline).

#4734

If you don't have a need for this, do you have a suggestion for a more generic name?

@kovidgoyal
Copy link
Owner

kovidgoyal commented Mar 24, 2022 via email

@linnabraham
Copy link

Seems like the feature doesn't work now.
This is my kitty conf

shell_integration enabled
paste_actions quote-urls-at-prompt,confirm

The quoting url thing works. But I dont get any confirmation dialog when pasting multiline text.

@kovidgoyal
Copy link
Owner

Newlines are confirmed only if bracketed paste is not enabled by the
program running in the terminal, as they are not dangerous when
bracketed paste is on.

@linnabraham
Copy link

I don't know exactly what bracketed paste is.

But let me ask this, my issue is that sometimes when copy pasting commands into a terminal, there is an extra new line which causes cmds to be executed before i have edited it.

I am not concerned about security issues but just convenience. So does kitty allow this?

@rebane2001
Copy link
Author

Bracketed paste does not execute the command if you paste multiple lines.

@kovidgoyal
Copy link
Owner

Turn on bracketed paste in your shell, this has nothing to do with
kitty.

@linnabraham
Copy link

I am using zsh, I cannot find a proper resource documenting this bracketed paste and how to use. Most of the discussions are surrounding bash and readline .

@rebane2001
Copy link
Author

zsh uses bracketed paste by default in most configurations, just look up "zsh bracketed paste" or something. This has nothing to do with the terminal emulator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants