v3.29.2: the strict row rule for the outfile import

The format is positional: an empty value drops its token, so the parser
now requires every data row to have exactly the header's column count.
That catches an empty value anywhere - including a middle one, which
would otherwise shift the following columns (a missing ADM made the KIC
columns read the KIK values: valid hex, wrong preset) - and a KICn/KIDn
pair declared in the header must carry a usable hex value in every row
(a placeholder fails).

A violation makes the whole file invalid: the report's error names the
line, no presets are returned, and an import (mode) answers 400 - it is
never partially imported.  The PWA disables the Import button while the
report carries an error and guards the call.

Unchanged per-row reports: a non-hex PIN/PUK/ADM/PSK value (dropped, the
card kept), an unsupported key size (that keyset skipped), a card whose
remaining keysets are unusable (skipped).  All three real samples satisfy
the rule exactly (11/11, 18/18, 18/18).

Docs: help EN/RU, api.md, the repo AGENTS.  Tests: the short/long row and
the placeholder-keyset file errors, the valid-file round trip, the
endpoint's refusal (nothing stored), the PWA's disabled button.
926 frontend + 945 Python; sw cache simple-v449.
This commit is contained in:
2026-10-15 00:43:53 +03:00
parent 8a66ea5a0a
commit 94d7cff485
11 changed files with 105 additions and 24 deletions
+7 -1
View File
@@ -324,7 +324,13 @@ into a preview.
- `text` (required) — the outfile contents. A file without a column line
answers `{"ok": true, "preview": true, "presets": [], "report": {"error":
"no column-name line found - …"}}` (a preview, not a `400`: the panel
shows the message).
shows the message). The same report error covers a structurally invalid
file (v3.29.2): a data row whose token count differs from the header's column
count (the format is positional, so an empty value drops its token - including
in the middle, which would otherwise shift the columns), or a
`KICn`/`KIDn` pair declared in the header without a usable hex value in some
row. An import (`mode`) of such a file answers `400` with that error - it is
never partially imported.
- `name` — one common name applied to every imported card; empty falls back
to the card's ICCID.
- `algorithm16` — the algorithm nibble for a **16-byte** key: `"3des2"`