feat: add administrator-owned SSO impersonation #11
Loading…
Reference in a new issue
No description provided.
Delete branch "feat/admin-impersonation"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Security and lifecycle
Agreed limitations
Only new SSO logins are affected. Existing application sessions are neither switched nor ended automatically: sign out/in in each application before impersonation and again after ending it. Already issued signed ID tokens cannot be recalled; their expiry is capped. Applications can send their own login notices. Thermopylae does not notify the impersonated user or expose the impersonation in their own account/history.
Migration
Additive SQLite migration
0006: impersonation context/audit tables, nullable credential/session provenance and transactional lifecycle triggers. Existing sessions/tokens retain null provenance. Back up the database before a future deployment; reverting to an older binary requires restoring a compatible backup. This PR does not deploy anything.Verification
go test -count=1 ./...,go vet ./..., normal build andgit diff --checkpassed.sqlc; generated-file hashes unchanged.64e9640347b9b8b04a49758b3e9db085cbe4c5dc: run 24,testjob successful, includinggo vet ./...andgo test -race ./...(verified against the committed workflow and passing linux/amd64 package results in runner logs). The image-publish job is intentionally skipped for pull requests; nothing was deployed. Local Raspberry Pi race execution is unsupported due to ThreadSanitizer VMA47/48 incompatibility.Screenshots
Synthetic local fixtures; no real account or credential data.
02 start desktop
02 start phone
05 banner admin desktop
05 banner admin phone
08 target account phone
14 audit full desktop
14 audit full phone
15 inflight across start desktop
15 inflight across start phone
17 audit as admin target desktop
17 audit as admin target phone
@fara
Engineering review
e855460a9578c20bc649dfd49b8c9df6d02f96d7→64e9640347b9b8b04a49758b3e9db085cbe4c5dcFindings
No confirmed blocking correctness or security defect found.
[P3, non-blocking] Qualify the README's lifecycle guarantees
README.md:59-60.TestStopReturnsActorAndKillsOnlyItsCredentials. High confidence; this is documentation precision, not a demonstrated privilege escalation.Architecture and technical debt
The separation between the real session owner and the effective application subject is coherent. Context provenance on codes/tokens, fresh transactional authorization checks, credential rotation, and atomic audit/revocation triggers work together without introducing another service or competing application-access policy. Tests exercise real persistence, rollback, competing SQLite connections and loopback redirect chains, not only mocks.
The unpruned context/audit history is deliberate debt, not a merge blocker at the demonstrated scale. Because authorization also performs an expiry sweep, retention/indexing should be revisited when measured history size or write-lock latency warrants it; no repayment owner is established here. Migration 0006 is additive and preserves ordinary credential provenance as NULL; the older binary rejects the newer schema, so rollback requires a compatible database backup.
Verification and limitations
Independently executed in a clean detached worktree with Go 1.27.1, a credential-free test environment and cached dependencies/network package resolution disabled:
go test -count=1 -json ./...— exit 0; 59 top-level tests, 117 passing test/subtest events, three tested packages, no failures.go vet ./...— exit 0.go build -o ../thermopylae-review ./cmd/thermopylae— exit 0 (output outside source tree).git diff --check e855460a9578c20bc649dfd49b8c9df6d02f96d7...HEAD— exit 0.go test -overlay=../overlay.json -count=1 -v ./internal/server -run '^TestFaraReview'— exit 0; two review-only lifecycle probes passed; overlay files are outside the checkout and are not committed regression coverage.go test -race ./...— exit 1 before tests could execute, due to ThreadSanitizer's unsupported VMA47/48 mapping on this ARM64 host; not a detected data race. Independently retrieved CI run 24, its exact SHA, workflow and test-job log: the linux/amd64 test job passed vet/race gates; image publication was intentionally skipped for this PR.A subscription-backed Opus read-only source pass supplemented my independent inspection; consequential observations above were independently checked. The checkout remains clean. No source changes, commits, pushes, production access or deployment. No fresh visual/browser QA or real relying-party/production-TLS integration was performed. Existing application sessions and already-issued signed ID tokens remain subject to the documented revocation limitations. This verdict applies only to the reviewed snapshot and scope.