[Bug]: Key Vault: "Ensure 'Purge protection' is set to 'Enabled'" never fails because the rule queries properties.enablePurgeProtection
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 78/100
調査の方向性
rules/findings/azure/keyvault/azure-keyvault-purge-protection-not-enabled.jsonを開き、その条件を復旧可能なKey Vaultルールと比較してください。New-MonkeyVaultObject.ps1が欠落値をどのように正規化するかを確認し、消去保護が無効なvaultに対してルールを実行してください。そのvaultが消去保護ルールに合格するのではなく、不合格になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- PowerShell
- スター
- 1.4k
- フォーク
- 144
- 平均マージ
- 1日 21時間
- マージ済み PR(30日)
- 1
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
silverhack/monkey365 のほかの issue
-
bug status/needs-triage
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
silverhack/monkey365#200 ·
-
bug status/needs-triage
難易度 4/5 3〜5日 初心者へのやさしさ 56/100
silverhack/monkey365#198 ·
-
documentation enhancement help wanted impact-low priority-medium question
難易度 4/5 3〜5日 初心者へのやさしさ 68/100
silverhack/monkey365#187 · コメント 1 件 ·
-
documentation enhancement epic priority-medium
難易度 5/5 1週間以上 初心者へのやさしさ 30/100
silverhack/monkey365#184 ·
-
Expose domain-level context for SPF / DKIM / DMARC findings in Exchange Online再び着手できるかも @silverhack が 112 日前に担当しましたが、オープン中のプルリクエストはありません。 オープンenhancement
silverhack/monkey365#167 · コメント 3 件 · 担当者 1 名 ·
silverhack/monkey365 の issue をすべて見る
似ている issue
-
CRT transfer manager mutates the caller's ExtraArgs, so reusing the dict fails on the next uploadオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
boto/s3transfer#433 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
-
platform rust
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
laithalsaadoon/microvms-agentd#758 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
MicrosoftLearning/eShopOnWeb#466 ·
-
Updating an `OidcIssuer` without `thumbprints` fails with "You must provide at least one thumbprint"オープンBug kind/bug pulumi/pulumi-pulumiservice R1 S1
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
pulumi/pulumi-pulumiservice#1370 ·
メンテナーはふだん 1 日以内に返信