Skip to content

Commit 763effb

Browse files
committed
PS: Add more models and support pipeline parameters in MaD.
1 parent f38c5f5 commit 763effb

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

powershell/ql/lib/semmle/code/powershell/dataflow/internal/FlowSummaryImpl.qll

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,16 @@ module Input implements InputSig<Location, DataFlowImplSpecific::PowershellDataF
3535
or
3636
pos.isThis() and
3737
result = "this"
38+
or
39+
pos.isPipeline() and
40+
result = "pipeline"
3841
}
3942

4043
string encodeArgumentPosition(ArgumentPosition pos) {
4144
pos.isThis() and result = "this"
4245
or
46+
pos.isPipeline() and result = "pipeline"
47+
or
4348
exists(int i |
4449
pos.isPositional(i, emptyNamedSet()) and
4550
result = i.toString()

powershell/ql/lib/semmle/code/powershell/frameworks/MicrosoftPowershellUtility/model.yml

Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,66 @@ extensions:
1010
extensible: typeModel
1111
data:
1212
- ["system.datetime", "microsoft.powershell.utility!", "Method[get-date].ReturnValue"]
13+
- ["system.object", "microsoft.powershell.utility!", "Method[convertfrom-clixmlreference].ReturnValue"]
14+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[convertFrom-json].ReturnValue"]
15+
- ["system.management.automation.hashtable", "microsoft.powershell.utility!", "Method[convertFrom-json].ReturnValue"]
16+
- ["microsoft.powershell.markdownrender.markdownInfo", "microsoft.powershell.utility!", "Method[convertfrom-markdown].ReturnValue"]
17+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[convertfrom-sddlstring].ReturnValue"]
18+
- ["system.collections.hashtable", "microsoft.powershell.utility!", "Method[convertfrom-stringdata].ReturnValue"]
19+
- ["system.string", "microsoft.powershell.utility!", "Method[convertto-clixml].ReturnValue"]
20+
- ["system.string", "microsoft.powershell.utility!", "Method[convertto-csv].ReturnValue"]
21+
- ["system.string[]", "microsoft.powershell.utility!", "Method[convertto-csv].ReturnValue"]
22+
- ["system.string", "microsoft.powershell.utility!", "Method[convertto-html].ReturnValue"]
23+
- ["system.string[]", "microsoft.powershell.utility!", "Method[convertto-html].ReturnValue"]
24+
- ["system.string", "microsoft.powershell.utility!", "Method[convertto-json].ReturnValue"]
25+
- ["system.string[]", "microsoft.powershell.utility!", "Method[convertto-json].ReturnValue"]
26+
- ["system.string", "microsoft.powershell.utility!", "Method[convertto-xml].ReturnValue"]
27+
- ["system.string[]", "microsoft.powershell.utility!", "Method[convertto-xml].ReturnValue"]
28+
29+
- ["system.string", "microsoft.powershell.utility!", "Method[out-string].ReturnValue"]
30+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[select-object].ReturnValue"]
31+
- ["microsoft.powerShell.commands.matchinfo", "microsoft.powershell.utility!", "Method[select-string].ReturnValue"]
32+
- ["system.boolean", "microsoft.powershell.utility!", "Method[select-string].ReturnValue"]
33+
- ["system.string", "microsoft.powershell.utility!", "Method[select-string].ReturnValue"]
34+
- ["microsoft.powerShell.commands.selectxmlinfo", "microsoft.powershell.utility!", "Method[select-xml].ReturnValue"]
35+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[sort-object].ReturnValue"]
36+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[tee-object].ReturnValue"]
37+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[write-output].ReturnValue"]
38+
- ["microsoft.powershell.commands.internal.format", "microsoft.powershell.utility!", "Method[format-custom].ReturnValue"]
39+
- ["microsoft.powershell.commands.bytecollection", "microsoft.powershell.utility!", "Method[format-hex].ReturnValue"]
40+
- ["microsoft.powershell.commands.internal.format", "microsoft.powershell.utility!", "Method[format-list].ReturnValue"]
41+
- ["microsoft.powershell.commands.internal.format", "microsoft.powershell.utility!", "Method[format-table].ReturnValue"]
42+
- ["microsoft.powershell.commands.internal.format", "microsoft.powershell.utility!", "Method[format-wide].ReturnValue"]
43+
- ["pscustomobject", "microsoft.powershell.utility!", "Method[get-unique].ReturnValue"]
44+
- ["system.string", "microsoft.powershell.utility!", "Method[join-string].ReturnValue"]
1345

1446
- addsTo:
1547
pack: microsoft-sdl/powershell-all
1648
extensible: summaryModel
1749
data:
18-
- ["system.datetime", "Method[tostring]", "Argument[this]", "ReturnValue", "taint"]
50+
- ["microsoft.powershell.utility!", "Method[convertfrom-clixmlreference]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
51+
- ["microsoft.powershell.utility!", "Method[convertfrom-csv]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
52+
- ["microsoft.powershell.utility!", "Method[convertfrom-json]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
53+
- ["microsoft.powershell.utility!", "Method[convertfrom-markdown]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
54+
- ["microsoft.powershell.utility!", "Method[convertfrom-sddlstring]", "Argument[-sddl,0,pipeline]", "ReturnValue", "taint"]
55+
- ["microsoft.powershell.utility!", "Method[convertfrom-stringdata]", "Argument[-stringdata,0,pipeline]", "ReturnValue", "taint"]
56+
- ["microsoft.powershell.utility!", "Method[convertto-clixml]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
57+
- ["microsoft.powershell.utility!", "Method[convertto-csv]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
58+
- ["microsoft.powershell.utility!", "Method[convertto-html]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
59+
- ["microsoft.powershell.utility!", "Method[convertto-json]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
60+
- ["microsoft.powershell.utility!", "Method[convertto-xml]", "Argument[-inputobject,0,pipeline]", "ReturnValue", "taint"]
61+
62+
- ["microsoft.powershell.utility!", "Method[out-string]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
63+
- ["microsoft.powershell.utility!", "Method[select-object]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
64+
- ["microsoft.powershell.utility!", "Method[select-string]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
65+
- ["microsoft.powershell.utility!", "Method[select-xml]", "Argument[-content,-path,-xml]", "ReturnValue", "taint"] # TODO: Source of user input?
66+
- ["microsoft.powershell.utility!", "Method[sort-object]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
67+
- ["microsoft.powershell.utility!", "Method[tee-object]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
68+
- ["microsoft.powershell.utility!", "Method[write-output]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
69+
- ["microsoft.powershell.utility!", "Method[format-custom]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
70+
- ["microsoft.powershell.utility!", "Method[format-hex]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"] # Source of user input?
71+
- ["microsoft.powershell.utility!", "Method[format-list]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
72+
- ["microsoft.powershell.utility!", "Method[format-table]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
73+
- ["microsoft.powershell.utility!", "Method[format-wide]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
74+
- ["microsoft.powershell.utility!", "Method[get-unique]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]
75+
- ["microsoft.powershell.utility!", "Method[join-string]", "Argument[-inputobject,pipeline]", "ReturnValue", "taint"]

0 commit comments

Comments
 (0)