[Bug]: Key Vault: "Ensure 'Purge protection' is set to 'Enabled'" never fails because the rule queries properties.enablePurgeProtection
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 78/100
Direzione di ricerca
Apri rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.json e confronta la sua condizione con quella della regola Key Vault recuperabile. Controlla come New-MonkeyVaultObject.ps1 normalizza il valore mancante, poi esegui la regola su un vault senza protezione dall’eliminazione definitiva. Il lavoro è completato quando quel vault non supera la regola di protezione dall’eliminazione definitiva, invece di superarla.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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.
- Lingua principale
- PowerShell
- Stelle
- 1.4k
- Fork
- 144
- Merge medio
- 1g 21h
- PR unite (30g)
- 1
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di silverhack/monkey365
-
bug status/needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
silverhack/monkey365#200 ·
-
bug status/needs-triage
Difficoltà 4/5 3-5 giorni Idoneità per principianti 56/100
silverhack/monkey365#198 ·
-
documentation enhancement help wanted impact-low priority-medium question
Difficoltà 4/5 3-5 giorni Idoneità per principianti 68/100
silverhack/monkey365#187 · 1 commento ·
-
documentation enhancement epic priority-medium
Difficoltà 5/5 Più di una settimana Idoneità per principianti 30/100
silverhack/monkey365#184 ·
-
Expose domain-level context for SPF / DKIM / DMARC findings in Exchange OnlineForse di nuovo libera @silverhack l’ha presa 112 giorni fa e non c’è nessuna pull request aperta. Apertaenhancement
silverhack/monkey365#167 · 3 commenti · 1 assegnatario ·
Tutte le issue di silverhack/monkey365
Issue simili
-
CRT transfer manager mutates the caller's ExtraArgs, so reusing the dict fails on the next uploadAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
boto/s3transfer#433 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
Lambda MicroVMs added x86-64: the service model now lists X86_64, INTEL and 100 image env varsApertaplatform rust
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
laithalsaadoon/microvms-agentd#758 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 73/100
MicrosoftLearning/eShopOnWeb#466 ·
-
Updating an `OidcIssuer` without `thumbprints` fails with "You must provide at least one thumbprint"ApertaBug kind/bug pulumi/pulumi-pulumiservice R1 S1
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
pulumi/pulumi-pulumiservice#1370 ·
I maintainer di solito rispondono entro 1 giorno