fix(DB): validates db name for path traversal

This commit is contained in:
Lewis Wynne 2025-12-18 15:04:32 +00:00
parent 3e3c55d0b6
commit e806bd9046
4 changed files with 45 additions and 2 deletions

View file

@ -51,6 +51,9 @@ func ParseKey(raw string, defaults bool) (KeySpec, error) {
if strings.TrimSpace(rawDB) == "" {
return KeySpec{}, fmt.Errorf("bad key format, use KEY@DB")
}
if err := validateDBName(rawDB); err != nil {
return KeySpec{}, err
}
}
key := strings.ToLower(rawKey)