[Feature] Reject invalid dst in policy #1025

Closed
opened 2025-12-29 02:27:41 +01:00 by adam · 0 comments
Owner

Originally created by @nblock on GitHub (May 16, 2025).

Use case

Improve pre-flight validation of policy and better align with policy validation of tailscale.com.

Description

Headscale currently accepts two values for "dst" which get rejected by tailscale.com.

Destination without port

This policy is currently accepted by Headscale while being rejected by tailscale.com with the error message Error: dst="100.64.0.1": hostport must contain a colon (":")

{
  "acls": [
    {
      "action": "accept",
      "src": [
        "*"
      ],
      "dst": [
        "100.64.0.1"
      ]
    }
  ]
}

Destination with invalid port

This policy is currently accepted by Headscale while being rejected by tailscale.com with the error message Error: dst="100.64.0.1:0": port range "0": first port must be >0, or use '*' for wildcard

{
  "acls": [
    {
      "action": "accept",
      "src": [
        "*"
      ],
      "dst": [
        "100.64.0.1:0"
      ]
    }
  ]
}

Both are breaking changes as Headscale would refuse to start. The second one is a bit more nuanced as such a rule was required in Headscale < 0.26 to make subnet routers visible to peers. However, the documentation for 0.26 does no longer contain this rule.

Contribution

  • I can write the design doc for this feature
  • I can contribute this feature

How can it be implemented?

No response

Originally created by @nblock on GitHub (May 16, 2025). ### Use case Improve pre-flight validation of policy and better align with policy validation of tailscale.com. ### Description Headscale currently accepts two values for "dst" which get rejected by tailscale.com. #### Destination without port This policy is currently accepted by Headscale while being rejected by tailscale.com with the error message `Error: dst="100.64.0.1": hostport must contain a colon (":")` ```json { "acls": [ { "action": "accept", "src": [ "*" ], "dst": [ "100.64.0.1" ] } ] } ``` #### Destination with invalid port This policy is currently accepted by Headscale while being rejected by tailscale.com with the error message `Error: dst="100.64.0.1:0": port range "0": first port must be >0, or use '*' for wildcard` ```json { "acls": [ { "action": "accept", "src": [ "*" ], "dst": [ "100.64.0.1:0" ] } ] } ``` Both are breaking changes as Headscale would refuse to start. The second one is a bit more nuanced as such a rule was required in Headscale < 0.26 to make subnet routers visible to peers. However, the documentation for 0.26 does no longer contain this rule. ### Contribution - [ ] I can write the design doc for this feature - [ ] I can contribute this feature ### How can it be implemented? _No response_
adam added the enhancementpolicy 📝 labels 2025-12-29 02:27:41 +01:00
adam closed this issue 2025-12-29 02:27:41 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/headscale#1025