-
Notifications
You must be signed in to change notification settings - Fork 55
win_psDscAdapter and psDscAdapter PScredentials fix for passing username and password #1308
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
win_psDscAdapter and psDscAdapter PScredentials fix for passing username and password #1308
Conversation
…nvert to System.Management.Automation.PSCredentia
|
@microsoft-github-policy-service agree
@microsoft-github-policy-service agree |
|
@mimachniak - as I have already spoken with you on socials, is this perhaps also possible for class-based DSC resources (both in the 5.1 and 7.0 adapter)? Can you also include a testcase that covers this change? |
|
Yes I working o it |
…rt to System.Management.Automation.PSCredentia - code optimalization remove unused function
…tem.Management.Automation.PSCredential
…t to System.Management.Automation.PSCredential
…t to System.Management.Automation.PSCredential - if change to recognize user information
|
@Gijsreyn , @SteveL-MSFT - I added in test folder yaml's that are using TestClass for validation using PSCredentials, I tested on version 5.1 and 7 of PowerShell |
|
@mimachniak - can it be tested inside the |
I will add today, I added yaml files for running test |
…alid secure object
I added unit test and validation in file in powershellgroup.config.tests.ps1 |
|
I added test for 5.1 as well |
|
@mimachniak Thanks for adding the test resource, but there isn't a Pester test using it yet? |
|
@SteveL-MSFT I will add test today |
…sc for script resources
… parameters - credentials
…ameters - credentials
Test added and minor fix to adapter as well |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
| $_.Value.Password | ||
|
|
||
| if (-not $hasSecureCred -and -not $hasTextCred) { | ||
| "$($_.Value)" | Write-DscTrace -Operation Warn |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug log statement here appears to be logging the entire credential object value, which could potentially expose sensitive information like passwords in debug logs. Consider logging only non-sensitive metadata about the credential (like its type or name) rather than the full value.
| $_.Value.Password | ||
|
|
||
| if (-not $hasSecureCred -and -not $hasTextCred) { | ||
| "$($_.Value)" | Write-DscTrace -Operation Warn |
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The debug log statement here appears to be logging the entire credential object value, which could potentially expose sensitive information like passwords in debug logs. Consider logging only non-sensitive metadata about the credential (like its type or name) rather than the full value.
| "$($_.Value)" | Write-DscTrace -Operation Warn | |
| "Invalid credential object for property '$($_.Name)'" | Write-DscTrace -Operation Warn |
| [System.Management.Automation.PSCredential]::new($username, $password) | ||
| } | ||
|
|
||
|
|
Copilot
AI
Jan 14, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is trailing whitespace on this line. This should be removed to maintain code cleanliness.
|
@SteveL-MSFT I see that I need to add to test in script base module creation, I will do it today |
|
@mimachniak Some Windows Pester tests failed in CI, can you take a look at those? Also look over the Copilot feedback and see if any should be addressed. Thanks! |
Yes I'm fixing this as well |
PR Summary
PR Context
Fix using ScriptBased DSC resources when is reguired to use parameters with Get-Credentials