-
-
Notifications
You must be signed in to change notification settings - Fork 72
Description
Version(s) affected
4.7.0
Description
While working up the upgrade from 4.6.x to 4.7.x, specifically the replacement of setters by property access, I noticed that the safety of the library decreased. Specifically it is much less misuse resistant.
Let me take the PublicKeyCredentialRequestOptions::$userVerification property as an example. The setUserVerification() setter performed validation the the passed value is actually a valid value and by extension the named createFromArray() constructor / deserializer also performed this validation.
Now any value may be passed, valid or not, allowing garbage data to enter the library instead of being rejected at the boundary.
The $userVerification property could be fixed by leveraging a native PHP enum, but likewise nothing (except perhaps a static analyzer) stops me from inserting garbage into PublicKeyCredentialRequestOptions::$allowCredentials property, because PHP does not support typed arrays. Previously the typed variadic parameter prevented inserting invalid values.
How to reproduce
Look at the code.
Possible Solution
No response
Additional Context
No response