Skip to content

api-auth: drop the token lifetime cap; give the gateway a ten-year token - #1500

Merged
kvinwang merged 4 commits into
nextfrom
feat/permanent-gateway-agent-token
Oct 30, 2026
Merged

kvinwang merged 4 commits into
nextfrom
feat/permanent-gateway-agent-token

Conversation

@kvinwang

@kvinwang kvinwang commented Oct 29, 2026 •

Copy link
Copy Markdown
Collaborator

The gateway's token only grants guest:health, and expiry is checked against a guest clock the host controls. A short lifetime therefore buys little, but it lets a registration outage longer than the token's remaining life pull every instance of an app out of rotation at once.

  • The verifier no longer caps exp - iat, for any issuer. exp is still required and enforced; how long a token lives is the issuer's call.
  • dstack-util signs the gateway's token with iat rounded down to the year and exp ten years later, so it changes once a year and never lapses while registration is down.

Follow-up to #1499.

@kvinwang kvinwang changed the title dstack-util: give the gateway a token that never expires dstack-util: give the gateway a ten-year token Oct 29, 2026
@kvinwang
kvinwang force-pushed the feat/permanent-gateway-agent-token branch from fccb376 to ecd62c1 Compare October 29, 2026 04:53
The gateway's Health token only grants `guest:health`, and its expiry is
judged by a guest clock the host controls, so a short lifetime bounds
little. What it does add is a failure mode: if registration stalls for
longer than the token's remaining life, every instance of the app fails its
health poll and drops out of rotation at once.

Stop capping `exp - iat` in the verifier: an issuer that holds a trusted key
can already mint any scope, so how long its tokens live is its own call.
dstack-util now signs the gateway's token with `iat` rounded down to the
year and `exp` ten years later.

Signed-off-by: Kevin Wang <wy721@qq.com>
@kvinwang kvinwang changed the title dstack-util: give the gateway a ten-year token api-auth: drop the token lifetime cap; give the gateway a ten-year token Oct 29, 2026
@kvinwang
kvinwang force-pushed the feat/permanent-gateway-agent-token branch from ecd62c1 to ef6671c Compare October 29, 2026 04:54
@kvinwang
kvinwang enabled auto-merge October 29, 2026 15:47
@kvinwang
kvinwang merged commit b63a7c8 into next Oct 30, 2026
12 checks passed
@kvinwang
kvinwang deleted the feat/permanent-gateway-agent-token branch October 30, 2026 15:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant