Repository navigation
Add configurable API key expiration - #29
Conversation
There was a problem hiding this comment.
Independent reviews by GPT-6.1-Sol (backend; frontend + automation) and Claude Opus 5.5 of commit 8acc2f6d9dde8e350d52beb34416c60c27786079, verified in a second Sol pass.
The core expiry enforcement looks correct. The API-key header lookup (find_api_key_user) and /apikeys/validate both call matches_active_key. Sessions created directly from API-key headers are capped at the key's deadline and excluded from refresh (the one exception is the first thread below). The ttlSeconds bounds are enforced at deserialization. expiresAt is serialized into persisted users and into cluster-sync payloads. No issues found in the frontend duration validation, the warning for backends that ignore the TTL, or the timer (capped at 2³¹−1 ms).
The reviewers reported passing runs of cargo check --locked --offline, 20 focused Rust tests, 147 frontend unit tests, 5 policy tests and the 11 expiration browser tests (these mock the server). No live cluster test was run.
Intra-cluster requests created a 20-second session for any stored user, so work forwarded on behalf of an expired API key was still authorized. Reject expired API-key users there, and cap every session created through `Users.new_session` at the key's deadline. Exercise the real `Auth` and `IntraClusterRequest` middleware in tests: both API key headers before and after expiry, a key expiring after its session is registered, and forwarded Basic credentials alongside an expired key. Each removed guard makes a test fail. Derive the custom duration input's native min/max from the selected unit so the range matches validation (30 minutes to 90 days). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Description
API keys currently remain valid until deleted. Add an optional lifetime of 30 minutes through 90 days, or no expiration. For example, a collector key created with
ttlSeconds: 1800stops authenticating 30 minutes after creation through bothX-API-KEYand Bearer headers.expiresAt; omitted/null TTL preserves existing nonexpiring API behavior and legacy records.Rollout: upgrade every serving and metadata-writing node before creating expiring keys. Older versions ignore expiration and can strip
expiresAtwhen rewriting metadata; rollback with finite keys in service is unsafe. Requests authorized before expiry may finish afterwards.Review automation
Add the swamp
post-pr-reviewworkflow andcomment-clanker-postmodel/script. Actionable findings use resolvable line or file review threads; parsed ordinary PR conversation comments are rejected by default. Review summaries and existing-thread replies are allowed, withallowConversationComments=trueavailable for intentional general discussion. The wrapper validates the report before posting and revokes its repository-scoped App token afterwards.Running the automation requires an initialized swamp repository, Node.js, gh-comment with typed review support, and the
comment-clankervault containing the App client ID and private key. Credentials and unrelated local automation are excluded from this PR. No review comments were posted during validation.Validation: five policy tests, four installed-parser integration cases, Node syntax checks, and swamp model/workflow validation passed.
Validation
Details:
frontend/docs/validation-review.mdandfrontend/docs/api-contracts.md. Implementation is also recorded in the project's shared Mayfly wiki under Team → API key expiration. Nothing deployed.This PR has:
Need help on this PR? Tag
@codesmith-botwith what you need.