fix(font): prevent zipslip attacks

This commit is contained in:
Jan De Dobbeleer 2024-07-14 20:41:10 +02:00 committed by Jan De Dobbeleer
parent 4aba8fa9db
commit 08c37417a2

View file

@ -35,6 +35,12 @@ func InstallZIP(data []byte, user bool) ([]string, error) {
fonts := make(map[string]*Font)
for _, zf := range zipReader.File {
// prevent zipslip attacks
// https://security.snyk.io/research/zip-slip-vulnerability
if strings.Contains(zf.Name, "..") {
continue
}
rc, err := zf.Open()
if err != nil {
return families, err