add source for react-hook-form in xss-through-dom

This commit is contained in:
Erik Krogh Kristensen
2021-02-08 15:44:34 +01:00
parent 65d93c9061
commit be9636491b
3 changed files with 74 additions and 1 deletions

View File

@@ -154,5 +154,21 @@ module XssThroughDom {
)
}
}
/**
* An object containing input values from a form build with `react-hook-form`.
*/
class ReactHookFormSource extends Source {
ReactHookFormSource() {
exists(API::Node useForm |
useForm = API::moduleImport("react-hook-form").getMember("useForm").getReturn()
|
this =
useForm.getMember("handleSubmit").getParameter(0).getParameter(0).getAnImmediateUse()
or
this = useForm.getMember("getValues").getACall()
)
}
}
}
}