Commit Graph
11 Commits
Author SHA1 Message Date
Kristoffer Dalby 81925d9d48 api/v2: require a token to hold a device's current tags to retag it
SetNodeTags replaces the tag set, so the tags it removes need the grant
too. A tag outside the grant answers 400, as on Tailscale SaaS.
2026-10-28 14:42:31 +00:00
Kristoffer Dalby e5d14fd2d2 api/v2: list token-made auth keys to a token without all=true
Keys an OAuth token makes are marked so. No listing holds an invalid
key.
2026-10-28 14:42:29 +00:00
Kristoffer Dalby 3768aaf323 api/v2: show userId on admin-made tagged keys
An admin key's user is recorded as the creator of the tagged keys it
makes. A tagged key re-registers a machine by its tags, whoever made it.
2026-10-28 14:42:29 +00:00
Kristoffer Dalby 9e0c609b12 api/v2: refuse an unknown keyType 2026-10-28 14:42:29 +00:00
Kristoffer Dalby 6360b4958c api/v2: ignore unknown properties in request bodies
Tailscale's API ignores them.
2026-10-28 14:42:29 +00:00
Kristoffer Dalby 79636f3893 api/v2: check the createKey scope before reading the body
createKey has no static scope, so any token got its body parsed
and validated before the handler's scope check.
2026-10-28 14:42:28 +00:00
Kristoffer Dalby 2e837a9072 api/v2: bound every request body
huma gives RawBody no limit, and validates a whole body before
the handler runs. The token form is parsed before the secret check.
2026-10-28 14:42:28 +00:00
Kristoffer Dalby 141d7813c1 api/v2: keep a tagged all-scope client's tokens inside its tags
Only an untagged all-scope client may mint tokens for any tag, so a
tagged token may not create one.
2026-10-28 14:42:28 +00:00
Kristoffer Dalby 84715e976c api/v2: add OAuth client-credentials auth and scope enforcement 2026-06-26 09:18:06 +02:00
Kristoffer Dalby 6b413fe237 api/v2: soft-revoke auth keys with a configurable collector
Tailscale's keys API has no separate expire verb: DELETE is the revoke.
Map it to a soft revoke so the key stays retrievable as invalid afterwards
instead of vanishing, matching the SDK and Terraform's expectations.

Add a revoked timestamp to pre-auth keys (migration plus schema), mark a
key invalid once revoked, and have the keys DELETE handler stamp it rather
than destroy the row. A background collector reaps revoked keys after a
configurable retention window (preauth_keys.revoked_retention, default
168h), so the table does not grow without bound.
2026-06-21 04:17:03 +02:00
Kristoffer Dalby fe08d43978 api/v2: add Tailscale-compatible keys API
Add the v2 foundation — Basic/Bearer auth, scope scaffolding, the
tailnet check, and the Tailscale error shape — plus the auth-key
endpoints mapped onto Headscale pre-auth keys.
2026-06-21 04:17:03 +02:00