adding maintenance mode check at start of domain middleware#2369
adding maintenance mode check at start of domain middleware#2369
Conversation
There was a problem hiding this comment.
Pull request overview
This PR adds a maintenance mode check at the beginning of the domain middleware to skip domain validation when the system is in maintenance mode.
Changes:
- Added early return in domain middleware when maintenance mode is active
- Imported
getMaintenanceModefunction to check maintenance status - Added changeset documenting the patch
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/provider/src/api/domainMiddleware.ts | Added maintenance mode check with early return to skip domain validation |
| .changeset/silver-tires-fold.md | Added changeset entry documenting the maintenance mode feature |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // If maintenance mode is active, skip domain validation | ||
| if (getMaintenanceMode()) { | ||
| req.logger.info(() => ({ | ||
| msg: "Maintenance mode active - skipping domain validation", | ||
| })); | ||
| next(); |
There was a problem hiding this comment.
When maintenance mode is active, the middleware skips domain validation entirely but still processes requests. This could allow unauthorized requests to bypass critical security checks. Consider either: (1) returning a 503 Service Unavailable response instead of proceeding, or (2) ensuring that subsequent middleware/handlers properly validate that maintenance mode requests are authorized.
| // If maintenance mode is active, skip domain validation | |
| if (getMaintenanceMode()) { | |
| req.logger.info(() => ({ | |
| msg: "Maintenance mode active - skipping domain validation", | |
| })); | |
| next(); | |
| // If maintenance mode is active, return 503 Service Unavailable | |
| if (getMaintenanceMode()) { | |
| req.logger.info(() => ({ | |
| msg: "Maintenance mode active - rejecting request with 503", | |
| })); | |
| res.status(503).json({ | |
| error: "ServiceUnavailable", | |
| message: "Service is temporarily unavailable due to maintenance", | |
| }); |
No description provided.