[Bug]: Key Vault: "Ensure 'Purge protection' is set to 'Enabled'" never fails because the rule queries properties.enablePurgeProtection
還沒有人認領這個 Issue。
評估
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 新手友好度
- 78/100
研究方向
開啟 rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.json,並將其條件與可復原的 Key Vault 規則進行比較。檢查 New-MonkeyVaultObject.ps1 如何正規化缺少的值,然後對未啟用清除保護的 vault 執行該規則。完成標準是該 vault 未通過清除保護規則,而不是通過。
由索引模型根據 Issue 內容生成。
描述
What happened?
Every Key Vault without purge protection is reported as pass for azure_key_vault_purge_protection_disabled (rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.json).
The rule condition is:
["properties.enablePurgeProtection", "eq", "false"]
properties holds the raw ARM properties of the vault. ARM only accepts true for enablePurgeProtection (Key Vault reference: "Enabling this functionality is irreversible - that is, the property does not accept false as its value"). A vault that never had purge protection enabled has no enablePurgeProtection value at all, and $null -eq $false is false, so the condition never matches.
New-MonkeyVaultObject.ps1 already normalises the value (line 75):
protection = [PSCustomObject]@{
enablePurgeProtection = If($null -ne $InputObject.Properties.PsObject.Properties.Item('enablePurgeProtection')){$InputObject.Properties.enablePurgeProtection}Else{$false};
How to reproduce it
- Use a Key Vault created without purge protection.
az keyvault show -n <vault> --query "{purge:properties.enablePurgeProtection, softDelete:properties.enableSoftDelete}"returns"purge": null, "softDelete": true. - Run
Invoke-Monkey365 -Instance Azurewith the default ruleset. azure_key_vault_purge_protection_disabledis reported as pass.
Expected behavior
The rule fails for vaults without purge protection.
Suggested fix
Query the normalised value, as the "recoverable" rule already does:
["protection.enablePurgeProtection", "eq", "false"]
From where are you running Monkey365?
- Resource: Docker container
- OS: Linux (Ubuntu 24.04)
- PowerShell Version: 7.6.9
- Monkey365 Version: 1.0.5 (also 1.0.0, PowerShell Gallery)
- Others: app-only authentication with access tokens
Additional context
Same pattern as the Key Vault RBAC issue (value read or queried at the wrong level), reported separately.
- 主要語言
- PowerShell
- 星號
- 1.4k
- 分支
- 144
- 平均合併
- 1 天 21 小時
- 30 天內合併 PR
- 1
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
silverhack/monkey365 的其他 Issue
-
bug status/needs-triage
難度 2/5 1-3 小時 新手友好度 86/100
silverhack/monkey365#200 ·
-
bug status/needs-triage
難度 4/5 3-5 天 新手友好度 56/100
silverhack/monkey365#198 ·
-
documentation enhancement help wanted impact-low priority-medium question
難度 4/5 3-5 天 新手友好度 68/100
silverhack/monkey365#187 · 1 則留言 ·
-
documentation enhancement epic priority-medium
難度 5/5 一週以上 新手友好度 30/100
silverhack/monkey365#184 ·
-
Expose domain-level context for SPF / DKIM / DMARC findings in Exchange Online可能重新可做 @silverhack 於 114 天前認領,目前沒有進行中的 PR。 未關閉enhancement
silverhack/monkey365#167 · 3 則留言 · 已指派 1 人 ·
查看 silverhack/monkey365 的全部 Issue
相似的 Issue
-
Rasterio granule reads never retry, so one 503 (Service Unavailable) fails the whole request可能已有人在做 @chuckwondo 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 75/100
developmentseed/titiler-cmr#305 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 75/100
-
size: XS
難度 2/5 1-3 小時 新手友好度 72/100
fells-code/seamless-glance#166 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 86/100
aws/aws-sdk-js-v3#8411 ·
維護者通常 1 天內回覆
-
[E2E Fabric] compute-vm: Disk types and options storage pool example fails on n4-standard-2 capacity in europe-west4-c and StoragePool hourly creation limit可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 66/100
GoogleCloudPlatform/cloud-foundation-fabric#4375 ·
維護者通常 1 天內回覆