4.4 KiB
4.4 KiB
spec, created, status
| spec | created | status |
|---|---|---|
| docs/specs/platform/requirements/git-credential-lease-reissue.md | 2026-08-20 | completed |
Implementation Plan: Git Credential Lease Reissue
Overview
Add an encrypted, execution-scoped reissue capability alongside each managed Git credential lease. The generic broker validates that capability and issues a fresh lease from live authorization and provider binding; the existing helper then performs one replacement redemption. A capability reissue replaces the previous lease for that capability, so short-lived helper processes cannot consume the workspace lease limit. This retains in-memory leases while making a running execution recover after a credential-generation change or backend restart.
Backend
Capability and broker contracts
- Add sealing, validation, expiry, and exact-scope comparison to
apps/backend/internal/gitcredentials/without retaining credentials. - Extend
Brokerwith capability issue/reissue operations that call its existing authorization path, preserving live authorizer and resolver checks. - Let providers refresh rotating binding generations during reissue without changing the sealed task, session, or repository identity.
- Wire a stable signer from backend configuration in
apps/backend/internal/backendapp/and leave capability issuance disabled when no stable key exists.
Executor environment injection
- Extend
apps/backend/internal/orchestrator/executor/executor_credentials.goscope records and managed-environment cleanup to carry a capability matching each issued scope. - Extend
apps/backend/internal/githubauth/environment.goandapps/backend/internal/agent/runtime/lifecycle/remote_github_env.goso Docker, SSH, and local managed helper environments receive only the required opaque capability values.
HTTP and helper recovery
- Add provider-neutral
/api/v1/git/credentials/*broker routes and precise reissuable error codes. Keep the GitHub paths as compatibility aliases and preserve public-route self-authentication inapps/backend/internal/auth/httpmw/middleware.go. - Update
apps/backend/cmd/agentctl/github_credential.goto recognize only eligible lease errors, request one replacement lease with the matching capability, and retry the original redemption once. The same command powers the Git helper andghshim.
Tests
- Capability contract:
internal/gitcredentials/*_test.gocovers valid reissue, exact-scope mismatch, forged token, and expiry. - Broker HTTP:
internal/github/*_test.goverifies self-authenticated reissue, backend-restart-equivalent new broker recovery, and no lease for forged/expired capabilities. - Executor wiring:
internal/orchestrator/executor/*_test.goasserts every single and multi-repository helper scope receives only its matching opaque capability. - Helper integration:
cmd/agentctl/github_credential_test.goasserts credential-generation revoked and missing-lease responses reissue once, retry successfully in single- and multi-scope mode, and reject non-reissuable/fake/expired paths. Theghshim uses the same one-shot flow. - Lease lifecycle: repeated reissue keeps one active lease for a capability. Contribution destination reissue refreshes the current binding generation after an authorized connection rotation.
Verification Results
go build ./...and affected-packagego vetpassed locally.- Focused regressions cover credential-generation rotation, an empty lease map after restart, forged/expired/scope-mismatched capabilities, helper retry limits, HTTP middleware admission, executor injection, and remote executor environment forwarding.
gofmt -l,git diff --check, and public-doc validation passed locally.golangci-lint --new-from-revwas not run becausegolangci-lintis not installed in this worktree environment.
Implementation Waves
Risks
- The reissue route is publicly reachable, so its only authority is the capability plus repeated live scope authorization. It must never accept an old lease as reissue proof.
- A non-stable signer cannot safely support cross-restart recovery. Its disabled path must remain explicit and fail closed.