LoadChart walks a filesystem directory and passes files directly to chartv2loader.LoadFiles() with no checksum, signature, or integrity verification. If the chart directory on the operator's filesystem is tampered with (e.g. via a compromised init container or volume mount), the operator deploys arbitrary manifests.
|
func LoadChart(resourceFS fs.FS, chartPath string) (*chartv2.Chart, error) { |
|
var files []*archive.BufferedFile |
|
|
|
err := fs.WalkDir(resourceFS, chartPath, func(path string, d fs.DirEntry, err error) error { |
|
if err != nil { |
|
return err |
|
} |
|
|
|
// Skip directories |
|
if d.IsDir() { |
|
return nil |
|
} |
|
|
|
data, err := fs.ReadFile(resourceFS, path) |
|
if err != nil { |
|
return fmt.Errorf("failed to read file %s: %w", path, err) |
|
} |
|
|
|
// Make path relative to chart root |
|
// e.g., "v1.28.2/charts/istiod/Chart.yaml" -> "Chart.yaml" |
|
relPath := strings.TrimPrefix(path, chartPath) |
|
relPath = strings.TrimPrefix(relPath, "/") |
|
|
|
files = append(files, &archive.BufferedFile{ |
|
Name: relPath, |
|
Data: data, |
|
}) |
|
return nil |
|
}) |
|
if err != nil { |
|
return nil, fmt.Errorf("failed to walk chart directory %s: %w", chartPath, err) |
|
} |
|
|
|
if len(files) == 0 { |
|
return nil, fmt.Errorf("no files found in chart directory %s", chartPath) |
|
} |
|
|
|
loadedChart, err := chartv2loader.LoadFiles(files) |
|
if err != nil { |
|
return nil, fmt.Errorf("failed to load chart from files: %w", err) |
|
} |
|
|
|
return loadedChart, nil |
Suggested Fix
Embed expected chart checksums and verify before loading, or use signed chart archives.
From code inspection (2026-07-05, main @ 86fac7a). Severity: 🟠 Medium
LoadChartwalks a filesystem directory and passes files directly tochartv2loader.LoadFiles()with no checksum, signature, or integrity verification. If the chart directory on the operator's filesystem is tampered with (e.g. via a compromised init container or volume mount), the operator deploys arbitrary manifests.sail-operator/pkg/helm/fsloader.go
Lines 35 to 77 in 86fac7a
Suggested Fix
Embed expected chart checksums and verify before loading, or use signed chart archives.
From code inspection (2026-07-05, main @ 86fac7a). Severity: 🟠 Medium