[Bug]: Key Vault: "Ensure 'Purge protection' is set to 'Enabled'" never fails because the rule queries properties.enablePurgeProtection
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Anfängerfreundlichkeit
- 78/100
Rechercherichtung
Öffne rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.json und vergleiche dessen Bedingung mit der wiederherstellbaren Key Vault-Regel. Prüfe, wie New-MonkeyVaultObject.ps1 den fehlenden Wert normalisiert, und führe die Regel anschließend für einen Vault ohne Purge Protection aus. Fertig ist die Aufgabe, wenn dieser Vault die Purge Protection-Regel nicht mehr besteht, statt sie zu bestehen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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.
- Vorherrschende Sprache
- PowerShell
- Sterne
- 1.4k
- Forks
- 144
- Ø Merge
- 1 T. 21 Std.
- Gemergte PRs (30 T.)
- 1
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus silverhack/monkey365
-
bug status/needs-triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 86/100
silverhack/monkey365#200 ·
-
bug status/needs-triage
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 56/100
silverhack/monkey365#198 ·
-
documentation enhancement help wanted impact-low priority-medium question
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 68/100
silverhack/monkey365#187 · 1 Kommentar ·
-
documentation enhancement epic priority-medium
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 30/100
silverhack/monkey365#184 ·
-
Expose domain-level context for SPF / DKIM / DMARC findings in Exchange OnlineEvtl. wieder frei @silverhack hat das vor 112 Tagen übernommen, und es ist kein Pull Request offen. Offenenhancement
silverhack/monkey365#167 · 3 Kommentare · 1 zugewiesene Person ·
Alle Issues in silverhack/monkey365
Ähnliche Issues
-
[BUG] OpenSearch domain endpoint includes a URI scheme and breaks standard Terraform consumersOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
floci-io/floci#7707 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
CRT transfer manager mutates the caller's ExtraArgs, so reusing the dict fails on the next uploadOffen
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
boto/s3transfer#433 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
-
Lambda MicroVMs added x86-64: the service model now lists X86_64, INTEL and 100 image env varsOffenplatform rust
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
laithalsaadoon/microvms-agentd#758 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
MicrosoftLearning/eShopOnWeb#466 ·