Little/max api token duration - #1946
Merged
Eugeny merged 7 commits intoMay 26, 2026
Merged
Conversation
Enforces a maximum lifetime on API tokens to prevent indefinite access without re-authentication. Default: 7 days (604800s). Set to null to disable enforcement. - New migration (m00046) adds column to parameters table - Server rejects token creation if expiry exceeds the configured max - Frontend pre-populates expiry with the max (or 7 days) and shows the limit in the creation modal - Admin API exposes the parameter for configuration
The token page now reads query params from the hash route: - ?create=true — auto-opens the creation modal - ?label=X — pre-fills the label field - ?expiry=7d — pre-sets expiry (supports Nd, Nh, Nm format) This enables CLI tools to open a pre-filled URL so users only need to click Create and copy the resulting secret.
These are gitignored and regenerated at build time.
- Merge time::{Duration, OffsetDateTime} import (rustfmt compliance)
- Report max duration in seconds in error message (avoid truncation)
- Add try/catch + error display for token creation failures
- Change migration default to NULL (no limit) to avoid breaking
existing installs on upgrade
Eugeny
reviewed
May 19, 2026
tenfourty
pushed a commit
to tenfourty/warpgate
that referenced
this pull request
Jul 4, 2026
We have two use-case that this PR solves 1. We want to ensure no token can last longer than we set our max to be 2. We use a local development tool that we want to make it easy for them to create a token so that the tool can grant them access easier to resources without them having to be involved (Hence why we want to be able to restrict the valid timeframe of said tokens) --------- Co-authored-by: Eugene <inbox@null.page>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We have two use-case that this PR solves