[Bug]: Key Vault: "Ensure 'Purge protection' is set to 'Enabled'" never fails because the rule queries properties.enablePurgeProtection
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 2/5
- Tempo estimado
- 1-3 horas
- Facilidade para iniciantes
- 78/100
Direção de pesquisa
Abra rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.json e compare a condição com a regra recuperável do Key Vault. Verifique como New-MonkeyVaultObject.ps1 normaliza o valor ausente e, em seguida, execute a regra em um vault sem proteção contra exclusão definitiva. A tarefa estará concluída quando esse vault falhar na regra de proteção contra exclusão definitiva, em vez de passar.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.
- Linguagem predominante
- PowerShell
- Estrelas
- 1.4k
- Forks
- 144
- Merge médio
- 1d 21h
- PRs com merge (30d)
- 1
Preparar o ambiente
- Sem Dockerfile nem arquivo Docker Compose
- Tem um modelo de pull request
- Ler o guia de contribuição
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de silverhack/monkey365
-
bug status/needs-triage
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 86/100
silverhack/monkey365#200 ·
-
bug status/needs-triage
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 56/100
silverhack/monkey365#198 ·
-
documentation enhancement help wanted impact-low priority-medium question
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 68/100
silverhack/monkey365#187 · 1 comentário ·
-
documentation enhancement epic priority-medium
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 30/100
silverhack/monkey365#184 ·
-
Expose domain-level context for SPF / DKIM / DMARC findings in Exchange OnlineTalvez livre de novo @silverhack assumiu há 112 dias e não há nenhum pull request aberto. Abertaenhancement
silverhack/monkey365#167 · 3 comentários · 1 responsável ·
Todas as issues de silverhack/monkey365
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
-
[BUG] OpenSearch domain endpoint includes a URI scheme and breaks standard Terraform consumersAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
floci-io/floci#7707 · 1 comentário ·
Mantenedores costumam responder em até 1 dia
-
CRT transfer manager mutates the caller's ExtraArgs, so reusing the dict fails on the next uploadAberta
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 82/100
boto/s3transfer#433 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 72/100
-
S3 input fails in Docker image: DuckDB can't find home directoryTalvez já em andamento @jnioche assumiu hoje. Abertabug docker reporting
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 78/100
DigitalPebble/spruce#315 ·
Mantenedores costumam responder em até 1 dia