From b6537bd54be88e3f2467405b62c448546e58dfff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D1=82=D0=BE=D0=BD=20=D0=A2=D1=80=D0=BE=D1=88?= =?UTF-8?q?=D0=B8=D0=BD?= Date: Sat, 10 Oct 2026 00:30:45 +0300 Subject: [PATCH] v3.24.0: the EF.ARR access rules in the FCP view The file manager's decoded FCI shows the '8B' security attribute reference (EF_ARR 2F06, record 23). The referenced record's access rules are now rendered as indented muted lines under that row, decoded with the existing EF.ARR record decoder (AM_DO/SC_DO conditions). The server reads the card's ARR copies (MF/2F06 and ADF.USIM/6F06, best effort) once per card session in _apply_equipped_card and keeps them as server.arr; GET /api/arr serves the cache without the card lock, a disconnect clears it, and a write to an ARR copy through /api/write refreshes it. The PWA fetches it lazily per card session (pysimArrEnsure, keyed by card_session) and resolves the reference with the selected file's DF context: an ADF.USIM file uses the ADF's 6F06 copy, the implicit reference form too (ISO 7816-4 5.4.3.3 lookup order). Unresolvable references stay silent. The '8B' decode now covers all three ISO 7816-4 Table 25 forms: implicit ARR byte / FID + record / FID + (SEID, ARR) pairs - the pairs form was mis-decoded as a record before. A snapshot resolves the same references offline from its own captured EF.ARR copy. Tests: the three forms, the resolution (DF preference, out-of-range silence), the snapshot path, the server read/cache/route/write-refresh. 868 frontend + 856 Python; sw cache simple-v423. --- docs/api.md | 22 ++++ frontend/help-ru.html | 2 +- frontend/help.html | 2 +- frontend/index.html | 132 ++++++++++++++++++++-- frontend/sw.js | 2 +- frontend/tests/html.test.js | 2 +- frontend/tests/profiler.test.js | 89 +++++++++++++++ pyproject.toml | 2 +- pysim_simple_server/server.py | 92 +++++++++++++++- tests/test_arr.py | 190 ++++++++++++++++++++++++++++++++ 10 files changed, 521 insertions(+), 14 deletions(-) create mode 100644 tests/test_arr.py diff --git a/docs/api.md b/docs/api.md index 8919987..9b44219 100644 --- a/docs/api.md +++ b/docs/api.md @@ -74,6 +74,7 @@ a 3.x PWA). | `/api/net-sim` | POST | Run a network-condition scenario (attach, service loss, roaming, churn, 2G, SMS, CB, AUTHENTICATE) | | `/api/net-state` | GET | Cached network-state monitor (service, location, per-file state) | | `/api/net-state-refresh` | POST | Re-read the monitored files (optional `files` list) and return the updated monitor state | +| `/api/arr` | GET | Cached EF.ARR copies (the FCP '8B' security attribute references): records per ARR file | | `/api/mcc-mnc` | GET | Search the optional MCC/MNC operator list (`?q=`; `?random=1&exclude=`) | | `/api/proactive-log` | GET | Last 50 proactive commands | | `/api/status-poll` | POST | Manual STATUS poll + FETCH if 91XX | @@ -1398,6 +1399,27 @@ optional body filters the read: Without a body all monitored files are re-read. Answers `503` when the reader is not initialized. +### `GET /api/arr` + +Returns the card's cached **EF.ARR copies** — the access-rule files the FCP +security attribute DO `'8B'` references (ISO 7816-4 Table 25). The copies +are read once per card session when a card is equipped (`MF/2F06` and +`ADF.USIM/6F06`, best effort) and served from memory, so this endpoint +performs no card I/O; a disconnect clears the cache, and an `EF.ARR` write +through `/api/write` refreshes it. + +```json +{"ok": true, "session": 12, "arrs": [ + {"fid": "2F06", "path": "MF/2F06", "record_len": 10, "num_records": 23, + "records": ["FFFF...", "..."]}]} +``` + +`ok` is `false` (with an empty `arrs`) when the card has no readable ARR. +The PWA's file manager resolves the `'8B'` reference of the selected file's +FCI against this cache and shows the referenced record's access rules as +indented lines; snapshots resolve the same references from their own +captured `EF.ARR` copy. + ### `GET /api/proactive-log` Returns the last 50 proactive commands fetched during CAT sessions, newest diff --git a/frontend/help-ru.html b/frontend/help-ru.html index 4f0b148..72267ad 100644 --- a/frontend/help-ru.html +++ b/frontend/help-ru.html @@ -397,7 +397,7 @@

Подключение к локальному pysim-simple-server для работы с картой: введите URL сервера (по умолчанию http://127.0.0.1:8080) и нажмите Подключиться. Область статуса показывает состояние ридера/карты, а Подключить карту (пере)инициализирует карту после вставки. Подвкладки: Файловый менеджер, Командная строка pySim и Отправка APDU. «Профайлер» и «Симулятор» — отдельные вкладки верхнего уровня.

6.1 Файловый менеджер

-

Дерево файловой системы отображается слева; выбор файла открывает панель деталей справа. Элементы сгруппированы: DF выше EF, сортировка по FID или символьному имени (пиллы и кнопка «Проверить все файлы» закреплены над прокручиваемым деревом; выбор сохраняется в localStorage). При выборе файла над содержимым также показываются FID, тип файла, размер / структура записей и декодированный FCI — в рамке с символьным именем файла.

+

Дерево файловой системы отображается слева; выбор файла открывает панель деталей справа. Элементы сгруппированы: DF выше EF, сортировка по FID или символьному имени (пиллы и кнопка «Проверить все файлы» закреплены над прокручиваемым деревом; выбор сохраняется в localStorage). При выборе файла над содержимым также показываются FID, тип файла, размер / структура записей и декодированный FCI — в рамке с символьным именем файла. Если FCI ссылается на свои правила доступа через запись EF.ARR (атрибут безопасности 8B), правила указанной записи показываются с отступом под этой строкой: они берутся из копий EF.ARR карты (читаются один раз за сессию при equip, обновляются при сбросе/equip и после записи EF.ARR); снимок разрешает те же ссылки из собственной захваченной копии.