headscale/hscontrol
Kristoffer Dalby 22ee2bfc9c
tags: process tags on registration, simplify policy (#2931)
This PR investigates, adds tests and aims to correctly implement Tailscale's model for how Tags should be accepted, assigned and used to identify nodes in the Tailscale access and ownership model.

When evaluating in Headscale's policy, Tags are now only checked against a nodes "tags" list, which defines the source of truth for all tags for a given node. This simplifies the code for dealing with tags greatly, and should help us have less access bugs related to nodes belonging to tags or users.

A node can either be owned by a user, or a tag.

Next, to ensure the tags list on the node is correctly implemented, we first add tests for every registration scenario and combination of user, pre auth key and pre auth key with tags with the same registration expectation as observed by trying them all with the Tailscale control server. This should ensure that we implement the correct behaviour and that it does not change or break over time.

Lastly, the missing parts of the auth has been added, or changed in the cases where it was wrong. This has in large parts allowed us to delete and simplify a lot of code.
Now, tags can only be changed when a node authenticates or if set via the CLI/API. Tags can only be fully overwritten/replaced and any use of either auth or CLI will replace the current set if different.

A user owned device can be converted to a tagged device, but it cannot be changed back. A tagged device can never remove the last tag either, it has to have a minimum of one.
2025-12-08 18:51:07 +01:00
..
assets hscontrol: consolidate assets into single package 2025-11-12 08:28:12 -06:00
capver generate: add new patches (#2921) 2025-11-28 17:00:52 +01:00
db make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
derp Fix flaky TestShuffleDERPMapDeterministic by ensuring deterministic map iteration (#2848) 2025-11-02 10:05:23 +01:00
dns integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
mapper tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
policy tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
routes debug: add json and improve 2025-09-09 09:40:00 +02:00
state tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
templates hscontrol: consolidate assets into single package 2025-11-12 08:28:12 -06:00
types make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
util modernize: run gopls modernize to bring up to 1.25 (#2920) 2025-12-01 19:40:25 +01:00
app.go hscontrol: log acme/autocert errors (#2933) 2025-12-08 16:39:30 +00:00
auth.go make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
auth_tags_test.go make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
auth_test.go tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
debug.go lint and leftover 2025-09-09 09:40:00 +02:00
grpcv1.go tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
grpcv1_test.go tags: process tags on registration, simplify policy (#2931) 2025-12-08 18:51:07 +01:00
handlers.go hscontrol: consolidate assets into single package 2025-11-12 08:28:12 -06:00
metrics.go integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
noise.go lint and leftover 2025-09-09 09:40:00 +02:00
oidc.go hscontrol/oidc: fix ACL policy not applied to new OIDC nodes (#2890) 2025-12-02 12:01:02 +01:00
oidc_template_test.go make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
platform_config.go Return better web errors to the user (#2398) 2025-02-01 15:25:18 +01:00
poll.go make tags first class node owner (#2885) 2025-12-02 12:01:25 +01:00
suite_test.go Redo OIDC configuration (#2020) 2024-10-02 14:50:17 +02:00
tailsql.go integration: replace time.Sleep with assert.EventuallyWithT (#2680) 2025-07-10 23:38:55 +02:00
templates_consistency_test.go hscontrol: add template HTML consistency test 2025-11-12 08:28:12 -06:00