Repository navigation
Keep bounded boot history and carrier details in support exports - #49
Merged
Merged
Conversation
Read the journal as JSON and admit records only through trusted journal fields: the CeraUI service, ModemManager, NetworkManager, wpa_supplicant, hostapd, the kernel and systemd's own unit lifecycle lines. Other units, sudo and audit records are withheld, and runs of withheld records collapse into one counted marker. Lines carry a boot ordinal, timestamp and source instead of the host name, boot id and pid. Content filters now require a value shape after a keyword, mask address spans instead of dropping the line, strip NetworkManager's epoch prefix before the numeric-identity test and exempt byte and packet counters. They also catch key/account phrases, SRT access-control ids, command lines, coordinate pairs, punctuated phone numbers and short cell ids. Error objects are projected to name, code and a bounded filtered message; exit code, signal, interface, known states and failure reasons are kept. Records over 8 KiB and records split at the journal line limit are withheld before any pattern runs. Downloads are single-flight, and a size overflow retries once with the current boot's newest 400 entries. Paired fixture corpora hold lines that must never appear and diagnostics that must survive, tested together.
Admit a journal record only when its unit and command name both match, so children of admitted units (the hotspot DHCP server under NetworkManager, pppd, sudo) are withheld. The system download passes the admitted sources to journalctl as matches, so the entry budget is spent on candidate evidence. ModemManager, NetworkManager, wpa_supplicant, hostapd and kernel lines now pass a table of allowlisted line shapes. Named groups keep reason codes, interfaces and numbers and replace addresses, network and connection names, UUIDs and USB serials. Unmatched lines are withheld and counted; kernel text must match a kernel shape. The content filters remain a second layer, now masking addresses followed by a port or punctuation and further MAC notations, withholding credentials written as prose and replacing quoted SSIDs and connection names. The legacy text parser is removed. Corpora are journal records with the trusted fields set and run through the production renderer, plus a realistic sample built from upstream daemon log formats. The download header states how many records were shown and withheld.
…ports Line shapes now cover the formats devices write on bookworm (ModemManager 1.20, NetworkManager 1.42) and trixie (ModemManager 1.24, NetworkManager 1.52), taken from info-level format strings in the Debian sources: <inf>, <msg> and <wrn> levels, managed-type state changes, network rejections and consolidated registration. Hotspot events are read from wpa_supplicant, which runs NetworkManager's access point. Interface names must look like kernel or modem port names, and stage, association and carrier lines are anchored to their literal endings. Modem error text after "couldn't" and "failed to connect modem" keeps only ModemManager's own error phrases, generated from its sources; anything else becomes [reason]. Backend messages are admitted only when they match a message the code logs, generated from the logger calls, with interpolated values reduced to numbers, interface names, process names and known codes. Error details also withhold echoed commands, nmcli SSID errors, e-mail addresses and failed-lookup host names, and the numeric filter treats commas and underscores as separators. Stream start failures keep class, phase, capture cause and retry state. Boot labels count back from the running boot. The sample is rebuilt from what production logs for both generations.
…mple Withdraws the earlier survival figure, which was measured on bookworm formats and on backend info events that never reach the production journal.
1 of 5 tasks
Error messages and reasons in backend metadata are now bounded like log messages: an error message is kept only if it is an error text the code throws (generated from new ...Error(), super() and throw), a fixed runtime text or a system-call error reduced to its call and code, otherwise [value]; a reason only if it is a known code or a value the code assigns. Command-echo prefixes (Command failed/aborted, Spawn timed out) are withheld, and execFileP's own messages mask secret-looking arguments the way run() does. The generator also collects bare warn()/error() calls and constants passed to the logger, and lists the logger calls whose message is not literal text. The ModemManager phrase list now records the Debian tarballs it was generated from. Line shapes add ModemManager 1.24's lock, PIN, enable, registration, attach, call-end and start-network failures and NetworkManager's real Wi-Fi connected and hotspot lines, link timeouts, APN-not-found and locked modem warnings and the DHCP acd suffix. A split record whose first piece journalctl prints as null is still tracked. Digits joined by any space or a colon count as one number, and metadata interface names follow the line shapes' rule. The trixie sample drops info lines ModemManager 1.24 does not log by default.
The support download is moving from masking free text to rendering typed fields only. Every daemon field it keeps must be a member of the producer's own vocabulary, so generate those lists from the Debian source packages the devices run, the same way the ModemManager error phrases are generated: - libqmi call-end, verbose call-end and QMI protocol-error nicknames, keyed by numeric code (libqmi 1.32.2, 1.36.0 and the 1.38.0 carry); - ModemManager modem, registration and packet-service states, access technologies, lock types, network errors, D-Bus error names, simple-connect steps and plugin names (1.20.4, 1.24.2); - NetworkManager device states, reasons, managed types, supplicant, connectivity and global states and device types (1.42.4, 1.52.1); - wpa_supplicant/hostapd states, ciphers, temporary-disable reasons and the 802.11 reason names (wpa 2.10). Enum nicknames follow glib-mkenums (explicit nick, else the value name without the common prefix). The parser matched glib-mkenums' own output for all 292 enums in the libqmi and ModemManager headers used. The source tarballs' SHA-256 sums are recorded in the generated file.
Six review rounds each found another regex group or template gap that copied free text into the support download. Stop copying it: every value the download carries is now typed, and the content filters that tried to recognise private text in admitted lines are removed. - Daemon line shapes: every captured field has a type. States, reasons, access technologies, connect steps, lock names, plugins, D-Bus error names, NetworkManager states/reasons, wpa/hostapd states and ciphers and 802.11 reason names must be members of the generated vocabularies; unknown values become [state], [reason] and similar while the line stays. libqmi call-end, verbose call-end and QMI protocol-error nicknames are kept only when they are libqmi's name for the logged code. Interface names follow the kernel naming grammar (letter+digit pairs for predictable names); others are [interface], including inside ModemManager object paths. A test checks that shape text outside fields admits only fixed words, digits and hex. - Kernel and systemd: USB product/manufacturer strings are [name]; OOM and killed process names outside the box's own processes are [process]; a kernel release keeps its version numbers; systemd lines are rebuilt from systemd's grammar with exit-status and result names from its tables, units outside the box's own and admitted services as [unit] and template instances as name@[instance]. - Backend events: every template gap is [value] unless it is a fixed token, so the output depends on the template, not on the runtime string, whichever call wrote it. System-call errors need a real call and errno code; spawn paths are kept only for supervised processes. RPC traces keep a procedure only if it is in the RPC contract. The sender exit is logged with typed process, exit code and signal fields, which the download keeps. - Tool errors stay [value] with a typed failure class (timeout, missing-executable, permission, rejected-configuration, network-unreachable), set where a tool is run (exit 126/127, nmcli and curl exit codes, spawn errors, the allowlist refusal) or derived from the error's name and code. The logger now serialises an error's code and class. - Argument masking also covers stream ids, accounts, users, logins, `-u user:password` and URL credentials. - Boot labels count every boot: the order comes from journald's boot list, else from every record read, withheld ones included. The header names boots with no shown record. - The message generator collects logger["warn"](...) calls, can scan another tree, and reason templates have a freshness test. Every identifier the sixth review planted is a test, written first: 70 of the new tests failed before the change.
The support export documentation now states that every value in the file is typed: closed vocabularies generated from the producers' sources, libqmi nicknames keyed by code, numbers in named positions, kernel-grammar interface names and fixed placeholders. Template gaps are [value]; values a helper needs travel as typed metadata, including the tool failure class. Boot labels follow journald's boot list. English and Spanish.
pjeweb
added a commit
that referenced
this pull request
Nov 16, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 17, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 17, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 18, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 18, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 19, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 21, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 22, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 23, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 24, 2026
pjeweb
added a commit
that referenced
this pull request
Nov 24, 2026
Author
|
Still carried in the integration train and not upstream, so it continues as #243. |
pjeweb
added a commit
that referenced
this pull request
Nov 25, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
When a box misbehaves, the person supporting it needs to see what happened before the last reboot, and which modem model is fitted. A log download is only safe to share if it carries no credentials or subscriber identities. Earlier rounds of this PR tried to spot and remove private text, and each review still found a way for free text to get through.
What it adds
[boot 0]is this boot,[boot -1]the one before.[custom APN], never its text) and the modem's TAC: the first eight digits of the IMEI, which identify the modem model, not the device.How
The export copies no text from a log record. Each line must match a known shape, taken from the formats the daemons log. It is then rebuilt only from fixed text, words from closed lists generated from the daemons' source packages, bounded numbers, and placeholders such as
[address]. A value not on its list becomes a placeholder; a line with no known shape is withheld. CeraUI's own messages are handled the same way.Targets the fork integration branch; not stacked on another PR.
Technical detail
Support diagnosis needs retained pre-reboot evidence and a modem model allocation code without copying credentials or subscriber identities. Exports include bounded retained journal history and a separate carrier summary with masked APN presence and the eight-digit modem TAC.
Successive reviews kept finding new ways for free text to pass: first in raw log text, then in the allowlisted line shapes and message templates, because any regex group or template gap that was not masked was copied as written. So the export no longer copies text from a record at all. Every value in the file is typed: this code's own fixed text, a member of a closed vocabulary generated from the producer's source, a bounded number in a named position, an interface name by the kernel naming grammar, or a fixed placeholder (
[name],[address],[value]…). A value outside its vocabulary shows as its placeholder and the rest of the line stays. Lines without a shape and messages the code does not write are withheld and counted.Approach
NetworkManager.service+NetworkManager, and so on), using fields journald sets from the sending process. The DHCP server NetworkManager runs for the hotspot,pppd,sudo, audit and every other unit are withheld. Kernel text comes from the kernel transport and must also match a kernel shape. systemd needs PID 1. The system download passes the admitted sources tojournalctlas match groups, so the 10,000-entry budget is spent only on records that can reach the export.support-line-shapes.ts) for ModemManager, NetworkManager, wpa_supplicant, hostapd and the kernel, taken from the format strings both daemon generations log at info level or above: bookworm (ModemManager 1.20.4, NetworkManager 1.42.4) and trixie, which the image builds (CeraLive's ModemManager 1.24.2, NetworkManager 1.52.1). Each captured field has a type; there is no "kept as written" group, and a test checks that shape text outside fields admits only fixed words, digits and hex.scripts/support-daemon-vocabulary.ts, new): ModemManager modem/registration/packet states, access technologies, connect steps, lock types, network-rejection reasons, plugin and D-Bus error names; NetworkManager device states, reasons, managed types, supplicant/connectivity/global states and device types; wpa_supplicant/hostapd states, ciphers and temp-disable reasons; 802.11 reason names. Generated from the Debian source packages (ModemManager 1.20.4/1.24.2, libqmi 1.32.2/1.36.0/1.38.0, NetworkManager 1.42.4/1.52.1, wpa 2.10) with their SHA-256 sums recorded. Enum nicknames follow glib-mkenums.call end reason (N),verbose call end reason (T,R): [type] reasonandQMI protocol error (N): '…'keep the number, and the nickname only if it is libqmi's name for that number; otherwise[reason]. The same holds afterCall failed:and for D-Bus error names in modem error text, which otherwise keeps only ModemManager's own fixed phrases (scripts/support-reason-vocabulary.ts).wlan0,wwan0mbim0,cdc-wdm0,ttyUSB2) and predictable names as letter+digit pairs (enp1s0u1u2), with MAC-derived names masked; anything else is[interface], including inside ModemManager object paths and in metadata.[name](vendor:product ids stay); OOM and killed process names outside the box's own processes are[process]; a kernel release keeps its version numbers (6.1.0-28-[release]). systemd lines are rebuilt from systemd's grammar with its exit-status and service-result names; units outside the box's own and the admitted services are[unit], template instancesname@[instance].logger["warn"](…)). Every gap is[value]unless it is a fixed token (start-failure class/phase, known state or code), so the output depends on the template, not on the runtime string, whichever call wrote it. Values a helper needs travel as typed metadata: error name and code, exit code, signal, supervised process, interface, states, bounded counts and timings, start-failure class/phase/capture cause/retry. The sender-exit warning now logs process, exit code and signal as fields too. RPC traces keep a procedure only if it is in the RPC contract.[value]with a typed class:timeout,missing-executable,permission,rejected-configuration,network-unreachable. The class is set where a tool is run (spawn errors, exit 126/127, documented nmcli and curl exit codes, the allowlist refusal) or derived from the error's name and code; the logger now serialises an error's code and class. System-call errors are kept only with a real call and errno code (spawn /usr/bin/srtla_send ENOENT,connect ECONNREFUSED [value]); a spawn path is kept only for a supervised process.-u user:password,-p <secret>and URL credentials.journalctl --list-boots), else every record read including withheld ones, so a boot whose records were all withheld still counts; the header names boots with no shown record._LINE_BREAK, the 8 KiB record bound, counted withheld markers, start-failure metadata, and the tests through the shipping path ("must never appear", "must survive", three-incident samples per daemon generation).What the sample shows, and what it does not
The rebuilt three-incident sample (a modem that needs its PIN, is denied registration, fails on a missing APN and connects; Wi-Fi with a wrong key that drops; a hotspot client; a sender that exits and a start that fails after its retries; an under-voltage USB reset) keeps 105 of 110 records on bookworm formats and 110 of 114 on trixie, and no sample secret appears. It is assembled from the daemons' format strings, not captured from a device. Two of its fixtures used values the producers never log (a NetworkManager state "connecting", call-end code 3 with the nickname for code 1) and were corrected. It says the chosen evidence survives; it does not measure how much of a real journal is shown.
Sources, bounds and validation
Formats and vocabularies come from the Debian source packages
modemmanager1.20.4 and 1.24.2,libqmi1.32.2, 1.36.0 and 1.38.0 (the CeraLive carry's base),network-manager1.42.4 and 1.52.1 andwpa2.10; the generated files record their SHA-256 sums and regenerate identically from them. The enum parser's output matchedglib-mkenumsfor all 292 enums in the libqmi and ModemManager headers used.Bounds: last 7 days and newest 10,000 admitted entries; 15 s and 10 MiB raw per attempt; at most one current-boot retry (30 s timeout budget), with the newest 400 entries after a size overflow; 5 s boot list; 45 s log-RPC reply window; records over 8 KiB withheld before any shape; newest 9 MiB of rendered text, file below 10 MiB. Persistence and retention are unchanged.
Every identifier the sixth review planted (template gaps, system-call words, call-end/QMI/D-Bus nicknames, invented states, connect steps, access technologies, NetworkManager interface and reason, USB product strings, OOM and systemd names, unit instances, result words, kernel release) is a test, written first: 70 of the new tests failed before the change. Validation with the pinned Bun 1.4.4 at
c75e1aa6: full backend 13,121 passed, 19 existing skips, zero failures; full frontend 459 test files (7,652 tests) passed under Bun, plus the hardware preflight; lint with all package type checks (svelte-check 0 errors, 0 warnings), the technical-debt check and the full build passed. Focused export, journal, sample, corpus, generator, typed-field and log-RPC suites: 481 tests pass.No device journal was used: all inputs are synthetic records in the daemons' own formats. Browser E2E was not run (its queue was in use). Gates ran in a transient unit with a 0022 umask, lowered priority, four workers and a PID namespace.
Follow-up hardening
Timing metadata is rounded to integer milliseconds and caller-supplied
tsis omitted in favor of the journal timestamp. Carrier rows mask all configured APNs. Normalized ModemManager QMI/MBIM prefixes and unhandled error codes survive as typed fields; libmbim 1.28.2/1.32.0 status and protocol nicknames are generated by code from recorded Debian tarballs. AP deauthentication/disassociation reasons, AP loss, beacon loss and network-not-found events now survive without addresses. Numeric widths are narrower, missing older boots receive negative labels, and generator--checkverifies recorded hashes and reproduced output.Validation for the additive follow-up is recorded below; earlier counts above apply to the earlier head. No browser E2E, hardware or live journal validation was performed for this follow-up.
Follow-up validation: 508 focused backend tests pass, including the modem-adapter APN assertion. The full isolated backend run had 13,134 passes, 19 skips and one stale APN expectation; that assertion was then corrected and passes in the focused rerun. Lint and package type checks, the technical-debt gate, full build and source-generator
--checkpass. The single-process backend attempt was abandoned after cross-suite failures; final backend testing used per-file isolation.At
862b2d1c, full frontend validation passes: 459 files / 7,652 tests plus four preflight tests. Shared RPC, i18n and sender package suites pass. The follow-up gates used transient user units, 0022 umask, lowered priority and a PID namespace; full suites used one worker.Your call
[value]now (Failed to register modem [value]: [value]). Where a value matters it should be logged as a typed field, as the sender exit now is; a few other messages may want the same.[state]until the vocabulary is regenerated from the new source package.alpha2=inCTRL-EVENT-REGDOM-CHANGE) is kept as a two-letter code.journalctl --list-bootscall (5 s timeout) per download.[custom APN]; only its presence is retained.