always check for errors on type casting

This commit is contained in:
Jörg Thalheim 2024-11-20 09:46:40 +01:00
parent 1f66022025
commit 35a86416aa

View file

@ -322,7 +322,12 @@ func recurseSecretKey(keys map[string]interface{}, wantedKey string) (string, er
currentData = make(map[string]interface{})
for key, value := range valWithWrongType {
currentData[key.(string)] = value
keyStr, ok := key.(string)
if !ok {
return "", fmt.Errorf("the key '%s' is not a string", key)
}
currentData[keyStr] = value
}
}