[Enhancement]: Be able to define priorities in blueprint rules configurations. #404

Closed
opened 2026-04-05 17:09:06 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @JanGrosse on 1/4/2026

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

Currently when defining blueprints for e.g. public-resources one can define rules (https://docs.pangolin.net/manage/blueprints#rules-configuration). But as of now those rules do not include the priority setting.
This PR is trying to change that by adding them as optional field to not break existing blueprints.

How to test?

Spin up the testing environment, add a new blueprint through the GUI.
For example

public-resources:
  demo:
    name: demo
    protocol: http
    full-domain: demo.example.com
    host-header: example.com
    tls-server-name: example.com
    rules:
      - action: deny
        match: ip
        value: 1.2.3.1
        priority: 100
      - action: pass
        match: ip
        value: 1.2.3.2
        priority: 200

Check the ressources tab, it should now include the defined priorities 100 & 200 instead of the auto-assigned values 1 & 2.
grafik

Additional Information

It also validates the rule that priorities should not be duplicated (same as when adding them manually).
Additionally it takes into account that priorities get auto-assigned a value based on the index of the rule + 1.

So when defining a rule with a mix of assigned and unassigned priorities it "simulates" the auto-assignment during validation to check for duplicated priorities which can occur in mixing.
For example the following rules would be invalid as the first rule gets auto-assigned the priority 1 and the follwoing rule tries to assign the same priority.

[...]
    rules:
      - action: deny
        match: ip
        value: 1.2.3.1
      - action: pass
        match: ip
        value: 1.2.3.2
        priority: 1 <--- Invalid
*Originally created by @JanGrosse on 1/4/2026* ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description Currently when defining blueprints for e.g. public-resources one can define rules (https://docs.pangolin.net/manage/blueprints#rules-configuration). But as of now those rules do not include the `priority` setting. This PR is trying to change that by adding them as optional field to not break existing blueprints. ## How to test? Spin up the testing environment, add a new blueprint through the GUI. For example ```yaml public-resources: demo: name: demo protocol: http full-domain: demo.example.com host-header: example.com tls-server-name: example.com rules: - action: deny match: ip value: 1.2.3.1 priority: 100 - action: pass match: ip value: 1.2.3.2 priority: 200 ``` Check the ressources tab, it should now include the defined priorities 100 & 200 instead of the auto-assigned values 1 & 2. <img width="1581" height="807" alt="grafik" src="https://github.com/user-attachments/assets/dd92ab5d-46e3-40c0-ad24-c304421906d7" /> ## Additional Information It also validates the rule that priorities should not be duplicated (same as when adding them manually). Additionally it takes into account that priorities get auto-assigned a value based on the index of the rule + 1. So when defining a rule with a mix of assigned and unassigned priorities it "simulates" the auto-assignment during validation to check for duplicated priorities which can occur in mixing. For example the following rules would be invalid as the first rule gets auto-assigned the priority 1 and the follwoing rule tries to assign the same priority. ```yaml [...] rules: - action: deny match: ip value: 1.2.3.1 - action: pass match: ip value: 1.2.3.2 priority: 1 <--- Invalid ```
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/pangolin#404