Skip to content

Commit 1b77fe6

Browse files
Bump helm.sh/helm/v3 from 3.16.4 to 3.17.3
Bumps [helm.sh/helm/v3](https://github.com/helm/helm) from 3.16.4 to 3.17.3. - [Release notes](https://github.com/helm/helm/releases) - [Commits](helm/helm@v3.16.4...v3.17.3) --- updated-dependencies: - dependency-name: helm.sh/helm/v3 dependency-version: 3.17.3 dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]>
1 parent 111fb75 commit 1b77fe6

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ require (
162162
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
163163
gopkg.in/inf.v0 v0.9.1 // indirect
164164
gopkg.in/yaml.v3 v3.0.1 // indirect
165-
helm.sh/helm/v3 v3.17.1 // indirect
165+
helm.sh/helm/v3 v3.17.3 // indirect
166166
k8s.io/apiserver v0.32.3 // indirect
167167
k8s.io/cli-runtime v0.32.2 // indirect
168168
k8s.io/component-base v0.32.3 // indirect

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -480,8 +480,8 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
480480
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
481481
gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o=
482482
gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g=
483-
helm.sh/helm/v3 v3.17.1 h1:gzVoAD+qVuoJU6KDMSAeo0xRJ6N1znRxz3wyuXRmJDk=
484-
helm.sh/helm/v3 v3.17.1/go.mod h1:nvreuhuR+j78NkQcLC3TYoprCKStLyw5P4T7E5itv2w=
483+
helm.sh/helm/v3 v3.17.3 h1:3n5rW3D0ArjFl0p4/oWO8IbY/HKaNNwJtOQFdH2AZHg=
484+
helm.sh/helm/v3 v3.17.3/go.mod h1:+uJKMH/UiMzZQOALR3XUf3BLIoczI2RKKD6bMhPh4G8=
485485
k8s.io/api v0.32.3 h1:Hw7KqxRusq+6QSplE3NYG4MBxZw1BZnq4aP4cJVINls=
486486
k8s.io/api v0.32.3/go.mod h1:2wEDTXADtm/HA7CCMD8D8bK4yuBUptzaRhYcYEEYA3k=
487487
k8s.io/apiextensions-apiserver v0.32.3 h1:4D8vy+9GWerlErCwVIbcQjsWunF9SUGNu7O7hiQTyPY=

vendor/helm.sh/helm/v3/pkg/chart/loader/archive.go

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,15 @@ import (
3333
"helm.sh/helm/v3/pkg/chart"
3434
)
3535

36+
// MaxDecompressedChartSize is the maximum size of a chart archive that will be
37+
// decompressed. This is the decompressed size of all the files.
38+
// The default value is 100 MiB.
39+
var MaxDecompressedChartSize int64 = 100 * 1024 * 1024 // Default 100 MiB
40+
41+
// MaxDecompressedFileSize is the size of the largest file that Helm will attempt to load.
42+
// The size of the file is the decompressed version of it when it is stored in an archive.
43+
var MaxDecompressedFileSize int64 = 5 * 1024 * 1024 // Default 5 MiB
44+
3645
var drivePathPattern = regexp.MustCompile(`^[a-zA-Z]:/`)
3746

3847
// FileLoader loads a chart from a file
@@ -119,6 +128,7 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
119128

120129
files := []*BufferedFile{}
121130
tr := tar.NewReader(unzipped)
131+
remainingSize := MaxDecompressedChartSize
122132
for {
123133
b := bytes.NewBuffer(nil)
124134
hd, err := tr.Next()
@@ -178,10 +188,30 @@ func LoadArchiveFiles(in io.Reader) ([]*BufferedFile, error) {
178188
return nil, errors.New("chart yaml not in base directory")
179189
}
180190

181-
if _, err := io.Copy(b, tr); err != nil {
191+
if hd.Size > remainingSize {
192+
return nil, fmt.Errorf("decompressed chart is larger than the maximum file size %d", MaxDecompressedChartSize)
193+
}
194+
195+
if hd.Size > MaxDecompressedFileSize {
196+
return nil, fmt.Errorf("decompressed chart file %q is larger than the maximum file size %d", hd.Name, MaxDecompressedFileSize)
197+
}
198+
199+
limitedReader := io.LimitReader(tr, remainingSize)
200+
201+
bytesWritten, err := io.Copy(b, limitedReader)
202+
if err != nil {
182203
return nil, err
183204
}
184205

206+
remainingSize -= bytesWritten
207+
// When the bytesWritten are less than the file size it means the limit reader ended
208+
// copying early. Here we report that error. This is important if the last file extracted
209+
// is the one that goes over the limit. It assumes the Size stored in the tar header
210+
// is correct, something many applications do.
211+
if bytesWritten < hd.Size || remainingSize <= 0 {
212+
return nil, fmt.Errorf("decompressed chart is larger than the maximum file size %d", MaxDecompressedChartSize)
213+
}
214+
185215
data := bytes.TrimPrefix(b.Bytes(), utf8bom)
186216

187217
files = append(files, &BufferedFile{Name: n, Data: data})

vendor/helm.sh/helm/v3/pkg/chart/loader/directory.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ func LoadDir(dir string) (*chart.Chart, error) {
101101
return fmt.Errorf("cannot load irregular file %s as it has file mode type bits set", name)
102102
}
103103

104+
if fi.Size() > MaxDecompressedFileSize {
105+
return fmt.Errorf("chart file %q is larger than the maximum file size %d", fi.Name(), MaxDecompressedFileSize)
106+
}
107+
104108
data, err := os.ReadFile(name)
105109
if err != nil {
106110
return errors.Wrapf(err, "error reading %s", n)

vendor/modules.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -751,7 +751,7 @@ gopkg.in/inf.v0
751751
# gopkg.in/yaml.v3 v3.0.1
752752
## explicit
753753
gopkg.in/yaml.v3
754-
# helm.sh/helm/v3 v3.17.1
754+
# helm.sh/helm/v3 v3.17.3
755755
## explicit; go 1.23.0
756756
helm.sh/helm/v3/internal/fileutil
757757
helm.sh/helm/v3/internal/resolver

0 commit comments

Comments
 (0)