Skip to content

Commit 5bc0a26

Browse files
committed
PS: A call to set-variable is an explicit assignment.
1 parent faa9473 commit 5bc0a26

File tree

1 file changed

+13
-0
lines changed
  • powershell/ql/lib/semmle/code/powershell/ast/internal

1 file changed

+13
-0
lines changed

powershell/ql/lib/semmle/code/powershell/ast/internal/Synthesis.qll

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,3 +138,16 @@ private module ThisSynthesis {
138138
}
139139
}
140140
}
141+
142+
private module SetVariableAssignment {
143+
private class SetVariableAssignment extends Synthesis {
144+
override predicate explicitAssignment(Raw::Ast dest, string name, Raw::Ast assignment) {
145+
exists(Raw::Cmd cmd |
146+
assignment = cmd and
147+
cmd.getCommandName().toLowerCase() = "set-variable" and
148+
cmd.getNamedArgument("name") = dest and
149+
name = dest.(Raw::StringConstExpr).getValue().getValue()
150+
)
151+
}
152+
}
153+
}

0 commit comments

Comments
 (0)