Merge pull request #188 from copenhagentruckwash/propose-fix-for-relay-control-bypass-vulnerability
Fix self-serve relay sync to enforce lane safety guards
This commit is contained in:
@@ -579,13 +579,13 @@ class departmentsRoute
|
||||
|
||||
// Self-serve enabled: keep machine stack off.
|
||||
$this->setOptionalLaneRelayState($lane, 'relay_machine_program_picker_id', static function () use ($lane): void {
|
||||
$lane->setMachineProgramPickerRelayStatusHard(false);
|
||||
$lane->setMachineProgramPickerRelayStatus(false);
|
||||
});
|
||||
$this->setOptionalLaneRelayState($lane, 'relay_machine_cleaner_id', static function () use ($lane): void {
|
||||
$lane->setMachineCleanerRelayStatusHard(false);
|
||||
$lane->setMachineCleanerRelayStatus(false);
|
||||
});
|
||||
try {
|
||||
$lane->setMachineRelayStatusHard(false);
|
||||
$lane->setMachineRelayStatus(false);
|
||||
} catch (\Throwable) {}
|
||||
}
|
||||
}
|
||||
|
||||
+6
-6
@@ -8,10 +8,10 @@ it('syncs lane relay states when department self-serve enabled flag changes', fu
|
||||
expect($routeContent)->toContain('$this->syncDepartmentSelfServeRelayStates((int)$department->id, $enabled);');
|
||||
expect($routeContent)->toContain('if (!$enabled) {');
|
||||
expect($routeContent)->toContain('// Self-serve disabled: do not mutate lane relay states.');
|
||||
expect($routeContent)->toContain('setMachineProgramPickerRelayStatusHard(false)');
|
||||
expect($routeContent)->toContain('setMachineCleanerRelayStatusHard(false)');
|
||||
expect($routeContent)->toContain('setMachineRelayStatusHard(false)');
|
||||
expect($routeContent)->not->toContain('setMachineCleanerRelayStatusHard(true)');
|
||||
expect($routeContent)->not->toContain('setMachineRelayStatusHard(true)');
|
||||
expect($routeContent)->not->toContain('setMachineProgramPickerRelayStatusHard(true)');
|
||||
expect($routeContent)->toContain('setMachineProgramPickerRelayStatus(false)');
|
||||
expect($routeContent)->toContain('setMachineCleanerRelayStatus(false)');
|
||||
expect($routeContent)->toContain('setMachineRelayStatus(false)');
|
||||
expect($routeContent)->not->toContain('setMachineProgramPickerRelayStatusHard(false)');
|
||||
expect($routeContent)->not->toContain('setMachineCleanerRelayStatusHard(false)');
|
||||
expect($routeContent)->not->toContain('setMachineRelayStatusHard(false)');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user