Java/C#/GO: Use instanceof in more places

This commit is contained in:
erik-krogh
2022-12-11 18:32:19 +01:00
parent d5acd310ce
commit 8262fbbfb5
60 changed files with 116 additions and 289 deletions

View File

@@ -7,17 +7,12 @@ import semmle.code.java.frameworks.Servlets
* Any class which extends the `Servlet` interface is intended to be constructed reflectively by a
* servlet container.
*/
class ServletConstructedClass extends ReflectivelyConstructedClass {
class ServletConstructedClass extends ReflectivelyConstructedClass instanceof ServletClass {
ServletConstructedClass() {
this instanceof ServletClass and
// If we have seen any `web.xml` files, this servlet will be considered to be live only if it is
// referred to as a servlet-class in at least one. If no `web.xml` files are found, we assume
// that XML extraction was not enabled, and therefore consider all `Servlet` classes as live.
(
isWebXmlIncluded()
implies
exists(WebServletClass servletClass | this = servletClass.getClass())
)
isWebXmlIncluded() implies exists(WebServletClass servletClass | this = servletClass.getClass())
}
}
@@ -112,6 +107,4 @@ class GwtUiBinderEntryPoint extends CallableEntryPoint {
/**
* Fields that may be reflectively read or written to by the UiBinder framework.
*/
class GwtUiBinderReflectivelyReadField extends ReflectivelyReadField {
GwtUiBinderReflectivelyReadField() { this instanceof GwtUiField }
}
class GwtUiBinderReflectivelyReadField extends ReflectivelyReadField instanceof GwtUiField { }