Repository navigation
Description
🐛 Bug Description
On the dev demo server (https://dev.opensourcepos.org), users logged in as the default user (admin) are able to modify both the username and the password of the account.
Because the server is publicly accessible for testing and evaluation using well-known default credentials (admin / pointofsale), allowing these fields to be updated allows any visitor to lock everyone else out of the demo environment until the container is reset.
✅ Expected Behavior
On demo deployments (or when lockdown flags are enabled):
- The default demo admin account credentials should be protected from modification.
- Changes to the demo admin's username should be blocked (or the username field rendered readonly/disabled).
- Password changes on the demo admin account should be blocked (e.g. returning Employees.error_updating_demo_admin or Employees.error_password_change_disallowed).
📊 Additional AI Generated Information & Code Analysis
Missing Username Restriction:
In app/Controllers/Employees.php, postSave() unconditionally updates $employeeData['username'] from POST input. Even if password changes are restricted, there is currently no check preventing changing the username of person ID 1 / demo admin.
Demo Environment Flag Status:
In app/Controllers/Employees.php, DISALLOW_PASSWORD_CHANGE only gates password changes if the environment variable is explicitly set to true:
if (!empty($this->request->getPost('password')) && ENVIRONMENT != 'testing' && filter_var(getenv('DISALLOW_PASSWORD_CHANGE'), FILTER_VALIDATE_BOOLEAN)) {
return $this->response->setJSON([
'success' => false,
'message' => lang('Employees.error_password_change_disallowed'),
'id' => $employeeId
]);
}On dev.opensourcepos.org, this variable either is not set or set to false, allowing password updates to succeed.
Existing Unused Language Strings:
The language files in app/Language/*/Employees.php already contain localized strings designed for this protection that are currently unused in the controller:
'error_updating_demo_admin' => 'You can not change the demo admin user.'
'error_deleting_demo_admin' => 'You can not delete the demo admin user.'
'error_password_change_disallowed' => 'Password changes are disabled in this demo.'
Activity
objecttothis commentedon Oct 23, 2026
Claude Issue Checker Agent (cc @objecttothis)
Investigated against current
master.Status: Still present (no demo-admin protection implemented).
In
app/Controllers/Employees.php::postSave():usernameis unconditionally read from POST and included in$employeeData['username']for both the "password changed" and "password not changed" branches — there is no check for the demo admin account (e.g.person_id === 1) before allowing the username to change.DISALLOW_PASSWORD_CHANGEis explicitly set truthy — it doesn't specifically protect the demo admin account, and if the env var isn't set on the demo server, this check is a no-op.Employees.error_updating_demo_admin,Employees.error_deleting_demo_admin, andEmployees.error_password_change_disallowedexist inapp/Language/*/Employees.phpbuterror_updating_demo_admin/error_deleting_demo_adminare not referenced anywhere inEmployees.php(onlyerror_password_change_disallowedis used, and only behind the env flag above).No PR is currently linked to this issue. The described vulnerability (anyone able to change the demo admin's username/password when
DISALLOW_PASSWORD_CHANGEisn't set) appears to still be exploitable onmaster.