Skip to content

parseTailscaleOwner returns null for real Tailscale UserIDs #526

Closed

Description

@peyloride

AI-generated report. I ran the commands below and checked the output before posting.

parseTailscaleOwner returns null for real Tailscale UserIDs, so tailscaleIdentity() never reports the owner and a request through tailscale serve falls back to auth.via = "open" instead of "tailscale".

parseTailscaleOwner looks up parsed.User[String(parsed.Self.UserID)]. Tailscale UserIDs are larger than Number.MAX_SAFE_INTEGER, so JSON.parse rounds the number before the lookup and the key never matches.

From my machine (herdr web ui 0.3.52, Tailscale 1.102.4, Arch Linux, herdr plugin install):

$ tailscale status --json | jq '.Self.UserID'
15633668397603135
$ bun -e 'console.log(JSON.parse("{\"a\":15633668397603135}").a)'
15633668397603136

The User map key stays the exact string "15633668397603135", so User["15633668397603136"] is undefined and the owner is null.

Effect: until a device is paired, any device on the tailnet can drive the UI. After one device is paired, the owner's own other devices still have to pair. It happens every time.

The test at server/devices.test.ts:103 uses UserID: 99, which is safe, so it passes.

Match the key by number instead:

const key = Object.keys(parsed.User ?? {}).find((k) => Number(k) === Number(id));
return (key ? parsed.User?.[key]?.LoginName : null) || null;

Both Number("15633668397603135") and Number(id) round to the same double, so the match holds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions