PS: Fix more Chanel-reported PowerShell issues #186
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes
twothree(!) PowerShell issues reported by @chanel-y:Missing edges in API graphs
Consider this example:
@chanel-y reported that the following use of API graphs didn't work:
This was because we were missing two API edges:
$executionContext, and$executionContext.InvokeCommandWith those two extra steps added, the above snippet works 🥳
In addition, I added two drive-by fixes:
toLowerCasewhen selecting a method usinggetMethod. This is, again, necessary because PowerShell is case insensitive, and$executionContext.InvokeCommand.InvokeScriptand$executionContext.invokecommand.invokescriptboth invokes theInvokeScriptmethod.Missing pipeline parameters
Recall that these two snippets are equivalent:
and
One has an explicit pipeline parameter, and the other has an implicit one. That means that we sometimes have to synthesize implicit pipeline parameters in the AST.
This was already done in #178 and #181. However, sometimes I referred to a non-existing explicitly-provided pipeline parameter, and other times I referred to a synthesized implicitly-provided pipeline parameter when I should be referring to the explicitly-provided one. This PR makes sure that we always:
Missing model edges in taint-tracking
We added models-as-data in #134, and slightly regressed it in #178. @chanel-y noticed this due to a lack of taint-flow through CodeGeneration.EscapeSingleQuotedStringContent. This PR adds the missing QL required to get that flow, and also adds a MaD taint-model for this method.
I'll do a follow-up that adds autogenerated models for the other methods later.