mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-23 07:10:41 +00:00
fix(packages): bound Alpine metadata entries (#39026)
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"bytes"
|
||||
"compress/gzip"
|
||||
"io"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -97,6 +98,15 @@ func TestParsePackage(t *testing.T) {
|
||||
|
||||
assert.Equal(t, "Q1SRYURM5+uQDqfHSwTnNIOIuuDVQ=", p.FileMetadata.Checksum)
|
||||
})
|
||||
|
||||
t.Run("TooManyDependencyEntries", func(t *testing.T) {
|
||||
data := append(createPKGINFOContent(packageName, packageVersion), []byte("\ndepend = item")...)
|
||||
data = append(data, []byte(strings.Repeat("\ndepend = item", maxPackageInfoEntries))...)
|
||||
|
||||
p, err := ParsePackageInfo(bytes.NewReader(data))
|
||||
assert.Nil(t, p)
|
||||
assert.ErrorIs(t, err, ErrPackageInfoTooLarge)
|
||||
})
|
||||
}
|
||||
|
||||
func TestParsePackageInfo(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user