You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
merge: feat(security): Centralized Middleware for Authentication and Rate Limiting (#8254)
## Description
Fixes#7437
Introduces a centralized, configurable middleware layer to handle API
authentication, authorization, rate-limiting, and security headers
globally. Redundant manual security checks have been removed from route
handlers.
Key changes:
- Created a route rules registry inside `middleware.ts` to manage
route-specific auth levels and rate limits.
- Configured NextAuth session checks and enterprise admin role checks
within the centralized middleware runtime.
- Standardized security headers across all responses and integrated
robust error handling for unauthorized/forbidden paths.
- Removed duplicated authentication code from `/api/enterprise` and
`/api/architecture` routes.
## Pillar
- [ ] 🎨 Pillar 1 — New Theme Design
- [ ] 📐 Pillar 2 — Geometric SVG Improvement
- [ ] 🕐 Pillar 3 — Timezone Logic Optimization
- [x] 🛠️ Other (Bug fix, refactoring, docs)
## Visual Preview
None (Backend/Security refactoring)
## Checklist before requesting a review:
- [x] I have read the `CONTRIBUTING.md` file.
- [x] I have tested these changes locally
(`localhost:3000/api/streak?user=YOUR_USERNAME`).
- [x] I have run `npm run format` and `npm run lint` locally and
resolved all errors (CI will fail otherwise).
- [x] My commits follow the Conventional Commits format (e.g.,
`feat(themes): ...`, `fix(calculate): ...`).
- [ ] I have updated `README.md` if I added a new theme or URL
parameter.
- [ ] I have started the repo.
- [x] I have made sure that i have only one commit to merge in this PR.
- [ ] The SVG output matches the CommitPulse "premium quality" aesthetic
standard (no raw elements, smooth animations, correct fonts).
- [x] (Recommended) I joined the CommitPulse Discord community for
contributor discussions, mentorship, and faster PR support.
0 commit comments