Update to hasFullyQualifiedName

This commit is contained in:
Joe Farebrother
2023-11-16 10:56:47 +00:00
parent f24c042d04
commit e4edb19f43

View File

@@ -7,7 +7,9 @@ private import semmle.code.csharp.frameworks.microsoft.AspNetCore
/** A call to the `View` method */ /** A call to the `View` method */
private class ViewCall extends MethodCall { private class ViewCall extends MethodCall {
ViewCall() { this.getTarget().hasQualifiedName("Microsoft.AspNetCore.Mvc", "Controller", "View") } ViewCall() {
this.getTarget().hasFullyQualifiedName("Microsoft.AspNetCore.Mvc", "Controller", "View")
}
/** Gets the `name` argument to this call, if any. */ /** Gets the `name` argument to this call, if any. */
string getNameArgument() { string getNameArgument() {
@@ -55,7 +57,7 @@ private class ViewCall extends MethodCall {
string getAreaName() { string getAreaName() {
exists(Attribute attr | exists(Attribute attr |
attr = this.getController().getAnAttribute() and attr = this.getController().getAnAttribute() and
attr.getType().hasQualifiedName("Microsoft.AspNetCore.Mvc", "AreaAttribute") and attr.getType().hasFullyQualifiedName("Microsoft.AspNetCore.Mvc", "AreaAttribute") and
result = attr.getArgument(0).(StringLiteral).getValue() result = attr.getArgument(0).(StringLiteral).getValue()
) )
} }
@@ -70,13 +72,13 @@ class RazorViewClass extends Class {
RazorViewClass() { RazorViewClass() {
exists(Class baseClass | baseClass = this.getBaseClass().getUnboundDeclaration() | exists(Class baseClass | baseClass = this.getBaseClass().getUnboundDeclaration() |
baseClass.hasQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorPage<>") baseClass.hasFullyQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorPage`1")
or or
baseClass.hasQualifiedName("Microsoft.AspNetCore.Mvc.RazorPages", "Page") baseClass.hasFullyQualifiedName("Microsoft.AspNetCore.Mvc.RazorPages", "Page")
) and ) and
attr.getFile() = this.getFile() and attr.getFile() = this.getFile() and
attr.getType() attr.getType()
.hasQualifiedName("Microsoft.AspNetCore.Razor.Hosting", "RazorCompiledItemAttribute") .hasFullyQualifiedName("Microsoft.AspNetCore.Razor.Hosting", "RazorCompiledItemAttribute")
} }
/** /**
@@ -176,7 +178,7 @@ private Expr getAViewLocationList(boolean isArea) {
result result
.(PropertyRead) .(PropertyRead)
.getProperty() .getProperty()
.hasQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorViewEngineOptions", name) .hasFullyQualifiedName("Microsoft.AspNetCore.Mvc.Razor", "RazorViewEngineOptions", name)
| |
name = "ViewLocationFormats" and isArea = false name = "ViewLocationFormats" and isArea = false
or or