feat: credential TTL — auto-expire persistent credentials after configurable...
Apra Fleet is an open-source MCP server
Brought to you by:
apralabs
Originally created by: kumaakh
Persistent credentials live forever until explicitly deleted. A forgotten or leaked credential has unlimited lifetime. Adding TTL support reduces blast radius.
```
credential_store_set name=session_token ttl_seconds=3600 # expires in 1 hour
credential_store_set name=long_lived_key ttl_seconds=604800 # expires in 7 days
credential_store_set name=permanent_key # no TTL (current default)
```
now > expiry: reject with error "Credential 'session_token' has expired. Re-set with credential_store_set."credential_store_list shows expiry timestamp and remaining time for each credentialcredential_store_set on an existing name resets the clock🤖 Generated with Claude Code
Originally posted by: kumaakh
Technical direction: Add TTL as a first-class field in the persistent credential store.
Approach:
ttl_seconds(optional) tocredential_store_setschema insrc/tools/credential-store-set.ts.src/services/credential-store.ts, extend the stored credential object to includeexpiresAt?: string(ISO timestamp). Store it alongside the value at set time.if (expiresAt && Date.now() > new Date(expiresAt).getTime()) → throw Error('Credential X has expired...').credential_store_list(src/tools/credential-store-list.ts), showexpiresAtand computed remaining time for each credential.credential_store_list, sweep and purge expired persistent credentials from disk (can reusecleanupStaleTaskspattern fromsrc/services/task-cleanup.ts).credential_store_seton an existing name resets the clock (replacesexpiresAt).Key files:
src/tools/credential-store-set.ts— addttl_secondsto schemasrc/services/credential-store.ts— persistexpiresAtand enforce at read timesrc/tools/credential-store-list.ts— display remaining TTLsrc/index.ts— startup sweep for expired credentialsOriginally posted by: kumaakh
Addressed in PR [#183] (sprint/session-lifecycle-oob-fix → main).
Changes shipped: Credential TTL — auto-expire persistent credentials with clear error on expiry.
PR is open for testing — will be merged once testing is complete.
Related
Tickets:
#183Ticket changed by: kumaakh