mirror of
https://github.com/github/codeql.git
synced 2026-02-12 05:01:06 +01:00
Add DomValueSource for react useRef output (object's prop named current)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
---
|
||||
category: minorAnalysis
|
||||
---
|
||||
* Added PreCallGraphStep flow model for React's `useRef` hook.
|
||||
* Added `PreCallGraphStep` flow model for React's `useRef` hook.
|
||||
* Added a `DomValueSource` that uses the `current` property off the object returned by React's `useRef` hook.
|
||||
@@ -804,6 +804,16 @@ private class ReactRouterLocationSource extends DOM::LocationSource::Range {
|
||||
}
|
||||
}
|
||||
|
||||
private class UseRefDomValueSource extends DOM::DomValueSource::Range {
|
||||
UseRefDomValueSource() {
|
||||
exists(DataFlow::PropRead current, UseRefStep step, string prop | current = this |
|
||||
step.step(_, current) and
|
||||
current.mayHavePropertyName(prop) and
|
||||
prop = "current"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a reference to a function which, if called with a React component, returns wrapped
|
||||
* version of that component, which we model as a direct reference to the underlying component.
|
||||
|
||||
Reference in New Issue
Block a user