[GH-ISSUE #3273] Rule REST API Issues #35776

Open
opened 2026-06-18 21:00:33 -05:00 by GiteaMirror · 2 comments
Owner

Originally created by @the-kwak on GitHub (Jun 14, 2026).
Original GitHub issue: https://github.com/fosrl/pangolin/issues/3273

Originally assigned to: @oschwartz10612, @Copilot on GitHub.

Describe the Bug

When attempting to modify Rules using the POST request resource ID is not found.

When resource ID it changes when any other rule is created under that resource.

Thought it was a bug after upgrading. deleted everything and started from the install script and after up and running issue persisted.

Environment

  • OS Type & Version: ubuntu 24.04.4 LTS
  • Pangolin Version: v1.19.2
  • Edition (Community or Enterprise): Community
  • Gerbil Version: 1.4.2
  • Traefik Version: v3.6
  • Newt Version: v1.13.0
  • Client Version:N/A

To Reproduce

Use GET on resourceId to retrieve ruleId succecceful
eg.

    {
        "ruleId": 24,
        "resourceId": null,
        "action": "ACCEPT",
        "match": "IP",
        "value": "0.0.0.0",
        "priority": 1,
        "enabled": true
      },

Use POST on resourceId and ruleId returns:

{
  "data": null,
  "success": false,
  "error": true,
  "message": "Resource rule with ID 24 not found",
  "status": 404,
  "stack": null
}

After adding a new rule to the resource all ruleIds change:
rule added:

{
     "ruleId": 38,
     "resourceId": null,
     "action": "DROP",
     "match": "ASN",
     "value": "AS16509",
     "priority": 622,
     "enabled": true
   }

original ruleId 24 is now changed and still cannot be used in POST request:

      {
        "ruleId": 31,
        "resourceId": null,
        "action": "ACCEPT",
        "match": "IP",
        "value": "0.0.0.0",
        "priority": 1,
        "enabled": true
      }

Post request after ruleId changed

{
  "data": null,
  "success": false,
  "error": true,
  "message": "Resource rule with ID 31 not found",
  "status": 404,
  "stack": null
}

Expected Behavior

Expected behavior is for ruleId to not change when another rule is added.
as well as being able to update the rule after it is created by resourceId and ruleId.

Originally created by @the-kwak on GitHub (Jun 14, 2026). Original GitHub issue: https://github.com/fosrl/pangolin/issues/3273 Originally assigned to: @oschwartz10612, @Copilot on GitHub. ### Describe the Bug When attempting to modify Rules using the POST request resource ID is not found. When resource ID it changes when any other rule is created under that resource. Thought it was a bug after upgrading. deleted everything and started from the install script and after up and running issue persisted. ### Environment - OS Type & Version: ubuntu 24.04.4 LTS - Pangolin Version: v1.19.2 - Edition (Community or Enterprise): Community - Gerbil Version: 1.4.2 - Traefik Version: v3.6 - Newt Version: v1.13.0 - Client Version:N/A ### To Reproduce Use GET on resourceId to retrieve ruleId succecceful eg. ``` { "ruleId": 24, "resourceId": null, "action": "ACCEPT", "match": "IP", "value": "0.0.0.0", "priority": 1, "enabled": true }, ``` Use POST on resourceId and ruleId returns: ``` { "data": null, "success": false, "error": true, "message": "Resource rule with ID 24 not found", "status": 404, "stack": null } ``` After adding a new rule to the resource all ruleIds change: rule added: ``` { "ruleId": 38, "resourceId": null, "action": "DROP", "match": "ASN", "value": "AS16509", "priority": 622, "enabled": true } ``` original ruleId 24 is now changed and still cannot be used in POST request: ``` { "ruleId": 31, "resourceId": null, "action": "ACCEPT", "match": "IP", "value": "0.0.0.0", "priority": 1, "enabled": true } ``` Post request after ruleId changed ``` { "data": null, "success": false, "error": true, "message": "Resource rule with ID 31 not found", "status": 404, "stack": null } ``` ### Expected Behavior Expected behavior is for ruleId to not change when another rule is added. as well as being able to update the rule after it is created by resourceId and ruleId.
GiteaMirror added the potential bug label 2026-06-18 21:00:33 -05:00
Author
Owner

@durango99 commented on GitHub (Jun 17, 2026):

I am seeing the same issue updating a rule for a resource. This seems to have come up with the update to 1.19 release. Issue occurred with Community edition and then when tested on Enterprise edition.

Testing with the api docs swagger:

List rules for resource 5, shows ruleId 4 exists.

curl -X 'GET'
'https://api.domain.us/v1/resource/5/rules?limit=1000&offset=0'
-H 'accept: application/json'
-H 'Authorization: Bearer xxx'

Response body

{
"data": {
"rules": [
{
"ruleId": 4,
"resourceId": null,
"action": "ACCEPT",
"match": "IP",
"value": "1.1.1.1",
"priority": 1,
"enabled": true
}
],
"pagination": {
"total": 1,
"limit": 1000,
"offset": 0
}
},
"success": true,
"error": false,
"message": "Resource rules retrieved successfully",
"status": 200
}

Update rule 4 for resource 5 gives 404 error:

curl -X 'POST'
'https://api.domain.us/v1/resource/5/rule/4'
-H 'accept: application/json'
-H 'Authorization: Bearer xxx'
-H 'Content-Type: application/json'
-d '{
"action": "ACCEPT",
"match": "IP",
"value": "8.8.8.8",
"priority": 1,
"enabled": true
}'

Response body

Download
{
"data": null,
"success": false,
"error": true,
"message": "Resource rule with ID 4 not found",
"status": 404,
"stack": null
}

<!-- gh-comment-id:4735707714 --> @durango99 commented on GitHub (Jun 17, 2026): I am seeing the same issue updating a rule for a resource. This seems to have come up with the update to 1.19 release. Issue occurred with Community edition and then when tested on Enterprise edition. Testing with the api docs swagger: **List rules for resource 5, shows ruleId 4 exists.** curl -X 'GET' \ 'https://api.domain.us/v1/resource/5/rules?limit=1000&offset=0' \ -H 'accept: application/json' \ -H 'Authorization: Bearer xxx' **Response body** { "data": { "rules": [ { "ruleId": 4, "resourceId": null, "action": "ACCEPT", "match": "IP", "value": "1.1.1.1", "priority": 1, "enabled": true } ], "pagination": { "total": 1, "limit": 1000, "offset": 0 } }, "success": true, "error": false, "message": "Resource rules retrieved successfully", "status": 200 } **Update rule 4 for resource 5 gives 404 error:** curl -X 'POST' \ 'https://api.domain.us/v1/resource/5/rule/4' \ -H 'accept: application/json' \ -H 'Authorization: Bearer xxx' \ -H 'Content-Type: application/json' \ -d '{ "action": "ACCEPT", "match": "IP", "value": "8.8.8.8", "priority": 1, "enabled": true }' **Response body** Download { "data": null, "success": false, "error": true, "message": "Resource rule with ID 4 not found", "status": 404, "stack": null }
Author
Owner

@pr0v1d3r commented on GitHub (Jun 18, 2026):

Same issue for me on pangolin v1.19.2

below issue described

POST /resource/{resourceId}/rule/{ruleId} (update rule) returns 404 for any valid ruleId

Description

The update endpoint for resource rules always returns a 404 "Resource rule with ID X not found" error, even when the rule unquestionably exists and was just created moments before.

Steps to reproduce

  1. Create a rule:
PUT /v1/resource/{resourceId}/rule
Content-Type: application/json

{
  "action": "ACCEPT",
  "match": "IP",
  "value": "1.2.3.4",
  "priority": 100,
  "enabled": true
}

Response: 201, returns a new ruleId (e.g. 72).

  1. Confirm it exists via list:
GET /v1/resource/{resourceId}/rules

The newly created ruleId appears in the response.

  1. Attempt to update it, per the documented spec (POST /resource/{resourceId}/rule/{ruleId}, only priority required):
POST /v1/resource/{resourceId}/rule/{ruleId}
Content-Type: application/json

{
  "priority": 101
}

Response: 404

{"data":null,"success":false,"error":true,"message":"Resource rule with ID {ruleId} not found","status":404,"stack":null}

Expected

200 with the updated rule.

Actual

404, for every ruleId tested, including ones confirmed to exist via the list endpoint moments earlier. Tried with both the full create-shaped body and the minimal {"priority": ...} body — same result either way, ruling out a request-shape issue.

Observation

Every rule returned by GET /resource/{resourceId}/rules has "resourceId": null, while the create response includes a resourcePolicyId (e.g. 8) instead. This suggests the update handler may be looking up rules by a resourceId foreign key that's never populated, rather than joining through resourcePolicyId the way create/list appear to.

Environment

Self-hosted Pangolin, API accessed via /v1 per the published OpenAPI spec.

<!-- gh-comment-id:4743892269 --> @pr0v1d3r commented on GitHub (Jun 18, 2026): Same issue for me on pangolin v1.19.2 below issue described # `POST /resource/{resourceId}/rule/{ruleId}` (update rule) returns 404 for any valid ruleId ## Description The update endpoint for resource rules always returns a 404 `"Resource rule with ID X not found"` error, even when the rule unquestionably exists and was just created moments before. ## Steps to reproduce 1. Create a rule: ``` PUT /v1/resource/{resourceId}/rule Content-Type: application/json { "action": "ACCEPT", "match": "IP", "value": "1.2.3.4", "priority": 100, "enabled": true } ``` Response: `201`, returns a new `ruleId` (e.g. `72`). 2. Confirm it exists via list: ``` GET /v1/resource/{resourceId}/rules ``` The newly created `ruleId` appears in the response. 3. Attempt to update it, per the documented spec (`POST /resource/{resourceId}/rule/{ruleId}`, only `priority` required): ``` POST /v1/resource/{resourceId}/rule/{ruleId} Content-Type: application/json { "priority": 101 } ``` Response: `404` ```json {"data":null,"success":false,"error":true,"message":"Resource rule with ID {ruleId} not found","status":404,"stack":null} ``` ## Expected `200` with the updated rule. ## Actual `404`, for every `ruleId` tested, including ones confirmed to exist via the list endpoint moments earlier. Tried with both the full create-shaped body and the minimal `{"priority": ...}` body — same result either way, ruling out a request-shape issue. ## Observation Every rule returned by `GET /resource/{resourceId}/rules` has `"resourceId": null`, while the create response includes a `resourcePolicyId` (e.g. `8`) instead. This suggests the update handler may be looking up rules by a `resourceId` foreign key that's never populated, rather than joining through `resourcePolicyId` the way create/list appear to. ## Environment Self-hosted Pangolin, API accessed via `/v1` per the published OpenAPI spec.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/pangolin#35776