You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The string validator is in someway evaluating the objects coming as params and it breaks if it has native prototype references (e.g. toString, toJSON)
How to reproduce it?
constValidator=require("fastest-validator");constv=newValidator();constschema={name: {type: "string"},};constcheck=v.compile(schema);console.log(check({name: "test"}));// it works, and passesconsole.log(check({name: {"abc": 1}}));// it works, and rejectsconsole.log(check({name: {"toString": 1}}));// it fails - TypeError: Cannot convert object to primitive value
What?
The string validator is in someway evaluating the objects coming as params and it breaks if it has native prototype references (e.g. toString, toJSON)
How to reproduce it?
Environment:
$ node --version
v12.16.1
macOS Catalina 10.15.16
fastest-validator version: 1.11.0
Comments:
I didn't inspect the code deeply, but if you have any suggestions about how to solve it, I will be glad to help!
The text was updated successfully, but these errors were encountered: