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

Fix archive extraction #213

Merged
merged 2 commits into from
May 10, 2024
Merged

Fix archive extraction #213

merged 2 commits into from
May 10, 2024

Conversation

egibs
Copy link
Member

@egibs egibs commented May 10, 2024

Closes: #212

filepath.Ext(path) does not handle multi-suffix file extensions (e.g. .tar.gz).

This PR uses getExt instead (I should have noticed this in #205 but I was testing with .gem files).

I confirmed that this is working.

Original:

❯ go run . --format simple /Users/egibs/Downloads/apko_0.13.2_darwin_amd64.tar.gz
time=2024-05-10T15:03:10.707-05:00 level=ERROR msg="unable to process /Users/egibs/Downloads/apko_0.13.2_darwin_amd64.tar.gz: extract to temp: extract: failed to extract nested archive: failed to create gzip reader: gzip: invalid header"

Fixed:

❯ go run . --format simple /Users/egibs/Downloads/apko_0.13.2_darwin_amd64.tar.gz
#
# /var/folders/3g/88131l9j11x995ppjbxsvhbh0000gn/T/apko_0.13.2_darwin_amd64.tar.gz1508281868/apko_0.13.2_darwin_amd64/apko
archives/zip
combo/dropper/shell
combo/stealer/ssh
compression/bzip2
compression/gzip
compression/zstd
crypto/aes
crypto/ecdsa
crypto/ed25519
crypto/tls
data/embedded/pem/certificate
data/embedded/pem/test_key
data/embedded/ssh/signature
data/embedded/zstd
encoding/base64
encoding/json
encoding/json/decode
encoding/json/encode
env/HOME
env/USER
evasion/content/length/0
exec/program
fs/blkid
fs/directory/create
fs/directory/list
fs/directory/remove
fs/fifo/create
fs/file/delete
fs/file/read
fs/file/stat
fs/file/truncate
fs/file/write
fs/link/create
fs/link/read
fs/lock/update
fs/mount
fs/node/create
fs/permission/chown
fs/permission/modify
fs/swap/off
fs/swap/on
fs/symlink/resolve
fs/tempfile/create
fs/unmount
hash/blake2b
hash/md5
kernel/cpu/info
kernel/pivot_root
kernel/platform
kernel/ptrace
net/dns
net/dns/reverse
net/dns/txt
net/download
net/fetch
net/hostname/resolve
net/hostport/parse
net/http/accept/encoding
net/http/auth
net/http/cookies
net/http/form/upload
net/http/post
net/http/request
net/http2
net/http_proxy
net/interface/list
net/ip
net/ip/multicast/send
net/ip/parse
net/mac/address
net/sendfile
net/socket/connect
net/socket/listen
net/socket/local/address
net/socket/peer/address
net/socket/receive
net/socket/send
net/socks5
net/ssh
net/stat
net/udp/receive
net/udp/send
net/upload
net/url
net/url/encode
net/url/request
process/chroot
process/create
process/find
process/multithreaded
process/unshare
process/username/get
ref/daemon
ref/ip_port
ref/path/bin/su
ref/path/etc
ref/path/etc/hosts
ref/path/etc/resolv.conf
ref/path/hidden
ref/path/home
ref/path/home/config
ref/path/relative
ref/path/root
ref/path/users
ref/path/usr/bin
ref/path/usr/local
ref/path/usr/sbin
ref/path/var
ref/site/url
ref/words/exclamation
ref/words/heartbeat
ref/words/password
ref/words/plugin
ref/words/server_address
secrets/keychain
secrets/private_key
secrets/ssh
security_controls/linux/selinux
shell/background/sleep
shell/exec
time/clock/set

@egibs egibs requested a review from tstromberg May 10, 2024 20:03
@tstromberg tstromberg merged commit 94e0a41 into chainguard-dev:main May 10, 2024
8 checks passed
@egibs egibs deleted the fix-archives branch June 10, 2024 14:22
egibs pushed a commit to egibs/malcontent that referenced this pull request Aug 5, 2024
egibs pushed a commit to egibs/malcontent that referenced this pull request Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

.tar.gz extractions are broken
2 participants