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

Aperta Adatta ai principianti
#200 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
86/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
azure, powershell
Ambito
cloud, security

Direzione di ricerca

Inizia da core/api/azure/resourcemanagement/helpers/keyvault/New-MonkeyVaultObject.ps1, riga 60, e verifica come viene letto properties.enableRbacAuthorization dalla risposta ARM. Esegui la regola o i test pertinenti di Key Vault con la proprietà impostata su true, false e mancante; il lavoro è concluso quando i vault con RBAC abilitato superano la regola e i valori false o mancanti restano disabilitati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
PowerShell
Stelle
1.4k
Fork
144
Merge medio
1g 21h
PR unite (30g)
1

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di silverhack/monkey365

Tutte le issue di silverhack/monkey365

Issue simili

Altre issue su Cloud

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.