Repository navigation
Stop MgApp_CertificatePath from running code in the configuration file - #15
Merged
Merged
Conversation
- Four places said quoted text in a boolean setting reads as off, but the text "true" in any letter case compares equal to $true, so it reads as on: the rule in AGENTS.md, the From source paragraph in Research_Notes/PowerShell-Language-Behavior.md section 10, the IncludeBCCInGroupChat comment in Send-ScriptMessage, and the comment above the quoted-"false" tests. The code already behaved this way; only the wording changes. - Changelog: the Minor entry about validating configuration file settings overstated it. Nothing is validated, and only IncludeBCCInGroupChat and MgDisconnectWhenDone read differently from 1.1.1; the MgDelegatedPermission_* settings already used -eq $true. Reword it as reading every true/false setting the same way. - Fix the installed-module scratch script, which imported Script-Message instead of ScriptMessage. - Delete Tests/MgGraphDynamicParams.ps1, an unused DynamicParam snippet that nothing in the module or tests references.
Get-ScriptMessageConfig reported every failure as "Can't find the JSON configuration file" and told the caller to create one with Set-ScriptMessageConfigFilePath, which only stores the path. A missing file, a file that cannot be read, and a file that is not valid JSON now get separate messages that include the reason. Windows PowerShell 5.1's ConvertFrom-Json ends many of its messages with the entire input, which here is the configuration file and its secrets, so the parse error keeps only the reason in front of it. Measured in Research_Notes/PowerShell-Language-Behavior.md section 11.
Connect-ScriptMessage_MicrosoftGraph passed the setting through
ExpandString, so a $(...) subexpression in the configuration file ran as
the sending account on PowerShell 7.4 and later. It now expands only
$env:NAME and ${env:NAME} and uses the rest of the path as written,
which also stops a literal '$name' folder or a backtick in the path from
being mangled.
Nothing published documented the expansion, and $PSScriptRoot in the
setting always meant the module's Services folder, so environment
variables are the only use kept. Measurements are in
Research_Notes/PowerShell-Language-Behavior.md section 4.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Connect-ScriptMessage_MicrosoftGraphpassedMgApp_CertificatePaththroughExpandString, so a$(...)subexpression in the configuration file ran as the sending account on PowerShell 7.4 and later. It now expands only$env:NAMEand${env:NAME}and uses the rest of the path as written, which also stops a literal$namefolder or a backtick in the path from being mangled.Nothing published documented the expansion, and
$PSScriptRootin the setting always meant the module'sServicesfolder, so environment variables are the only use kept. Measurements are inResearch_Notes/PowerShell-Language-Behavior.mdsection 4.Changelog: the Security entry.
This branch is built on #14, so merge that first; this PR then shows only its own commit.