Local Coding Time Tracker#435
Conversation
- Add database tables for local coding sessions and API keys - Add API routes for managing API keys - Add sync endpoint for VS Code extension to upload sessions - Add stats endpoint for dashboard display - Add LocalCodingTime component to dashboard - Show local coding time alongside GitHub activity
|
Someone is attempting to deploy a commit to the PRIYANSHU DOSHI's projects Team on Vercel. A member of the Team first needs to authorize it. |
GSSoC Label Checklist 🏷️@Priyanshu-byte-coder — please apply the appropriate labels before merging: Difficulty (pick one):
Quality (optional):
Validation (required to score):
|
Priyanshu-byte-coder
left a comment
There was a problem hiding this comment.
Security: API keys stored in plaintext.
api_key in local_coding_api_keys stores the raw token. If the database is compromised, all API keys are exposed. Store a SHA-256 hash of the key and compare against the hash on authentication (the raw key is shown to the user only once at generation time).
Additional required fixes:
- No rate limiting on
/api/local-coding/sync— this endpoint is authenticated by bearer token only (no NextAuth session). A leaked key can upsert unlimited rows with no throttle. daysparam not validated —parseInt(searchParams.get('days') || '30', 10)allows arbitrarily large values. Clamp to an allowlist (7/30/90) or set a hard max.- No per-user session row limit — users can accumulate unlimited rows with no cap.
- Missing EOF newlines on all three new API route files and
LocalCodingTime.tsxand the migration SQL.
- Store SHA-256 hash of API keys instead of plaintext in local_coding_api_keys - Add rate limiting: MAX_SESSIONS_PER_REQUEST=100, MAX_SESSIONS_PER_USER=365 - Validate days parameter with allowlist [7, 30, 90] (defaults to 30) - Add per-user session row limit (365 days max) - Add EOF newlines to all local-coding route files, component, and migrations
Security Fixes AppliedAddressed all mentor review feedback: 1. API Key Hashing (Blocking)
2. Rate Limiting on /api/local-coding/sync
3. Days Parameter Validation
4. Per-User Session Row Limit
5. EOF Newlines
|
Implements local coding time tracking feature as requested in #379.
Features
API Endpoints
Database
Components