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

オープン 初心者向け
#200 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
86/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
azure, powershell
領域
cloud, security

調査の方向性

core/api/azure/resourcemanagement/helpers/keyvault/New-MonkeyVaultObject.ps1 の60行目から始め、ARM応答の properties.enableRbacAuthorization がどのように読み取られるかを確認します。プロパティを true、false、未設定にして、該当する Key Vault ルールまたはテストを実行します。RBAC が有効な vault がルールに合格し、false または未設定の値では無効のままであれば完了です。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
PowerShell
スター
1.4k
フォーク
144
平均マージ
1日 21時間
マージ済み PR(30日)
1

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

silverhack/monkey365 のほかの issue

silverhack/monkey365 の issue をすべて見る

似ている issue

Cloud の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。