powershell-security-review
Skill24 starsChanged 4 days agoMITView on GitHub
Review PowerShell code for security problems such as exposed secrets, unsafe credential handling, command or path injection, and disabled certificate checks. Use when asked for a security review or audit of PowerShell code.
In this repository33 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .claude/rules/powershell-standards/copilot-instructions.mdCopilot instructions
- .github/copilot-instructions.mdCopilot instructions
- powershell-ci-pipelineSkill
- powershell-credential-scanSkill
- powershell-loggingSkill
- powershell-module-helpSkill
- powershell-new-functionSkill
- powershell-new-moduleSkill
- powershell-performance-reviewSkill
- powershell-reviewSkill
- powershell-security-reviewSkill
- powershell-write-testsSkill
- powershell-ci-pipelineSkill
- powershell-credential-scanSkill
- powershell-loggingSkill
- powershell-module-helpSkill
- powershell-new-functionSkill
- powershell-new-moduleSkill
- powershell-performance-reviewSkill
- powershell-reviewSkill
- powershell-security-reviewSkill
- powershell-write-testsSkill
- powershell-ci-pipelineSkill
- powershell-credential-scanSkill
- powershell-loggingSkill
- powershell-module-helpSkill
- powershell-new-functionSkill
- powershell-new-moduleSkill
- powershell-performance-reviewSkill
- powershell-reviewSkill
- powershell-write-testsSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 2 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 8
Read .github/instructions/powershell-security.instructions.md first, unless it is already loaded.
- Distinctive: line 14
Follow each input to where it is used and check:
- Distinctive: line 27
Check what the code writes.
- Very specific: line 29
Run PSScriptAnalyzer. Its rules PSAvoidUsingPlainTextForPassword, PSAvoidUsingConvertToSecureStringWithPlainText, …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Security review of PowerShell code
Read .github/instructions/powershell-security.instructions.md first, unless it is already loaded.
Steps
- Map where data enters the code: parameters, files, environment variables, web responses, and pipeline input. Treat each as untrusted unless the code proves otherwise.
- Follow each input to where it is used and check:
- Secrets and credentials: SEC-01 to SEC-08, and SEC-50 to SEC-53 where the code uses a secret vault. Search for literals that look like passwords, tokens, keys, and connection strings, including in comments, defaults, and test data.
- Web requests that carry a credential: SEC-09. Look for a request that does not pass
-MaximumRedirection 0, and for-FollowRelLinkand-PreserveAuthorizationOnRedirect. - Command construction: SEC-10. Look for
Invoke-Expression,[scriptblock]::Create(),Start-Processwith a built argument string, and strings passed tocmd /corpwsh -Command. - Paths: SEC-12. Look for input joined into a path that is then read, written, or deleted.
- Queries: SEC-13.
- Input checks: SEC-11 and SEC-16 to SEC-19.
- Code signing, where the code signs files: SEC-30 to SEC-35.
- Transport and privilege: SEC-14 and SEC-15.
- Check what the code writes. Verbose, debug, warning, and error messages, log files, and exported files must not contain secrets or personal data.
- Run PSScriptAnalyzer. Its rules
PSAvoidUsingPlainTextForPassword,PSAvoidUsingConvertToSecureStringWithPlainText,PSAvoidUsingUsernameAndPasswordParams, andPSAvoidUsingInvokeExpressioncover part of this. - Confirm each finding by reading the full path from input to use. A pattern match alone is not a
finding. The patterns of SEC-40 find candidates.
Add-Type -TypeDefinitionis a Medium finding (SEC-41).
Report
List findings with the most serious first, each with its tier (Critical, High, Medium, or Low), and state the overall risk as the highest tier found (SEC-42): file and line, rule ID, how the problem could be exploited or exposed, and the corrected code. Say which inputs you traced and which you did not. If you find a real secret, tell the user that it must be revoked and replaced; removing it from the file does not remove it from the repository history. This review covers the code only. It is not a compliance assessment, so do not state that the code meets any regulation or framework.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

