Skip to content

Remove disabled LocalAccounts test files #27211

Open
TravisEz13 wants to merge 1 commit intoPowerShell:masterfrom
TravisEz13:delete-localaccounts-tests
Open

Remove disabled LocalAccounts test files #27211
TravisEz13 wants to merge 1 commit intoPowerShell:masterfrom
TravisEz13:delete-localaccounts-tests

Conversation

@TravisEz13
Copy link
Copy Markdown
Member

@TravisEz13 TravisEz13 commented Apr 8, 2026

Summary

Delete dead code because it triggers compliance issues

… violation

The Microsoft.PowerShell.LocalAccounts module was removed in 2017 (issue PowerShell#4272)
because it used unsupported native APIs. The three test files in this directory
have been disabled with an early 
eturn ever since, making them permanently
dead code.

PSScriptAnalyzer (via S360/SFI scanning) flags PSAvoidUsingConvertToSecureStringWithPlainText
violations in the dead code of LocalUser.Tests.ps1. The existing SuppressMessageAttribute
in the param() block is not being honored by the S360 scanner.

Deleting the directory is the correct fix: the module is gone, the tests can
never run, and keeping them creates ongoing compliance burden.

Resolves S360 ADO bug 34502946.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 8, 2026 18:29
@TravisEz13 TravisEz13 requested a review from a team as a code owner April 8, 2026 18:29
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Removes long-disabled Pester tests for the legacy Microsoft.PowerShell.LocalAccounts module to eliminate S360/PSScriptAnalyzer findings coming from permanently-dead test code.

Changes:

  • Deleted the test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/ test files that were effectively unreachable due to an early return.
  • Eliminated ConvertTo-SecureString -AsPlainText usage that was being flagged by S360 despite in-file suppressions.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalUser.Tests.ps1 Removed disabled LocalUser cmdlet tests containing S360-flagged ConvertTo-SecureString -AsPlainText calls.
test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalGroup.Tests.ps1 Removed disabled LocalGroup cmdlet tests.
test/powershell/Modules/Microsoft.PowerShell.LocalAccounts/Pester.Command.Cmdlets.LocalAccounts.LocalGroupMember.Tests.ps1 Removed disabled LocalGroupMember cmdlet tests.

@TravisEz13 TravisEz13 changed the title Remove disabled LocalAccounts test files (fixes S360 PSAvoidUsingConvertToSecureStringWithPlainText) Remove disabled LocalAccounts test files Apr 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants