feat: add revocable account sessions and password changes - #6
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (19)
Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe pull request adds persistent account sessions with session-bound JWTs, device metadata, revocation, expiry, legacy-token migration, password-change rotation, session-management endpoints, and provisional sessions for secure pairing. ChangesAccount session authentication
Estimated code review effort: 4 (Complex) | ~60 minutes Merge Risk: 🔵 Low · up to The PR adds revocable sessions and provisional pairing state. A reused pairing identifier could collide with an existing active session, potentially activating access before pairing is consumed or causing pairing completion to fail; this is a bounded edge case that should have explicit owner awareness before merge. Sequence Diagram(s)Account session authenticationsequenceDiagram
participant Client
participant AuthMiddleware
participant AccountSessionStore
participant SessionEndpoint
Client->>AuthMiddleware: session-bound JWT
AuthMiddleware->>AccountSessionStore: resolve active session
AccountSessionStore-->>AuthMiddleware: AccountSession
AuthMiddleware->>AccountSessionStore: touch last_active_at
AuthMiddleware->>SessionEndpoint: authenticated request
SessionEndpoint-->>Client: session response
Pairing session activationsequenceDiagram
participant PairingClient
participant PairingHandler
participant PairingStore
participant AccountSessionStore
PairingClient->>PairingHandler: claim pairing request
PairingHandler->>PairingStore: claim with candidate session
PairingStore->>AccountSessionStore: create pending session
PairingStore-->>PairingHandler: pairing and account session
PairingClient->>PairingStore: consume pairing payload
PairingStore->>AccountSessionStore: activate pending session
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 38.64% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 88 functions across 13 files. (6 skipped: 6 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Not approved Macroscope's review found this PR not approvable — This PR substantially changes authentication and account lifecycle behavior by introducing persisted sessions, revocation, password rotation, legacy-token migration, and provisional pairing sessions. It also adds security-sensitive database and JWT changes, so the breadth and impact warrant human review. Not approved because:
Review your spending limits in Billing settings. You can add or adjust custom eligibility rules. Learn more. |
Sync authentication tokens are currently stateless, so users cannot inspect or revoke individual devices, and changing a password cannot invalidate existing access.
This adds stored account sessions for password, OIDC, and pairing authentication. JWTs carry a session ID, authenticated requests verify that the session is active, and new endpoints list, rename, and revoke sessions or change the account password. Pairing sessions remain provisional until the receiving device consumes the approved payload.
Existing clients remain compatible. Login and registration device IDs are optional, and valid JWTs issued before this change lazily create revocable legacy sessions. Password changes advance an account session generation, which invalidates unseen legacy tokens and concurrent logins that verified the previous password.
The README and privacy policy document the retained encrypted device data and session timestamps.
Testing
cargo testcargo clippy --all-targets -- -D warningscargo check --no-default-features --features postgresClient: OpenTubeX/OpenTubeX#1042
Supports OpenTubeX/OpenTubeX#942.