Skip to content

Ext Request SC uses wrong any service protocol 0 (HOPOPT)#4920

Open
tpurschke wants to merge 7 commits into
CactuseSecurity:developfrom
tpurschke:fix/modelling-delete-rule-any-svc
Open

Ext Request SC uses wrong any service protocol 0 (HOPOPT)#4920
tpurschke wants to merge 7 commits into
CactuseSecurity:developfrom
tpurschke:fix/modelling-delete-rule-any-svc

Conversation

@tpurschke

@tpurschke tpurschke commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Diagnosis

The rule was not implemented with "Any" — but it also wasn't implemented with two separate service objects. FWO reports flatten service groups into their members (RuleDisplayBase.cs:257-279), so the tcp_1-65535 / udp_1-65535 you see in the report is consistent with the rule referencing a single service group containing those two services. That explains why the ticket had exactly one faulty service entry:

  • GetElementsFromRule creates one element for the group with GroupName set and ProtoId = null (groups have no protocol).
  • GetServiceElements() coerces the null ProtoId to 0.
  • ConvertServiceElems ignored GroupName entirely (unlike the network-object conversion) and rendered protocol 0 through the IP-protocol template — and protocol 0 is HOPOPT in the IANA table. Hence {"@type": "PREDEFINED", "protocol": "OTHER", "predefined_name": "HOPOPT"}.
    You can verify against the DB: the rule's rule_services should contain one group object whose svcgrp_flats are the two port-range services.

Fix

  • SCAccessRequestTicketTask.cs — service conversion now handles two previously broken cases, with duplicates suppressed:
    • Element with GroupName → rendered as an object reference ({"@type": "Object", "object_name": "", "management_name": ""}), reusing the existing group template and the external management name, exactly like sources/destinations. This is the documented Tufin way to reference existing service objects.
    • Element without protocol (ProtoId <= 0) → rendered as {"@type": "ANY"} (covers rules using a genuine "Any" service).
  • SCConstants.cs — new constant SCAnyServiceJson for the fixed API construct.
  • SCTicketTest.cs — two new tests: a rule-delete task with protocol-less services produces a single ANY entry, and one with a service-group element produces the object reference with management name.Revised diagnosis (based on your reporting screenshot)
    The rule was not implemented with "Any" — but it also wasn't implemented with two separate service objects. FWO reports flatten service groups into their members (RuleDisplayBase.cs:257-279), so the tcp_1-65535 / udp_1-65535 you see in the report is consistent with the rule referencing a single service group containing those two services. That explains why the ticket had exactly one faulty service entry:

GetElementsFromRule creates one element for the group with GroupName set and ProtoId = null (groups have no protocol).
GetServiceElements() coerces the null ProtoId to 0.
ConvertServiceElems ignored GroupName entirely (unlike the network-object conversion) and rendered protocol 0 through the IP-protocol template — and protocol 0 is HOPOPT in the IANA table. Hence {"@type": "PREDEFINED", "protocol": "OTHER", "predefined_name": "HOPOPT"}.
You can verify against the DB: the rule's rule_services should contain one group object whose svcgrp_flats are the two port-range services.

The fix (uncommitted, on feat/redhat-support)
SCAccessRequestTicketTask.cs — service conversion now handles two previously broken cases, with duplicates suppressed:
Element with GroupName → rendered as an object reference ({"@type": "Object", "object_name": "", "management_name": ""}), reusing the existing group template and the external management name, exactly like sources/destinations. This is the documented Tufin way to reference existing service objects.
Element without protocol (ProtoId <= 0) → rendered as {"@type": "ANY"} (covers rules using a genuine "Any" service).
SCConstants.cs — new constant SCAnyServiceJson for the fixed API construct.
SCTicketTest.cs — two new tests: a rule-delete task with protocol-less services produces a single ANY entry, and one with a service-group element produces the object reference with management name.

Related ticket

https://support.cactus.de/scp/tickets.php?id=129

@tpurschke tpurschke changed the title fix1 Ext Request SC uses wrong any service protocol 0 (HOPOPT) Jul 9, 2026
@tpurschke tpurschke self-assigned this Jul 9, 2026
@tpurschke

Copy link
Copy Markdown
Contributor Author

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 19955ad4ba

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

{
return FillNwObjGroupTemplate(template, svc.GroupName, mgtName ?? "");
}
if (svc.ProtoId <= 0) // no protocol (e.g. rule service "Any"): must not be resolved as ip protocol 0 (HOPOPT)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve explicit protocol 0 services

When a request really contains IP protocol 0, this branch now serializes it as ANY instead of using the IP-protocol template. Protocol 0 is a seeded valid protocol (roles/database/files/csv/ip-protocol-list.csv:1 is HOPOPT), while WfReqTask.GetServiceElements() also maps a missing protocol to 0, so the conversion needs to distinguish null/missing from an explicit ip_proto_id = 0; otherwise an access or rule-delete ticket for a real HOPOPT service is broadened to all services.

Useful? React with 👍 / 👎.

@tpurschke tpurschke marked this pull request as ready for review July 12, 2026 19:57
@sonarqubecloud

Copy link
Copy Markdown

@tpurschke tpurschke requested a review from Y4nnikH July 12, 2026 20:35
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