microsoft / PSRule

Validate infrastructure as code (IaC) and objects using PowerShell rules.

Home Page:https://microsoft.github.io/PSRule/v2/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Path navigation with XML nodes

BernieWhite opened this issue · comments

Description of the issue

There appears to be some inconsistencies handling some XML nodes/ elements in PowerShell assertions (YAML/ JSON) also need to be tested.

To Reproduce

Steps to reproduce the issue:

<policies><inbound><ip-filter action="allow"><address-range from="51.175.196.187" to="51.175.196.187" /></ip-filter></inbound><backend><base /></backend><outbound><base /></outbound><on-error><base /></on-error></policies>

The following code passes, but should not because the base element is not a child of inbound.

$Assert.HasField($policy, 'inbound.base')

Expected behaviour

PSRule

Module in use and version:

  • Module: PSRule
  • Version: 2.8.1

Additional context