mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Add ApiController support
This commit is contained in:
@@ -69,11 +69,6 @@ class MicrosoftAspNetCoreMvcNonControllerAttribute extends MicrosoftAspNetCoreMv
|
||||
}
|
||||
}
|
||||
|
||||
/** A `Microsoft.AspNetCore.Mvc.Controller` attribute. */
|
||||
class MicrosoftAspNetCoreMvcControllerAttribute extends MicrosoftAspNetCoreMvcAttribute {
|
||||
MicrosoftAspNetCoreMvcControllerAttribute() { this.getType().hasName("ControllerAttribute") }
|
||||
}
|
||||
|
||||
/** The `Microsoft.AspNetCore.Antiforgery` namespace. */
|
||||
class MicrosoftAspNetCoreAntiforgeryNamespace extends Namespace {
|
||||
MicrosoftAspNetCoreAntiforgeryNamespace() {
|
||||
@@ -196,7 +191,7 @@ class MicrosoftAspNetCoreMvcControllerBaseClass extends Class {
|
||||
|
||||
/**
|
||||
* A valid ASP.NET Core controller according to:
|
||||
* https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-3.1
|
||||
* https://docs.microsoft.com/en-us/aspnet/core/mvc/controllers/actions?view=aspnetcore-3.1
|
||||
* https://github.com/dotnet/aspnetcore/blob/b3c93967ba508b8ef139add27132d9483c1a9eb4/src/Mvc/Mvc.Core/src/Controllers/ControllerFeatureProvider.cs#L39-L75
|
||||
*/
|
||||
class MicrosoftAspNetCoreMvcController extends Class {
|
||||
@@ -212,9 +207,16 @@ class MicrosoftAspNetCoreMvcController extends Class {
|
||||
not this.isAbstract() and
|
||||
not this.containsTypeParameters() and
|
||||
(
|
||||
this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass or
|
||||
this.getABaseType*().getName().matches("%Controller") or
|
||||
this.getABaseType*().getAnAttribute() instanceof MicrosoftAspNetCoreMvcControllerAttribute
|
||||
this.getABaseType*() instanceof MicrosoftAspNetCoreMvcControllerBaseClass
|
||||
or
|
||||
this.getABaseType*().getName().matches("%Controller")
|
||||
or
|
||||
this.getABaseType*()
|
||||
.getAnAttribute()
|
||||
.getType()
|
||||
.getABaseType*()
|
||||
// ApiControllerAttribute is derived from ControllerAttribute
|
||||
.hasQualifiedName("Microsoft.AspNetCore.Mvc.ControllerAttribute")
|
||||
) and
|
||||
not this.getABaseType*().getAnAttribute() instanceof
|
||||
MicrosoftAspNetCoreMvcNonControllerAttribute
|
||||
|
||||
Reference in New Issue
Block a user