Auth strategy assessment: Couch /_session vs in-house JWT - #16
Closed
PeterBaker0 wants to merge 2 commits into
Closed
Auth strategy assessment: Couch /_session vs in-house JWT#16PeterBaker0 wants to merge 2 commits into
PeterBaker0 wants to merge 2 commits into
Conversation
Allow JWT_LOCAL_VERIFY alongside Couch /_session so Bearer clients skip the session RTT while Basic/Cookie keep Couch as source of truth. Cache local JWT principals under SESSION_CACHE_TTL_MS. Add pnpm test:perf:auth to compare TTL variants, hybrid JWT, and in-house JWT-only under PROFILE=true. Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com>
Fill docs/auth-strategy-assessment.md from PROFILE=true ACL harness runs across session TTL 0/1s/5s/30s, hybrid Bearer JWT, and local JWT-only. Mint admin JWT for Bearer-only proxy setup; assemble reports from on-disk variant dirs so partial re-runs merge cleanly. Co-authored-by: Peter Baker <PeterBaker0@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Critical assessment of Couch
GET /_sessionidentity resolution vs in-house JWT, measured with the ACL perf harness underPROFILE=true.Clarification
There is no ACL TTL — document ACL is changes-fed. The 5s knob is
SESSION_CACHE_TTL_MS(principal / session-response cache). Defaults already use 5s.Measured results (sticky Bearer JWT clients)
Upstream Couch remains ~55–75% of HTTP mean duration; auth is noise once the 5s principal cache is warm.
Verdict
/_session+ 5s cache for mixed Basic/Cookie/JWT — already removes almost all session tax vs TTL=0.JWT_LOCAL_VERIFY=truewith session still on) is the right upgrade for JWT-heavy apps; ops/s ≈ keep-as-is, but Bearer skips/_sessioneven at TTL=0.expas revocation (role changes in_userswon’t apply until re-mint).Full write-up:
docs/auth-strategy-assessment.md. Re-run:pnpm test:perf:auth.Code
JWT_LOCAL_VERIFYare onpnpm test:perf:auth+ report assembler;PERF_ADMIN_JWTfor Bearer-only admin setupTest plan
pnpm test(unit, 209)pnpm lint/pnpm typecheckpnpm test:perf:auth(7 variants; tables in assessment doc)