microsoft / microsoft/PSRule

Ability to exclude rules by tag / pillars

Open
#1,825 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement feature: core
Dominant language
C#
Stars
474
Forks
65
Avg merge
22h 25m
Merged PRs (30d)
26

Description

Is your feature request related to a problem? Please describe.

I'd like the ability to exclude pillars / group of rules by category. Take PSRule.Rules.Azure for instance, where I'd like to exclude all rules in the pillar "reliability".

Example rule in this pillar / category:

Seems it has tag 'Azure.WAF/pillar' = 'Reliability'.

Describe the solution you'd like

The ability to exclude a group of rules based on pillar / category.

Describe alternatives you've considered

Invoke-PSRule -Module 'PSRule.Rules.Azure' -Option @{
    'AZURE_BICEP_CHECK_TOOL'             = [bool] $true
    'AZURE_BICEP_FILE_EXPANSION'         = [bool] $true
    'AZURE_BICEP_FILE_EXPANSION_TIMEOUT' = [uint16] 30
    'AZURE_BICEP_PARAMS_FILE_EXPANSION'  = [bool] $true
    'RULE.EXCLUDE'                       = [string[]](
        (Get-PSRule -Module 'PSRule.Rules.Azure').Where{$_.'Tags'.'Azure.WAF/pillar' -eq 'Reliability'}.'Name'
    )
}

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Invoke-PSRule and Get-PSRule entry points and the Azure.WAF/pillar tag shown in the PSRule.Rules.Azure example. Define how a pillar or category filter should interact with RULE.EXCLUDE, then verify that rules tagged Reliability are excluded when invoking the module.

Written by the indexing model from the issue text.

Assessment

Tech stack
powershell
Domain
devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.