You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: cap access key token lifetime at 1 year, remove never-expire (#1141)
## Summary
Re-fixes#1084. Kubernetes `TokenRequest` does not support non-expiring
tokens — the API server silently caps `ExpirationSeconds`, so tokens
expire regardless. The original PR offered a "No expiration" option that
was misleading.
- **Backend**: Require `expirationSeconds` (reject nil/≤0), reject
values exceeding 1 year (31536000s)
- **Frontend**: Remove "No expiration" option, extract shared
`EXPIRATION_OPTIONS` to `lib/constants.ts`, use shadcn `Select`
component
- **Tests**: 6 backend Ginkgo tests for expiration validation
## Changes
- `components/backend/handlers/permissions.go` — validate and enforce
max 1 year
- `components/backend/handlers/permissions_test.go` — expiration
validation tests
- `components/frontend/src/app/projects/[name]/keys/page.tsx` — use
shared constants, shadcn Select
- `components/frontend/src/lib/constants.ts` — shared
`EXPIRATION_OPTIONS` and `DEFAULT_EXPIRATION`
- `.gitignore` — add `.worktrees/` and `.claude/worktrees/`
## Test plan
- [x] Frontend unit tests pass (613 passed)
- [x] Backend unit tests pass (all packages)
- [x] Backend expiration validation: rejects missing, zero, negative,
>1yr; accepts 1yr and 90d
- [x] Local kind cluster deployed and manually verified
- [x] `tsc --noEmit` clean, all pre-commit hooks pass
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Project keys now require an expiration time.
* Predefined token lifetime options added with a 90-day default.
* **Improvements**
* Maximum token lifetime capped at 1 year.
* Token lifetime selector is disabled while creating a key.
* “No expiration” option and related helper text removed.
* **Tests**
* Added validation tests covering expiration presence, bounds, and
accepted values.
* **Chores**
* Minor config wording and workflow tweaks; gitignore updated.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: ambient-code[bot] <ambient-code[bot]@users.noreply.github.com>
"The session is stopped when no activity (user messages) is detected for this duration. The countdown starts from the last activity time, or from session start if there is no interaction. When set to 0, auto-stop is disabled entirely.";
3
+
4
+
// Kubernetes TokenRequest does not support non-expiring tokens — the API server
5
+
// silently caps ExpirationSeconds. Max is 1 year; "No expiration" is not offered
6
+
// because K8s will expire the token regardless.
7
+
exportconstEXPIRATION_OPTIONS=[
8
+
{value: '86400',label: '1 day'},
9
+
{value: '604800',label: '7 days'},
10
+
{value: '2592000',label: '30 days'},
11
+
{value: '7776000',label: '90 days'},
12
+
{value: '31536000',label: '1 year'},
13
+
]asconst;
14
+
15
+
exportconstDEFAULT_EXPIRATION='7776000';// 90 days
0 commit comments