feat(auth): a lease owner hands one lease to an agent with a scoped credential
Maintainer antworten meist innerhalb von 1 Tag
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Klar beschrieben
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- typescript
- Bereich
- api, authentication, backend-api-design, cli
Rechercherichtung
Start with src/cli/tree.ts:68, the listed dispatch and session entry points, and the three test seams: src/daemon/dispatcher-leases.test.ts, src/gateway/dispatcher.test.ts, and src/http/app.test.ts. Follow the contract and auth instructions and ADRs named in the issue, then cover the B4–B9 cases across CLI, HTTP, worker, and gateway. Done means the specified tests and typecheck pass, the protocol bump check passes, and the named website pages document handover behavior and refusals.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Part of #1895.
Scope
A lease's owner runs simlock lease handover <lease-id> (or POST /v1/leases/{id}/handovers) and gets an slk_ secret for that one lease. With it an agent can read, renew, release and rotate the lease and use its stream, input, tunnels and files, over HTTP and the remote CLI, on a worker and through a gateway. It is refused exec, every other lease, new leases, another handover and every admin route. It stops working when the lease ends, and when the owner's token is revoked or expires. agent-device on a handed-over lease is #1906; until it lands, /v1/agent-device/* refuses a handover credential.
If this goes wrong, a user would notice an agent reaching one of the owner's other leases, or a credential that still works after its lease ended.
Technical spec
Commit 4b39322d9.
Rows
Behaviours: B4, B5, B6, B7, B8, B9
Stored state: S2 (and reads S1)
Interfaces: I4, I5, I6, I7 (and uses I1, I3)
Existing code: X3 (the handover strategy), X29, X4, X5, X7, X8, X9, X10, X11, X12, X13, X14, X15, X16, X17, X26, X27
Facts
| # | Fact | Source |
|---|---|---|
| F1 | simlock lease has one child command, renew; a second child goes beside it |
src/cli/tree.ts:68 |
| F2 | A strategy's place in strategies/index.ts is its priority, and the conformance test runs every registered strategy |
src/auth/AGENTS.md "Adding a strategy"; src/auth/strategies/conformance.test.ts |
| F3 | ownsLease lets an unknown lease id pass, so the handler answers UNKNOWN_LEASE |
src/contract/roles.ts:55-63 |
| F4 | A gateway relays every header but framing, credential, proxy-auth and cookie headers | src/contract/relay.ts relayHeaderPairs |
Modules touched
flowchart LR
auth[src/auth: handover strategy, S2, LiveLeases bind] --> daemon[src/daemon: dispatch scope gate, session scope, revoke, stateOwners]
contract[src/contract: lease.handover, scope on session, via enum] --> daemon
contract --> gateway[src/gateway: handler, lease.list cut, LiveLeases from index]
daemon --> http[src/http: path gate, handovers route, session scope]
contract --> cli[src/cli + simlock-client: lease handover]
src/daemon/server-requests.ts PASSTHROUGH_OPERATIONS lists lease.handover (X29). Searches: PASSTHROUGH_OPERATIONS, runDispatch(, checkAccess, buildHttpSession, acceptSession, SessionIdentity, closeSessionsForToken, stateOwners, createAuth(, #leaseList, leasesFor, requireAuth.
Rules in play
src/contract/AGENTS.md"Adding an operation" steps 1-8, and the protocol bump.src/auth/AGENTS.md"Adding a strategy";createAuthtakes the daemon'sSqliteDatabase, never the state module.src/daemon/AGENTS.mdDispatch: lists filter in the handler; Connections: a session's identity comes from the upgrade.src/http/AGENTS.md: no role orauthorizecheck in http except the listed ones; the path gate is a new listed exception and goes in that list.- ADR 0098 §1, §2, §3, §5; ADR 0081 §2; ADR 0005 (a gateway's credentials are its own).
- documentation rule 9:
using-devices/http-api.mdx,reference/cli.mdx,reference/errors.mdx,concepts/tokens-and-roles.mdx,using-devices/ci.mdx; the OpenAPI document gets the route from its declaration.
Tests
Seam: the daemon dispatcher (worker and gateway) and the HTTP app with faked drivers, modelled on src/daemon/dispatcher-leases.test.ts, src/gateway/dispatcher.test.ts and src/http/app.test.ts.
- B4: making a handover: owner;
simlock lease handoverover the socket and with--url; operator on another's lease; another agent; unknown lease; a handover identity; two handovers of one lease; through a gateway. - B5: a handover identity's operations: L1 allowlist; L2; exec, request, cancel, handover, admin;
lease.liston a worker and a gateway;identity.get; the same over/v1/session. - B6: the HTTP path gate:
/v1/leases,/v1/leases/L1/*; L2's paths; identity, healthz, session;/v1/agent-device/*refused; every other path. - B7: lease end: live; released by owner; released by agent; TTL expiry; a later lease under the same chosen id; an open
/v1/sessionconnection, also when the same owner got a later lease under the same chosen id with no call in between (decided in delivery, pending the maintainer). - B8: owner token: live (with
expiresAt); expired; revoked; owner not a token. - B9: row deletes: worker start; worker verify of an ended lease; gateway verify inside and after
REBUILD_WINDOW_MS; live lease.
Done when
- The new and changed test files pass with
pnpm exec vitest run --project unit <files>. pnpm typecheckpasses; the protocol bump check passes on push.- The website pages named under Rules in play describe
lease handover, the route, the allowlist and the refusals.
Out of scope
agent-device on a handed-over lease (#1906). An MCP tool or console page for handovers. Listing or revoking one handover. The MCP server's own tools on a handed-over lease: they act only on a lease their session was granted (decided in delivery, pending the maintainer).
Depends on
- #1904
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