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(compute/validate): remove broken decompression bomb check #984

Merged
merged 2 commits into from
Jul 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions pkg/commands/compute/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,10 @@ func createService(
errLog fsterr.LogInterface,
out io.Writer,
) (serviceID string, serviceVersion *fastly.Version, err error) {
if !f.AcceptDefaults && !f.NonInteractive {
text.Break(out)
}

err = spinner.Start()
if err != nil {
return "", nil, err
Expand Down
10 changes: 0 additions & 10 deletions pkg/commands/compute/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,6 @@ func packageFiles(path string, fn func(archiver.File) error) error {
}
defer tr.Close()

// Track overall package size
var pkgSize int64

for {
f, err := tr.Read()
if err == io.EOF {
Expand All @@ -130,13 +127,6 @@ func packageFiles(path string, fn func(archiver.File) error) error {
return fmt.Errorf("error reading package: %w", err)
}

// Avoids G110: Potential DoS vulnerability via decompression bomb (gosec).
pkgSize += f.Size()
if pkgSize > MaxPackageSize {
f.Close()
return fmt.Errorf("package size exceeded 100MB limit")
}

header, ok := f.Header.(*tar.Header)
if !ok || header.Typeflag != tar.TypeReg {
f.Close()
Expand Down