headscale/hscontrol/state
Kristoffer Dalby 6fcff9e352 mapper, state: deliver nodeAttrs through MapResponse and harden nextdns DoH rewrite
WithSelfNode and buildTailPeers merge each node's policy CapMap
into the tailcfg.Node.CapMap they emit. State.NodeCapMap and
State.NodeCapMaps wrap the policy manager: NodeCapMap returns a
defensive clone per call; NodeCapMaps snapshots the full per-node
map once for batched callers, amortising pm.mu acquisition across
a peer build.

generateDNSConfig grew a per-node CapMap argument so it can apply
nodeAttr-driven DNS overlays. The nextdns DoH rewrite hardens against
policy-controlled inputs:

  - nextDNSDoHHost anchors the prefix match instead of substring,
    so a hostile resolver URL cannot smuggle a nextdns hostname in
    a path or query.
  - nextDNSProfileFromCapMap accepts only profile names matching
    [A-Za-z0-9._-]{1,64} and picks the lexicographically first when
    multiple are granted -- deterministic, no shell metacharacters
    or URL fragments through.
  - addNextDNSMetadata composes the rewritten URL via url.Parse +
    url.Values rather than fmt.Sprintf, so existing query strings
    on the resolver URL survive and metadata cannot inject a new
    component.

WithTaildropEnabled in servertest controls cfg.Taildrop.Enabled per
test so cap/file-sharing emission can be toggled in tests that need
to verify the off path.
2026-05-13 14:22:30 +02:00
..
auth_cache_test.go state: replace zcache with bounded LRU for auth cache 2026-04-10 14:09:57 +01:00
debug.go state: switch consumers to NodeStore primary routes 2026-04-29 18:08:39 +01:00
debug_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
endpoint_test.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00
ephemeral_test.go all: upgrade to Go 1.26rc2 and modernize codebase 2026-02-08 12:35:23 +01:00
ha_health.go state: per-goroutine deadline in HA probe cycle 2026-04-30 12:52:05 +01:00
maprequest.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
maprequest_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
node_store.go state: preserve previous primary when all HA advertisers unhealthy 2026-04-29 18:08:39 +01:00
node_store_hostname_test.go state: auto-bump GivenName on collision and add SetGivenName 2026-04-18 15:12:21 +01:00
node_store_test.go state: compute primary routes inside NodeStore snapshot 2026-04-29 18:08:39 +01:00
ping.go state: drain pending pings on Close 2026-04-17 16:31:49 +01:00
ping_test.go state: drain pending pings on Close 2026-04-17 16:31:49 +01:00
primaries_property_test.go state: preserve previous primary when all HA advertisers unhealthy 2026-04-29 18:08:39 +01:00
primaries_test.go state: preserve previous primary when all HA advertisers unhealthy 2026-04-29 18:08:39 +01:00
ssh_check_test.go state, policy, noise: implement SSH check period auto-approval 2026-02-25 21:28:05 +01:00
state.go mapper, state: deliver nodeAttrs through MapResponse and harden nextdns DoH rewrite 2026-05-13 14:22:30 +02:00
tags.go hscontrol: enforce that tagged nodes never have user_id 2026-02-20 21:51:00 +01:00
test_helpers.go hscontrol/state: make NodeStore batch configuration tunable (#2886) 2025-11-28 16:38:29 +01:00