headscale/hscontrol/mapper
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
..
batcher.go mapper: fix phantom updateSentPeers on disconnected nodes 2026-04-10 13:18:56 +01:00
batcher_bench_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
batcher_concurrency_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
batcher_scale_bench_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
batcher_test.go hscontrol/types: silence zerolog by default in tests 2026-04-17 16:31:49 +01:00
batcher_unit_test.go mapper: fix phantom updateSentPeers on disconnected nodes 2026-04-10 13:18:56 +01:00
builder.go mapper, state: deliver nodeAttrs through MapResponse and harden nextdns DoH rewrite 2026-05-13 14:22:30 +02:00
builder_test.go all: fix golangci-lint issues (#3064) 2026-02-06 21:45:32 +01:00
mapper.go mapper, state: deliver nodeAttrs through MapResponse and harden nextdns DoH rewrite 2026-05-13 14:22:30 +02:00
mapper_test.go mapper, state: deliver nodeAttrs through MapResponse and harden nextdns DoH rewrite 2026-05-13 14:22:30 +02:00
node_conn.go mapper: fix phantom updateSentPeers on disconnected nodes 2026-04-10 13:18:56 +01:00
tail_test.go state: switch consumers to NodeStore primary routes 2026-04-29 18:08:39 +01:00