Skip to content

Proposal: Support multiple rule instances from template rules#96

Open
TimoWiddauCC wants to merge 3 commits intofelipebz:mainfrom
TimoWiddauCC:support-multiple-template-rules
Open

Proposal: Support multiple rule instances from template rules#96
TimoWiddauCC wants to merge 3 commits intofelipebz:mainfrom
TimoWiddauCC:support-multiple-template-rules

Conversation

@TimoWiddauCC
Copy link
Copy Markdown

@TimoWiddauCC TimoWiddauCC commented Apr 29, 2026

Issue

Currently, the ZPA CLI configuration supports configuration of a single instance for a rule only. The configuration key also needs to match the rule name for detection (related: #89). This limitation prevents users from defining multiple instances of the same rule with different configurations like for XPath rules.

Proposed solution

This PR introduces the templateRuleKey field in the CLI configuration file. This allows users to create multiple rule instances from a single template rule with different parameters. This enables support for multiple rules with different configuration. The implementation is written to avoid changes to zpa-core. If zpa-core would be extended, some code here could be de-duplicated / removed again.

Example

Users can now configure rule instances from a template like this:

{
  "rules": {
        "CustomXPath_SelectStar": {
            "level": "minor",
            "templateRuleKey": "XPath",
            "parameters": {
                "xpathQuery": "//SELECT_COLUMN/MULTIPLICATION",
                "message": "SELECT * used in query"
            }
        },
        "CustomXPath_SelectStar_SecondRule": {
            "level": "minor",
            "templateRuleKey": "zpa:XPath",
            "parameters": {
                "xpathQuery": "//SELECT_COLUMN/MULTIPLICATION",
                "message": "SELECT * used in query - second rule"
            }
        }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant