5 ms·
The bug here is that between the "copy" and "paste" operations, a script running in the background can win the race to rewrite clipboard contents before "paste"
by omoikane 3y ago
The bug here is that between the "copy" and "paste" operations, a script running in the background can win the race to rewrite clipboard contents before "paste" happens. Thus the defense needs to happen on the "paste" side, changing the "copy" side would result in the same race.
A solution is bracketed paste[1] as mentioned in earlier comments[2], which would allow the user to examine a pasted command before running it.
[1] https://en.wikipedia.org/wiki/Bracketed-paste https://en.wikipedia.org/wiki/Bracketed-paste
[2] https://news.ycombinator.com/item?id=37966924 https://news.ycombinator.com/item?id=37966924