Skip to content

fix: Add authentication to high-risk API endpoints to prevent data leaks#267

Open
CloudWaddie wants to merge 1 commit intodecolua:masterfrom
CloudWaddie:pr-fix-submission
Open

fix: Add authentication to high-risk API endpoints to prevent data leaks#267
CloudWaddie wants to merge 1 commit intodecolua:masterfrom
CloudWaddie:pr-fix-submission

Conversation

@CloudWaddie
Copy link

  • Add API authentication middleware (src/lib/apiAuth.js) supporting JWT cookies and Bearer API keys
  • Add response sanitization utility (src/lib/sanitize.js) to mask/remove sensitive fields
  • Protect /api/usage/* endpoints (stats, history, logs, providers, chart, stream, request-details, request-logs, [connectionId])
  • Protect /api/keys and /api/keys/[id] endpoints
  • Protect /api/shutdown endpoint
  • Protect /api/cloud/auth and /api/cloud/credentials/update endpoints
  • Sanitize usage stats responses to mask emails and API keys
  • All protected endpoints now return 401 for unauthenticated requests

Fixes critical security vulnerability where sensitive data (emails, API keys, credentials) was exposed without authentication.

- Add API authentication middleware (src/lib/apiAuth.js) supporting JWT cookies and Bearer API keys
- Add response sanitization utility (src/lib/sanitize.js) to mask/remove sensitive fields
- Protect /api/usage/* endpoints (stats, history, logs, providers, chart, stream, request-details, request-logs, [connectionId])
- Protect /api/keys and /api/keys/[id] endpoints
- Protect /api/shutdown endpoint
- Protect /api/cloud/auth and /api/cloud/credentials/update endpoints
- Sanitize usage stats responses to mask emails and API keys
- All protected endpoints now return 401 for unauthenticated requests

Fixes critical security vulnerability where sensitive data (emails, API keys, credentials) was exposed without authentication.
@CloudWaddie
Copy link
Author

@decolua please review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant