Skip to content

Commit 52b889f

Browse files
egregius313tamasvajk
authored andcommitted
Support when a property is specified by a string literal instead of a nameof expression
In earlier versions of the Razor generator, a string literal was used instead of a `nameof` expression in order to indicate the name of the property being modified. This means we need to look up the property by name instead of using a more explicit access.
1 parent 342d4a6 commit 52b889f

File tree

1 file changed

+7
-1
lines changed
  • csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/aspnetcore

1 file changed

+7
-1
lines changed

csharp/ql/lib/semmle/code/csharp/frameworks/microsoft/aspnetcore/Components.qll

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,13 @@ private module JumpNodes {
159159
*/
160160
Property getParameterProperty() {
161161
result.getAnAttribute() instanceof MicrosoftAspNetCoreComponentsParameterAttribute and
162-
exists(NameOfExpr ne | ne = this.getArgument(1) | result.getAnAccess() = ne.getAccess())
162+
(
163+
exists(NameOfExpr ne | ne = this.getArgument(1) | result.getAnAccess() = ne.getAccess())
164+
or
165+
exists(string propertyName | propertyName = this.getArgument(1).(StringLiteral).getValue() |
166+
result.hasName(propertyName)
167+
)
168+
)
163169
}
164170

165171
/**

0 commit comments

Comments
 (0)