Skip to content

Authorization bypass: whitelist naming mismatches + missing entries in Auth.php #181

Description

@lighthousekeeper1212

Summary

The Auth.php $resApiCalls whitelist (lines 30-33) that restricts admin-only API endpoints has two classes of issues that allow non-admin staff users to access admin-level operations.

1. Naming Mismatches (6 endpoints)

The whitelist uses singular names but the actual API endpoints in wpos.php use plural names, making the whitelist check ineffective:

Whitelist entry (Auth.php) Actual endpoint (wpos.php) Line
user/disable users/disable 404
device/disable devices/disable 422
location/add locations/add 428
location/edit locations/edit 432
location/delete locations/delete 436
location/disable locations/disable 440

isUserAllowed() at line 167 does array_search($apiAction, $this->resApiCalls) which won't match the plural form against the singular whitelist entry. If a non-admin user has these endpoints in their permissions array, the whitelist admin-only protection is bypassed.

2. Missing Whitelist Entries (~11 endpoints)

These admin-level operations are not in the whitelist:

  • settings/invoice/set (line 652) - while settings/pos/set and settings/general/set ARE whitelisted
  • settings/set (line 638) - generic settings modification
  • settings/google/authinit + settings/google/authremove (lines 657, 660)
  • All 5 settings/xero/* endpoints (lines 663-675) - Xero accounting integration
  • message/send (line 738) - broadcast to all POS devices
  • device/reset (line 754) - reset POS devices

3. Duplicate Entry

settings/invoice/get appears twice in the whitelist (line 31).

Impact

Non-admin staff users who are granted these permissions can disable users, manage locations, modify invoice settings, configure third-party integrations, export sales to Xero, broadcast to all POS devices, and reset devices.

Suggested Fix

Fix the whitelist to use correct plural endpoint names and add all missing entries.

Discovery

Found via manual code review comparing whitelist entries against actual API endpoint case labels (1-of-N inconsistency pattern).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions