Hey! So I recently ran into an issue regarding directory ownership changes
when extracting certain tar files.

*How to reproduce:*
You can test this out locally like so with docker
Start a new alpine container *docker run -it --rm alpine ash*
Create some random folder structure to archive *mkdir -p ~/test/folder*
Change to test dir *cd ~/test*
Change ownership to something random *chown -R 1234:1234 .*
Create an archive like so *tar -zcf test.tar.gz .*
And extract it somewhere *tar -zxf test.tar.gz -C /var*
Now the /var ownership is *1234:1234*

*The implications:*
This means that if for example I extract the archive that is created in a
similar manner to for example /root, it will mess up the root directory
ownership (possibly) and can pretty much brick the instance

I understand that there are flags regarding ownership and permissions when
extracting archives, but I do think that using the . should not make it so
that after extracting the archive it changes ownership of the target
directory

[image: Printful Logo] <https://printful.com/>
Karlis Abele,
System Administrator & DevOps Engineer
Phone: 28 466 009 <+37128466009>
Email: karlis.ab...@printful.com
Website: www.printful.com <http://printful.com/>

[image: Facebook] <https://www.facebook.com/printful/> [image: Twitter]
<https://twitter.com/Printful> [image: Instagram]
<https://www.instagram.com/printfulhq/> [image: Youtube]
<https://www.youtube.com/channel/UCnzsJ4Wvmug35USak9mGx3w>

Reply via email to