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

Offen Anfängerfreundlich
#200 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
86/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
azure, powershell
Bereich
cloud, security

Rechercherichtung

Beginne mit core/api/azure/resourcemanagement/helpers/keyvault/New-MonkeyVaultObject.ps1, Zeile 60, und prüfe, wie properties.enableRbacAuthorization aus der ARM-Antwort gelesen wird. Führe die relevante Key Vault-Regel oder die Tests mit der Eigenschaft auf true, false und nicht gesetzt aus; fertig ist die Aufgabe, wenn Tresore mit aktiviertem RBAC die Regel bestehen und Werte, die false oder nicht gesetzt sind, deaktiviert bleiben.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

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.

Vorherrschende Sprache
PowerShell
Sterne
1.4k
Forks
144
Ø Merge
1 T. 21 Std.
Gemergte PRs (30 T.)
1

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus silverhack/monkey365

Alle Issues in silverhack/monkey365

Ähnliche Issues

Weitere Issues zu Cloud

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.