From a3467e680fecb41625abddaffa27fa131ea6bc4e Mon Sep 17 00:00:00 2001 From: Kabir Sikand Date: Mon, 18 May 2026 16:46:21 +0000 Subject: [PATCH] cmd/tailscale/cli: synthesize tag:bp// for join's authkey exchange HookResolveAuthKey requires a non-empty tag set on the OAuth-client- secret to auth-key exchange (see feature/oauthkey/oauthkey.go), but "tailscale join" intentionally omits --advertise-tags: the blueprint owns the node's tag set. The join command therefore hit the hook's "oauth authkeys require --advertise-tags" rejection before the auth key was ever requested from the control plane. Fill the tag in at the join call site from the resolved blueprint id: the auto-generated tag for blueprint is "tag:bp//" (see tailcfg.BlueprintTagNamespacePrefix), which is exactly the AuthTag the paired OAuth client server-side is scoped to. The hook accepts the request and the existing scope-mismatch validator on the corp side catches any later drift. Updates #cleanup Signed-off-by: Kabir Sikand --- cmd/tailscale/cli/join.go | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cmd/tailscale/cli/join.go b/cmd/tailscale/cli/join.go index 0932cc18d..b17742c83 100644 --- a/cmd/tailscale/cli/join.go +++ b/cmd/tailscale/cli/join.go @@ -13,6 +13,7 @@ import ( "github.com/peterbourgon/ff/v3/ffcli" "tailscale.com/internal/client/tailscale" "tailscale.com/ipn" + "tailscale.com/tailcfg" "tailscale.com/util/clientmetric" ) @@ -159,9 +160,14 @@ func runJoin(ctx context.Context, args []string, ja *joinArgsT) (retErr error) { authKey := ja.authKey if f, ok := tailscale.HookResolveAuthKey.GetOk(); ok { // The OAuth-client-secret -> auth-key exchange. The exchange - // itself validates the secret against the blueprint's paired - // client server-side. - authKey, err = f(ctx, ja.authKey, prefs.AdvertiseTags) + // validates the secret against the blueprint's paired client + // server-side, which is itself scoped to "tag:bp//"; we + // synthesize that tag from the blueprint id here so the hook, + // which requires a non-empty tag set, accepts the request + // without --advertise-tags (a flag join intentionally does + // not expose, because the blueprint owns the node's tags). + bpTag := "tag:" + tailcfg.BlueprintTagNamespacePrefix + id + authKey, err = f(ctx, ja.authKey, []string{bpTag}) if err != nil { return fmt.Errorf("exchanging OAuth client secret for auth key: %w", err) }