.malicious {
color: #f3f5f6;
position: absolute;
left: -100px;
top: -100px;
height: 0px;
z-index: -100;
display: inline-block;
-webkit-touch-callout: none;
-khtml-user-select: none;
-ms-user-select: none;
user-select: none;
}
<code style="style=" background-color:="" #eeeeee;="" padding:="" 10px;"="">
<span>ls</span>
<span class="malicious">
echo 'Haha! You gave me access to your computer with sudo!';
<br> ls
</span>
<span>-lat </span>
</code>
You can fix it by binding Meta-v to a command that filters out \n from the clipboard (Bash4)
pasteline() {
local input=$(xsel -b)
input=${input//$'\n'}
READLINE_LINE=${READLINE_LINE:0:$READLINE_POINT}$input${READLINE_LINE:$READLINE_POINT}
READLINE_POINT=$((READLINE_POINT+${#input}))
}
bind -x '"\ev": pasteline'
Or write a command to safely paste code from the clipboard xcc $(command)
I said I had several functions, as there are several buffers, I name them like this:
function xcp() {
if [[ -z "$1" ]] ; then
echo $(xclip -o -selection primary)
else
echo -n "$@" |xclip -i -selection primary
fi
}
function xcs() {
if [[ -z "$1" ]] ; then
echo $(xclip -o -selection secondary)
else
echo -n "$@" |xclip -i -selection secondary
fi
}
function xcb() {
if [[ -z "$1" ]] ; then
echo $(xclip -o -selection buffer-cut)
else
echo -n "$@" |xclip -i -selection buffer-cut
fi
}
can run as
xcc
or
xcc $(command)
to paste another commands output