airqo-platform / airqo-platform/AirQo-api

Security: Review and restrict CORS configuration in notification preferences routes

Aperta
#4,207 0 commenti 0 reazioni 1 assegnatario Rivendicata da @Baalmart Vedi su GitHub
Lingua principale
JavaScript
Stelle
26
Fork
24
Merge medio
5h 36m
PR unite (30g)
81

Descrizione

## Background
The notification preferences routes currently use a permissive CORS configuration that allows all origins (`Access-Control-Allow-Origin: "*"`). This configuration was identified during code review of PR #4204.

## Security Concern
In a production environment, allowing all origins to access the API can pose security risks, potentially enabling malicious websites to make cross-origin requests to the API.

## Suggested Solution
- Replace the wildcard (`*`) with a whitelist of trusted domains
- Configure CORS settings based on the environment (development/production)
- Consider using environment variables to manage allowed origins

## References
- Original PR: https://github.com/airqo-platform/AirQo-api/pull/4204
- Review Comment: https://github.com/airqo-platform/AirQo-api/pull/4204#discussion_r1921239198

cc @Baalmart

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.