Skip to content

[Bug] Grant policies are bidirectional instead of unidirectional #3421

Description

@Defy3738

Is this a support request?

  • This is not a support request

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Hi, I think there may be a bug in how grant policies are parsed. Thank you for your time!

The configuration below correctly allows user admin to see all nodes, but also incorrectly (based on my understanding) allows all nodes to see admin nodes even though it has not been granted.

Expected Behavior

The admin nodes see all nodes, but each user only sees own nodes.

Steps To Reproduce

  1. Create users named admin, user1, user2.
  2. Add one or two nodes for each user.
  3. notice tailscale status on user1 and user2 nodes lists admin nodes and the corresponding nodes to that user, but the admin nodes list all nodes for all users.
  4. optionally start an http server on user1-node1 and admin-node1 python3 -m http.server 8080.
  5. note that this command succeeds when ran from an admin node curl user1-node1:8080 as expected.
  6. note that this command succeeds when ran from a user node curl admin-node1:8080 unexpectedly.

Environment

- OS: linux (podman containers for headscale and tailscale nodes)
- Headscale version: v0.29.3
- Tailscale version: 1.98.10

Runtime environment

  • Headscale is behind a (reverse) proxy
  • Headscale runs in a container

Debug information

policy file configuration:

{
  "randomizeClientPort": true,
  "grants": [
    {
      "src": ["autogroup:member"],
      "dst": ["autogroup:self"],
      "ip": ["*"],
    },
    {
      "src": ["admin@"],
      "dst": ["autogroup:member"],
      "ip": ["*"],
    },
  ],
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions