PowerShell / PowerShell/PSScriptAnalyzer
Rule Request: `AvoidPlaintextParameterPasswords`
還沒有人認領這個 Issue。
- 主要語言
- C#
- 星號
- 2.2k
- 分支
- 414
- 平均合併
- 13 小時 1 分鐘
- 30 天內合併 PR
- 2
描述
Similar to the rule AvoidUsingPlainTextForPassword, passing plaintext passwords to external/binary cmdlets should be avoided.
This includes cmdlets as e.g.:
PS C:\> Get-Command -ParameterName Password
CommandType Name Version Source
----------- ---- ------- ------
Function Register-ScheduledTask 1.0.0.0 ScheduledTasks
Function Set-ScheduledTask 1.0.0.0 ScheduledTasks
But could potentially any imported (binary) cmdlet with a bound parameter named Password and of type String
Knowing that the AvoidUsingPlainTextForPassword rule might not capture the security risk when using a different variable name (e.g. -Password $Wachtwoord) or a password that is statically provided:
Invoke-ScriptAnalyzer -ScriptDefinition {
Set-ScheduledTask -TaskName 'SoftwareScan' -Trigger $Time -User 'User' -Password 'P@ssw0rd'
}.ToString()
Related:
- Rule request: AvoidSecureStringDisclosure #1997
- PowerShell issue: https://github.com/PowerShell/PowerShell/issues/26366 and https://github.com/PowerShell/PowerShell/issues/16502
- Document issue: https://github.com/MicrosoftDocs/windows-powershell-docs/issues/4051
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
首先將要求的行為與現有的 AvoidUsingPlainTextForPassword 規則以及 issue 中的 PowerShell 範例進行比較。定義應如何偵測外部或二進位 cmdlet 上名為 Password 的已繫結 String 參數,包括替代變數名稱和靜態值,並使用相關的 issue 釐清範圍,之後再將工作視為完成。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- csharp, powershell
- 領域
- security, tooling
- Issue 類型
- 功能
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 活躍度
- 停滯
- 描述清晰度
- 基本清楚
- 新手友好度
- 35/100