[Bug]: Key Vault: enableRbacAuthorization is always reported as false (New-MonkeyVaultObject reads the property at the wrong level)

Aberta Para iniciantes
#200 0 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
86/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
azure, powershell
Domínio
cloud, security

Direção de pesquisa

Comece por core/api/azure/resourcemanagement/helpers/keyvault/New-MonkeyVaultObject.ps1, linha 60, e verifique como properties.enableRbacAuthorization é lido na resposta do ARM. Execute a regra ou os testes relevantes do Key Vault com a propriedade definida como true, false e ausente; o trabalho estará concluído quando os vaults com RBAC habilitado passarem pela regra e os valores false ou ausentes permanecerem desabilitados.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

bug status/needs-triage

What happened?
For every Key Vault, Monkey365 reports "RBAC Enabled: false", including vaults that use the Azure RBAC permission model. The rule "Ensure that RBAC is enabled for Azure Key Vault" (azure_key_vault_rbac_disabled) therefore fails for all vaults.

Cause: core/api/azure/resourcemanagement/helpers/keyvault/New-MonkeyVaultObject.ps1, line 60:

enableRbacAuthorization = if($null -ne $InputObject.Psobject.Properties.Item('enableRbacAuthorization')){$InputObject.properties.enableRbacAuthorization}else{$false};

The check looks for enableRbacAuthorization on the top level of the ARM object, but ARM returns it under properties. The condition is never true, so the value is always $false.

How to reproduce it

  1. Create a Key Vault with the RBAC permission model (properties.enableRbacAuthorization = true, checked with an ARM GET).
  2. Run Invoke-Monkey365 -Instance Azure with the default ruleset.
  3. The vault is reported with RBAC disabled.

Expected behavior
Vaults with properties.enableRbacAuthorization = true pass the rule.

Suggested fix

enableRbacAuthorization = if($null -ne $InputObject.properties -and $null -ne $InputObject.properties.PsObject.Properties.Item('enableRbacAuthorization')){$InputObject.properties.enableRbacAuthorization}else{$false};

We apply this change locally and tested it against 1.0.5 with true, false and a missing property.

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 seen in 1.0.0, PowerShell Gallery)
  • Others: app-only authentication with access tokens

Additional context
The purge protection rule has a similar path problem; reported separately.

Linguagem predominante
PowerShell
Estrelas
1.4k
Forks
144
Merge médio
1d 21h
PRs com merge (30d)
1

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de silverhack/monkey365

Todas as issues de silverhack/monkey365

Issues semelhantes

Mais issues de Cloud

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.