Skip to content

Conversation

@HughParry
Copy link
Contributor

No description provided.

@HughParry HughParry requested a review from forgetso as a code owner January 28, 2026 14:55
Copilot AI review requested due to automatic review settings January 28, 2026 14:55
@HughParry HughParry requested a review from goastler as a code owner January 28, 2026 14:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 getMaintenanceMode function 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.

Comment on lines +30 to +35
// If maintenance mode is active, skip domain validation
if (getMaintenanceMode()) {
req.logger.info(() => ({
msg: "Maintenance mode active - skipping domain validation",
}));
next();
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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",
});

Copilot uses AI. Check for mistakes.
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.

2 participants