Skip to content

Comments

N°8540 - Maintenance mode#809

Open
eespie wants to merge 2 commits intosupport/3.2from
issue/8540_Maintenance_mode
Open

N°8540 - Maintenance mode#809
eespie wants to merge 2 commits intosupport/3.2from
issue/8540_Maintenance_mode

Conversation

@eespie
Copy link
Member

@eespie eespie commented Feb 18, 2026

Base information

https://support.combodo.com/pages/UI.php?operation=details&class=Bug&id=8540
Bug fix

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have tested all changes I made on an iTop instance
  • I have added a unit test, otherwise I have explained why I couldn't
  • Is the PR clear and detailed enough so anyone can understand digging in the code?

Checklist of things to do before PR is ready to merge

  • ...
  • ...
  • ...

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.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 51 to 64
if (!isset($GLOBALS['bBypassAutoload']) || $GLOBALS['bBypassAutoload'] == false) {
require_once APPROOT.'/lib/autoload.php';
$oKPI = new ExecutionKPI();
Session::Start();
$oKPI->ComputeAndReport('Session Start');

// Now bBypassMaintenance mode is set in the session rather than the request params
$bBypassMaintenance = Session::Get('bBypassMaintenance', false);
}

//
// Maintenance mode
//

// Use 'maintenance' parameter to bypass maintenance mode
if (!isset($bBypassMaintenance)) {
$bBypassMaintenance = isset($_REQUEST['maintenance']) ? boolval($_REQUEST['maintenance']) : false;
}

if (file_exists(MAINTENANCE_MODE_FILE) && !$bBypassMaintenance) {
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

Potential undefined variable issue: If $GLOBALS['bBypassAutoload'] is true, $bBypassMaintenance will not be defined when it's used on line 64. The code that sets $bBypassMaintenance (line 58) is inside the if block that checks bBypassAutoload.

Consider initializing $bBypassMaintenance = false before the if block on line 51, or checking if it's defined before using it on line 64. This would prevent a potential "undefined variable" notice if bBypassAutoload is true.

Copilot uses AI. Check for mistakes.
Comment on lines +39 to +40
if (!Session::Get('bBypassMaintenance', false)) {
// Allow setup in maintenance mode
Copy link

Copilot AI Feb 18, 2026

Choose a reason for hiding this comment

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

The code in setup/index.php unconditionally sets the bBypassMaintenance flag in the session for any visitor to the setup page, effectively granting all such sessions the ability to bypass global maintenance checks. An attacker who can reach /setup can first load that page to set bBypassMaintenance to true, then access regular application entry points while MAINTENANCE_MODE_FILE exists and avoid the maintenance lockout. Restrict setting bBypassMaintenance to authenticated/authorized maintenance operations only (for example, after validating a setup token or admin login) instead of doing it for every request to the setup entry point.

Suggested change
if (!Session::Get('bBypassMaintenance', false)) {
// Allow setup in maintenance mode
// Allow setup in maintenance mode, but only for local requests to avoid exposing
// the maintenance bypass flag to arbitrary remote clients.
$sRemoteAddr = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '';
$bIsLocalRequest = in_array($sRemoteAddr, array('127.0.0.1', '::1'), true);
if ($bIsLocalRequest && !Session::Get('bBypassMaintenance', false)) {
// Allow setup in maintenance mode for authorized (local) requests only

Copilot uses AI. Check for mistakes.
@Molkobain Molkobain added this to the 3.2.3 milestone Feb 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Work made by Combodo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants