fix(auth): auto-clear session credentials after 30 minutes of inactivity#692
fix(auth): auto-clear session credentials after 30 minutes of inactivity#692anshul23102 wants to merge 1 commit into
Conversation
Sessions had no expiration: once a username and optional PAT were entered they remained in React state indefinitely. An unattended browser tab with a valid PAT stored in state remained exploitable for the entire browser session. Add an inactivity timer via useEffect. After 30 minutes without a user interaction event (mousemove, keydown, click, scroll, touchstart) the timer fires clearSession(), zeroing both username and token. The timer resets on every qualifying event so active sessions are not disrupted. When no username is set the timer is inactive and no listeners are registered. Closes GitMetricsLab#688
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
Warning Review limit reached
More reviews will be available in 58 minutes and 51 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 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 |
Description
Sessions had no expiration: once a username and optional PAT were entered they remained in React state for the lifetime of the browser tab. An unattended tab with a PAT in state was exploitable for the entire browser session, and any token compromise provided indefinite access.
Root Cause
useGitHubAuth used useState for both username and token with no cleanup mechanism. No inactivity timer or session expiry was implemented.
Related Issue
Closes #688
Type of Change
Changes Made
Testing Done
Checklist