feat(auth): an agent or operator token may carry an expiry
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 52/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- authentication, backend-api-design, cli, documentation
Rechercherichtung
Start with src/auth/token-store.test.ts and src/auth/auth.test.ts, then trace token.create through the dispatcher, token store, and authenticateRequest; the issue names these entry points and the behaviors to cover. Check the CLI command tests for --expires-in, and update the three named website pages. Done means the specified expiry cases and session or stream termination are covered, typecheck passes, and the protocol range is bumped.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Part of #1895.
Scope
An operator can make an agent or operator token that stops working at a set time: simlock token create --expires-in 7d. token list shows the expiry, an expired token is refused with its own message, and a remote session or screen stream opened with it ends at the expiry. Tokens made without the flag work as today.
If this goes wrong, a user would notice a token refused before its time, or one that keeps working after it.
Technical spec
Commit 4b39322d9.
Rows
Behaviours: B1, B2, B3
Stored state: S1
Interfaces: I1, I2, I3
Existing code: X1, X2, X3 (the expiresAt part), X4, X5, X6, X27, X30
Facts
| # | Fact | Source |
|---|---|---|
| F1 | A bare number is milliseconds, and text the parser refuses is undefined |
src/contract/duration.ts:15-25 |
| F2 | token create prints the daemon's answer as JSON through writeResult |
src/cli/commands/token.ts:55-57 |
| F3 | An unknown slk_ token is 401 "Unknown bearer token" |
src/auth/index.ts:101 |
Modules touched
src/auth (token store, token strategy, hello), src/contract (token.create, tokenRecordSchema, protocol range), src/cli/commands/token.ts, the token.create handlers (src/daemon/dispatcher-admin.ts, src/gateway/dispatcher.ts), src/simlock-client / src/admin, website docs. Searches: tokenRecordSchema, token.create, createToken, expiresAt.
Rules in play
src/contract/AGENTS.mdProtocol version: the shape change bumpsPROTOCOL_VERSION_RANGEby one.src/auth/AGENTS.md: every verify reads thetokenstable, so the expiry is read at each verify.- ADR 0093 §1, §2; ADR 0081 §2 and ADR 0033 §6: the existing expiry paths end sessions and streams.
- documentation rule 9:
website/src/content/docs/docs/reference/cli.mdx,concepts/tokens-and-roles.mdx,reference/errors.mdx.
Tests
Seam: token.create through the dispatcher and authenticateRequest, modelled on src/auth/token-store.test.ts and src/auth/auth.test.ts; the CLI flag on src/cli command tests.
- B1: an operator creates a token with
--expires-in, on a worker and through a gateway: none;7d;30s,0,59999;3651d;-1h,7days;--role worker --expires-in 1d;token listshowsexpiresAt. - B2: a caller with an expiring token: before expiry over HTTP (identity carries
expiresAt); at expiry over HTTP (401 I3); expired operator token at sockethello. - B3: a
/v1/sessionconnection, a screen stream and the event stream opened with an expiring token end atexpiresAt; with an expiry 30 days off, a session and a stream stay open past 2^31-1 ms and end atexpiresAt.
Done when
pnpm exec vitest run --project unit src/auth/token-store.test.ts src/auth/auth.test.ts src/auth/hello.test.tsand the new and changed test files pass.pnpm typecheckpasses; the protocol bump check passes on push.- The three website pages named under Rules in play describe
--expires-in, the expired-token message andexpiresAtintoken list.
Out of scope
Handover credentials (#1905). A default lifetime, worker join token expiry, changing an expiry later.
Depends on
- #1901 (it also changes contract shapes and the protocol range; it is ready first)
Written by an agent.
- Vorherrschende Sprache
- TypeScript
- Sterne
- 730
- Forks
- 44
- Ø Merge
- 16 Std. 13 Min.
- Gemergte PRs (30 T.)
- 387
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus callstackincubator/simlock
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
callstackincubator/simlock#1986 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
callstackincubator/simlock#1979 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
process-runner.test.ts fails four tests when a child starts 1 to 3 s lateEvtl. vergeben @V3RON hat das heute übernommen. Offenbug:new
callstackincubator/simlock#1985 · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug:new
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 74/100
callstackincubator/simlock#1984 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
iOS runCommand passes timeoutMs to spawn, which ignores it, and its comment relies on that backstopOffenbug:new
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 57/100
callstackincubator/simlock#1980 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in callstackincubator/simlock
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
audacity/audacity.github.io#118 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
crxjs/chrome-extension-tools#1261 ·
-
Resources: Update work of fuzhouEvtl. vergeben @rmt-svc hat das heute übernommen. Offenresources
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 64/100
railmapgen/rmp-gallery#4245 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
mike-north/AgentMonitors#717 ·
Maintainer antworten meist innerhalb von 1 Tag