mirror of
https://github.com/zitadel/zitadel.git
synced 2024-12-12 02:54:20 +00:00
fix(crypto): allow parsing of cost int from env string (#7061)
fic(crypto): allow parsing of cost int from env string
This commit is contained in:
parent
dae1911d43
commit
1adfca9d28
@ -145,11 +145,15 @@ func (c *HasherConfig) buildHasher() (hasher passwap.Hasher, prefixes []string,
|
||||
}
|
||||
}
|
||||
|
||||
// decodeParams uses a mapstructure decoder from the Params map to dst.
|
||||
// The decoder fails when there are unused fields in dst.
|
||||
// It uses weak input typing, to allow conversion of env strings to ints.
|
||||
func (c *HasherConfig) decodeParams(dst any) error {
|
||||
decoder, err := mapstructure.NewDecoder(&mapstructure.DecoderConfig{
|
||||
ErrorUnused: false,
|
||||
ErrorUnset: true,
|
||||
Result: dst,
|
||||
ErrorUnused: false,
|
||||
ErrorUnset: true,
|
||||
WeaklyTypedInput: true,
|
||||
Result: dst,
|
||||
})
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -397,7 +397,11 @@ func TestHasherConfig_decodeParams(t *testing.T) {
|
||||
"a": 1,
|
||||
"b": "2",
|
||||
},
|
||||
wantErr: true,
|
||||
want: dst{
|
||||
A: 1,
|
||||
B: 2,
|
||||
},
|
||||
wantErr: false, // https://github.com/zitadel/zitadel/issues/6913
|
||||
},
|
||||
{
|
||||
name: "ok",
|
||||
|
Loading…
Reference in New Issue
Block a user