ssh kitten: When using python interpreter fix symlinks with absolute paths not working with the copy command

This commit is contained in:
Kovid Goyal 2025-02-09 11:12:47 +05:30
parent 04f28e4b7a
commit 85ba68b59c
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -212,7 +212,10 @@ def get_data():
data = base64.standard_b64decode(data)
with temporary_directory(dir=HOME, prefix='.kitty-ssh-kitten-untar-') as tdir, tarfile.open(fileobj=io.BytesIO(data)) as tf:
try:
tf.extractall(tdir, filter='data')
# We have to use fully_trusted as otherwise it refuses to extract,
# for example, symlinks that point to absolute paths outside
# tdir.
tf.extractall(tdir, filter='fully_trusted')
except TypeError:
tf.extractall(tdir)
with open(tdir + '/data.sh') as f: