Skip to content

[Bug] Manager API: filter_* на произвольные колонки msCustomer (в т.ч. token oracle) #420

Description

@Ibochkarev

Описание проблемы

CustomersController::getList принимает любые query-параметры filter_* и строит where([$fieldName.':LIKE' => ...]) без whitelist колонок.

formatCustomer не отдаёт token в списке, но фильтр filter_token=<prefix> позволяет oracle/сужение по секретному полю.

Тот же паттерн есть в Deliveries/Payments (ниже риск — нужен mssetting_save).

Шаги воспроизведения

  1. Mgr с доступом к /api/mgr/customers (сейчас view_document, [Bug] Manager API: customers CRUD и category publish под view_document #378).
  2. GET route=/api/mgr/customers&filter_token=<known_or_prefix>.
  3. Список сужается до владельца token / подтверждает наличие префикса через LIKE.

Ожидаемое поведение

Whitelist разрешённых filter-полей (как для UI-фильтров). Секретные колонки (token, password, …) недоступны для фильтрации.

Фактическое поведение

// CustomersController.php ~67-75
if (str_starts_with($key, 'filter_') && !empty($value)) {
    $fieldName = substr($key, 7);
    // ...
    $c->where([$fieldName . ':LIKE' => "%{$value}%"]);
}

Окружение

  • MiniShop3: beta / Manager REST
  • MODX: 3.x
  • PHP: 8.2+

Дополнительный контекст

Связь с dual token model (#369) и утечкой token в profile (#410) / order update.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingpriority: mediumСредний приоритет

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions