Skip to content

Proposal: Support multiple rule instances from template rules#96

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

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

Conversation

@TimoWiddauCC

@TimoWiddauCC TimoWiddauCC commented Apr 29, 2026

Copy link
Copy Markdown

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"
            }
        }
  }
}

@AndreasIgelCC

Copy link
Copy Markdown

Hi @felipebz,

thanks for maintaining this project and for your ongoing work on zpa-cli 👍

We’re currently looking into integrating zpa-cli into our CI/CD pipelines, and this change would be really valuable for us. Supporting multiple regex rules based on the regex-template-rule would allow us to define several rules instead of being limited to a single regex rule today.

Would you mind taking a look at this PR when you have a moment? It would help us a lot in moving forward with the integration.

Thanks again for your work and support!

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.

2 participants