Skip to content

Commit 50c0551

Browse files
committed
PS: Include implicit qualifiers.
1 parent a382d08 commit 50c0551

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

powershell/ql/lib/semmle/code/powershell/Command.qll

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,17 @@ class Cmd extends @command, CmdBase {
3232
predicate isQualified() { parseCommandName(this, any(string s | s != ""), _) }
3333

3434
/** Gets the namespace qualifier of this command, if any. */
35-
string getNamespaceQualifier() { parseCommandName(this, result, _) }
35+
string getNamespaceQualifier() {
36+
result != "" and
37+
parseCommandName(this, result, _)
38+
or
39+
// Implicit import because it's in a module manifest
40+
parseCommandName(this, "", _) and
41+
exists(ModuleManifest manifest |
42+
manifest.getACmdLetToExport() = this.getCommandName() and
43+
result = manifest.getModuleName()
44+
)
45+
}
3646

3747
/** Gets the (possibly qualified) name of this command. */
3848
string getQualifiedCommandName() { command(this, result, _, _, _) }

0 commit comments

Comments
 (0)