Repository navigation
feat(start-wrt): fill the activity log's gaps found in #4430 - #4608
Conversation
`LoginContext::login_attempt_hook` runs after every correctly signed login with the client's address and user agent and whether the password check and enrollment succeeded. The signature middleware injects the peer address (`__Auth_peer`, behind `get_peer` metadata) from the request origin, so a login relayed through the SNI demux reports its real client. StartWRT uses it to record where sign-ins and failed sign-ins came from. StartOS and StartTunnel keep the default no-op.
- device.updated names a rename's old name ("renamed from 'old'", "cleared
name 'old'", "name assigned"). Reservation removal is left to #4466, which
rewrites the same handler.
- auth.login comes from the new start-core login_attempt_hook: the client's
address and the network it reached the router from (profile, inbound VPN,
WAN, or this router, by `ip route get`), and "a browser" for a Mozilla/
user agent, otherwise the agent's first product token. Failed sign-ins carry
the same.
- system.boot: one entry per boot, logged on the daemon's first start in a
boot (a /var/run marker), with version and short hash. The cause comes from
a run-state file in /var/lib/startwrt the daemon keeps durably: starting
(unknown), running (power loss or crash), stopped (clean shutdown, written
on SIGTERM), restarting (system.restart), restoring (backup restore); the
pending-update marker overrides it. A failed reboot command resets it.
- system.migrate: the migration runner logs what the migrations it applied
changed, or which one it stopped at, in plain English rather than by
migration name.
- DNS UPDATE refusals are typed; each source's refusal is logged once until
its reason changes or it is admitted (the per-second cap stays as a flood
backstop). Sources refused for lacking the permission in the last 30
minutes surface as devices.list `dns_injection_requested`, and the device
page shows a note beside the DNS publishing toggle.
- auth.ssh: a logread follower brackets each dropbear session with an entry
when it authenticates (peer, and the key's authorized_keys comment or its
SHA256 fingerprint) and when it exits (with its duration).
helix-white
left a comment
There was a problem hiding this comment.
Approved. I found no blocking correctness regressions in 0c4dd5b14; it merges cleanly with the current master.
This fills the Activity log's missing login context, boot markers, migration descriptions, SSH session boundaries, and device rename history. Refused DNS publishing attempts stop repeating unchanged warnings and produce a notice under Devices → device → Permissions → Allow DNS record publishing. Reservation-removal wording remains with #4466; update retention of the Activity database remains with #4606.
Implementation diff: +816 / −48 lines in 24 files (excludes lockfiles, tests, docs, release notes, and changelog).
Contract and approach. devices.list adds the required boolean Device.dns_injection_requested; its generated schema, mock API, facade, and UI ship together in the embedded frontend. Existing configurations need no migration. The shared login handler gains an optional internal peer parameter and an outcome hook; it retains password verification, enrollment, and existing post-login behavior. StartOS and StartTunnel inherit the no-op observer. Peer addresses reuse the existing request-origin pipeline, including SNI relay attribution, rather than trusting a forwarded header.
The SSH observer follows dropbear through the existing log-line parser and resolves authorized-key comments by fingerprint. It records successful authentication and session closure, not commands or failed SSH authentication. Its in-memory tracking holds 64 open sessions; eviction or a daemon restart leaves the eventual closing entry without a duration. Network labels come from a return-route lookup and UCI interface mapping; an unrecognized route leaves the address unlabeled.
Boot detection combines a durable run-state file with a volatile once-per-boot marker and the existing pending-update marker. Shutdown/crash labels describe the daemon's recorded state, not hardware reset diagnostics. DNS refusal memory is volatile, bounded to 256 sources, and forgets the least recently seen source at capacity; warnings can recur after eviction, admission, or a changed reason. The UI notice lasts up to 30 minutes after the latest permission refusal and is hidden while permission is granted. The existing 20-warnings/second flood cap remains. Activity entries include client addresses, key labels/fingerprints, and rename history; they remain local to the existing administrative logs.
Evidence. The author reports passing StartWRT tests (823 + 21), start-core tests (33 + 1240 + 3), generated-artifact drift checks, WRT type/i18n checks, and a production frontend build. The reported K1 bench ran this branch and exercised boot causes, LAN/Guest and browser logins, key-based SSH sessions, renames, migrations, DNS refusal transitions, and smoke checks across reboot. It did not exercise password SSH, inbound-VPN labels, setup mode, or StartOS/StartTunnel sign-ins end to end.
I reviewed code and recorded evidence without running tests. Solely for the required screenshot, I built this head's mock frontend and captured the permission notice in Chromium; that build succeeded with bundle-budget/CommonJS warnings. The screenshot follows in a separate comment and uses mock device data. CI remains pending, including Prettier, changelog/version checks, StartWRT riscv64, StartOS compilation, and the CLI/registry/tunnel build matrices; this approval does not represent those checks as passed.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
Requesting changes for base integration: master advanced after my approval. I confirmed a real conflict with git merge-tree between PR head 0c4dd5b and master 2dcbc75 in projects/start-wrt/backend/ctrl/src/update.rs.
The conflicting hunk combines this PR's update_pending() helper with master's revised documentation for check_pending_update_marker(). Preserve the helper (the boot logger calls it) and master's updated marker documentation, along with master's registry/update implementation. Please merge origin/master into the PR branch and request review again after author verification. I have left the PR branch unchanged: this session is its reviewer, not its implementer.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
|
Resolved by 172beda. Re-review confirms the per-profile reservation/retry flow and rename history are preserved, both Taiga imports remain, all five dictionaries use DNS notice ID 618, and the Root CA migration has a description. The PR merges cleanly with current master; approval is restored. Current CI is still pending. |
# Conflicts: # projects/start-wrt/backend/ctrl/src/update.rs
0c4dd5b to
1bbb84b
Compare
helix-white
left a comment
There was a problem hiding this comment.
Approved on re-review at 1bbb84bb7. The merge resolves my earlier request: it retains update_pending() for the boot logger and master's updated pending-update documentation and registry implementation. The two feature patches are unchanged apart from commit metadata. git merge-tree confirms a clean merge with current master.
This adds login source/client details, one boot entry per boot, migration descriptions, successful SSH session boundaries, and old device names on rename. Repeated unchanged DNS refusals are deduplicated, and Devices → device → Permissions gains a notice below the DNS-publishing toggle. Reservation-removal wording and Activity database retention across upgrades remain separate work in #4466 and #4606.
Implementation diff: +816 / −48 lines in 24 files (excludes lockfiles, tests, docs, release notes, and changelog).
Contract and approach. devices.list adds the required boolean Device.dns_injection_requested; the embedded UI, generated schema, facade, and mock API change together. Existing configuration requires no migration. The shared login handler receives an optional internal peer address and an outcome observer, preserving password checking, enrollment, and existing post-login behavior. StartOS and StartTunnel use the default no-op observer. Attribution reuses the existing request-origin pipeline, including SNI relays; network labels derive from return routes and UCI interfaces, with a bare address when the network cannot be identified.
Boot logging combines a durable run-state file, a volatile once-per-boot marker, and the existing pending-update marker. Clean-shutdown/crash labels reflect recorded daemon state rather than hardware reset diagnostics. SSH tracking consumes dropbear's system-log events and authorized-key fingerprints; it records neither commands nor failed SSH authentication. Its 64-session in-memory cap evicts the oldest session, leaving its eventual close without a duration; daemon restart also loses duration tracking.
DNS refusal memory holds 256 sources and evicts the least recently seen source. Warnings may recur after eviction, admission, or a changed reason; the existing 20-warnings/second flood cap remains. The permission notice reflects a refusal within 30 minutes and is hidden when permission is granted. Client addresses, key labels/fingerprints, and rename history stay in the existing local administrative logs.
Evidence. The author reports passing pre-integration StartWRT tests (823 + 21), start-core tests (33 + 1240 + 3), generated-artifact drift checks, WRT type/i18n checks, formatting, and a frontend build. The reported branch deployment on the K1 bench covered boot causes, LAN/Guest and browser logins, key-based SSH sessions, renames, migrations, DNS refusal transitions, and smoke checks across reboot. Password SSH, inbound-VPN labels, setup mode, and StartOS/StartTunnel logins were not exercised live.
I ran no tests during re-review. The prior screenshot-only mock frontend build and capture remain representative because this integration does not change that UI. No post-integration local rerun is recorded. Current-head Prettier, Formatting & Lockfiles, Conflict Markers, and changelog/version checks pass. Automated tests, generated artifacts, dependency licenses, and the StartWRT/StartOS/CLI/registry/tunnel build matrices remain pending; approval does not establish their success.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
helix-white
left a comment
There was a problem hiding this comment.
Requesting changes for a new base conflict. The earlier update.rs conflict remains resolved, but master has advanced to c0ce44d. git merge-tree confirms conflicts with head 1bbb84b in all five files under projects/start-wrt/web/src/app/i18n/dictionaries/: en.ts, de.ts, es.ts, fr.ts, and pl.ts.
Both branches allocate translation ID 602: master uses it for the backup-encryption prompt and also adds ID 603, while this PR uses 602 for the DNS-publishing notice. Merge current origin/master, preserve both backup strings, and give the DNS notice the next unused ID consistently in the English mapping and all four translations (604 at the inspected base). Keeping both English keys at 602 would make one feature display the other's translation.
Please re-request review after author-side integration and verification. I have left the PR branch unchanged.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
Helix-Harness: claude-code Helix-Model: claude-opus-5-5 Helix-Identity: helix-b
|
Merged current
Verification on the merged tree:
I did not re-run the live bench after this integration. |
helix-white
left a comment
There was a problem hiding this comment.
Approved on re-review at 172bedac5. All earlier conflict findings are resolved, and both git merge-tree and GitHub report a clean merge with current master.
The resolution preserves master's per-profile reservation update/retry flow. Each retry reads the prior name from its current configuration snapshot; rename wording is appended only after a successful write. Reservation changes, published-port retargeting, and failure wording remain intact. Both Taiga imports survive, the DNS notice consistently uses translation ID 618, and the migration description match includes master's Root CA reissue step.
This PR adds login source/client details, boot markers with recorded causes, plain-English migration outcomes, successful SSH session boundaries, device rename history, and a DNS-permission notice under Devices → device → Permissions. Per-profile reservations and removal messages are inherited from merged #4466, not implemented anew here. Activity database retention across firmware updates remains separate work in #4606.
Implementation diff: +815 / −46 lines in 24 files (excludes lockfiles, tests, docs, release notes, and changelog).
Contract and approach. devices.list adds the required boolean dns_injection_requested. The schema, mock API, facade, and embedded UI ship together; existing configuration needs no migration. The shared login handler adds an optional internal peer address and outcome observer without changing password checking or enrollment. StartOS and StartTunnel retain the default no-op observer. Client attribution reuses the request-origin pipeline, including SNI relays; network labels use return routes and UCI mapping, falling back to the bare address.
Boot detection uses a durable run-state file, a volatile once-per-boot marker, and the existing pending-update marker. Its cause labels describe recorded daemon state rather than hardware reset diagnostics. SSH tracking observes dropbear authentication and closure, not commands or failed authentication. Its 64-session cap evicts the oldest tracked session; eviction or daemon restart leaves a later close without a duration.
DNS refusal memory is volatile and capped at 256 sources, evicting the least recently seen source. Warnings can recur after eviction, admission, or a changed reason, subject to the existing 20-per-second flood cap. A permission refusal remains discoverable for 30 minutes; the UI notice is hidden when permission is granted. These are chosen bounds, not measured capacity limits. Addresses, key labels/fingerprints, and rename history stay in the existing local administrative logs.
Evidence. The implementer reports passing verification on this merged tree: StartWRT tests (867 + 29), committed RPC-binding drift check, WRT type/i18n checks, and scoped formatting. The original author also reported passing start-core tests and K1 branch-binary checks covering boot causes, LAN/Guest/browser logins, SSH keys and durations, renames, migrations, DNS refusal transitions, and smoke checks across reboot. That live bench was not repeated after integration; password SSH, inbound-VPN labels, setup mode, and StartOS/StartTunnel logins were not exercised live.
I reviewed code without running tests or builds this round. The existing screenshot remains representative for its mock device, which has no inactive reservations. Current-head Prettier and Conflict Markers pass. Automated tests, generated artifacts, formatting/lockfiles, licenses, changelog/version checks, and the StartWRT/StartOS/CLI/registry/tunnel build matrices remain pending; this approval does not establish their success.
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol
…4605) * feat(start-wrt): keep the admin password off the wire in plaintext Both first-boot paths run over plain HTTP before the router's CA is trusted, and both posted the new admin password in clear JSON: auth.set-initial-password and POST /api/setup/flash. They now take start-core's EncryptedWire, as StartOS setup does. setup.get-pubkey publishes the public half of start-core's process-wide CURRENT_SECRET, which ServerContext exposes through AsRef<Jwk> like every start-core context; a key field would give each throwaway ServerContext::default() an unrelated key. The browser encrypts with node-jose, which falls back to node-forge where an insecure page has no WebCrypto. It loads lazily from a module of ours, because a dynamic import of the CommonJS package itself yields only a default export in the production bundle. LuCI's login, which takes the root password, was reachable over plain HTTP twice: uhttpd listened on every address at 8080, and the daemon proxied /cgi-bin/* on port 80 without redirecting. uhttpd now binds 127.0.0.1:8080, the proxy's upstream, and migration BindLuciToLoopback rewrites the shipped listen pair on existing routers. The proxy answers the HTTP listener with a 307 to HTTPS. An off-router CLI build defaulted to http://router.lan, so auth login and set-password sent the password unencrypted. Following start-cli, it now defaults to https://router.lan/rpc/v1 and trusts extra CAs through --root-ca. Closes #3679 * fix(start-wrt): describe the profile firewall-section migration in the activity log #4604 and #4608 merged independently; the migration #4604 added had no purpose() arm, so master's startwrt-core did not compile. Helix-Harness: claude-code Helix-Model: claude-opus-5-5 Helix-Identity: helix-b * feat(start-wrt): describe the LuCI loopback migration in the activity log Helix-Harness: claude-code Helix-Model: claude-opus-5-5 Helix-Identity: helix-b --------- Co-authored-by: helix-a <267227783+helix-a@users.noreply.github.com>
…ttings (#4611) * fix(start-wrt): read and write UCI values the way libuci does uciedit tokenized values with inpt's Quoted/SingleQuoted/Spaced, which does not match libuci. libuci writes an apostrophe as '\'' on every commit (LuCI Save & Apply, `uci commit`, StartWRT's own WAN-schedule cron job), and uciedit's lazy single-quote match stopped at the first quote with no backtracking, so the whole file failed with BadOption. It also unescaped backslashes inside single quotes, which libuci keeps literally, and wrote values containing an apostrophe with Rust's {:?} double-quoting, whose \n and \u{..} escapes libuci reads as letters. The tokenizer now follows libuci's parse_str: adjacent quoted and unquoted pieces join, single-quoted text is literal, a backslash elsewhere keeps the next character or continues the line, quoted values may span lines, an unquoted # starts a comment and ; ends a statement. It also accepts package lines, the one-letter keywords and an option with no value, as libuci does. Tokens keep their source text, so untouched lines still round-trip byte for byte; new values are written in libuci's quoting. Closes #4600 * fix(start-wrt): borrow plain single-quoted UCI values and widen the lexer tests A value quoted with no inner apostrophe decodes without copying, which is nearly every line libuci writes. Tests add CRLF continuation, \#, a quote followed directly by #, a backslash at end of input, and the empty word. The fragment is selected for release notes: one apostrophe saved through LuCI made a whole config unreadable. * fix(start-wrt): write a dangling UCI end-of-file escape in libuci quoting A file that ends in an unmatched backslash lexes as a token whose raw text ends in that backslash. Written back unchanged, the newline the dump adds after it became a line continuation, so an option appended to that section joined the previous value and the saved file failed with too many arguments. Display now re-quotes the decoded value when the raw text ends in a dangling escape, including a backslash before a bare carriage return. Found by review on #4602. * feat(start-wrt): show what a page cannot represent in place of its settings A hand edit or a LuCI change StartWRT cannot represent made the affected page fail with a red toast every five seconds, show wrong values, or overwrite the change on save, and two boot repairs acted on settings they could not read. config.check reads ddns, dhcp, firewall, network, startwrt and wireless and reports each finding with its file, one-based line, section, option and value, and the pages it affects: - a file that does not parse, for every page that reads it; - a section that fails its typed read, for the pages whose requests read it (interfaces, devices, bridge VLANs, wifi devices and interfaces, the LAN and profile DHCP sections, zones, forwardings, profiles); - values a page reads but cannot show or keep: a WAN or WAN6 protocol the WAN page has no mode for, a LAN or profile interface that is not static, an RA or DHCPv6 mode other than server/disabled, a DHCP section set to ignore, a second access point on a radio, a non-AP, disabled or non-LAN Wi-Fi interface, encryption other than psk2/none, a lease with several MACs; - sections a page requires: br-lan, lan, wan, the wan zone, and each profile's interface; - as a notice rather than a block, the entries after the first of a `list ipaddr` or `list ip6addr`, which the page reads past and a save leaves in place. The shell shows CustomConfig in place of a page with blocking findings, with a link to LuCI and a recheck, and ConfigNotices above a page with notices. FormService hands a load error from configuration StartWRT cannot read or model to the same page instead of toasting it on every poll. Forms StartWRT can read without loss are read rather than flagged. A `Vec` field reads an `option` line as its whitespace-separated words, so `option proto 'udp'` on a LuCI rule no longer reads as every protocol in the reserved-port and inbound checks. `#[uci(accept_list)]` reads the first item of a `list` and a write replaces that item and keeps the rest; it now covers DhcpHost.mac, NetworkInterface.ipaddr and ip6addr. ipaddr is an Ipv4Address that keeps a prefix length, with ipv4() and ipv4_netmask() giving callers the address and the mask the prefix implies. uciedit tokens keep their file line, typed-read errors name the option and value they could not read, MissingOption and ExpectedSectionType point at the section header, ConfigBytes keeps the line when it adds the file name, and parse_each parses files independently. heal_ipv6_state now acts only on a dhcp.lan in the off state StartWRT writes, so an unreadable section or a LuCI relay no longer turns IPv6 off at boot, and bootstrap_admin_profile no longer appends a second Admin profile when the existing one fails its typed read. Refs #3678, #4607 * Proposed changes for #4611 Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol * fix(uciedit): propose preserving only effective list entries Helix-Harness: pi Helix-Model: openai-codex/gpt-6.1-sol * fix(start-wrt): note and locate only the addresses libuci keeps An `option ipaddr` replaces every earlier `ipaddr` line, and typed writes now discard those lines. The second-address notice still took the first `list` item whenever an `option` was present, so it could name an address the option overrides, and the non-/24 mask finding pointed at the first `option ipaddr` rather than the last one the typed reader keeps. Both now use the values libuci ends with. * docs(start-wrt): describe accept_list writes as libuci resolves them A typed write now drops the lines a later `option` overrides, so the attribute's docs and the ipaddr/ip6addr field comments no longer keep "the rest" as written. * fix(start-wrt): describe the profile firewall naming migration #4604 added NameProfileFirewallSections and #4608 added Migration::purpose without it, so master's startwrt-core no longer compiled. Helix-Harness: claude-code Helix-Model: claude-opus-5-5 Helix-Identity: helix-b --------- Co-authored-by: helix-a <267227783+helix-a@users.noreply.github.com>


Fills the Activity log gaps listed in #4430. Removing a reservation is left to #4466, which rewrites the same handler; this PR covers the rest of the issue. The follow-up about updates erasing the log is #4606.
What changes
auth.login): successful and failed sign-ins name the client's address and the network it came from (a profile, the inbound VPN, WAN, or this router). They also say whether the client was a browser, or name the client otherwise, e.g.curl/8.x. Example: "Login failed from <address> (Guest profile) using a browser".LoginContext::login_attempt_hook, which the signature middleware calls after every correctly signed login with the peer address and user agent. Logins relayed through the SNI demux report their real client.system.boot): one entry per boot with version and short hash, logged on the daemon's first start in that boot. The cause comes from a run-state file in/var/lib/startwrtthat the daemon keeps up to date. Possible causes: clean shutdown, power loss or crash, restart from StartWRT, restoring a backup, and firmware update (the pending-update marker overrides the others).system.migrate): the migration runner logs the changes it made in plain English, e.g. "Updated settings for v1.4.0 to serve each reserved device's name only within its own profile". When a migration fails, the entry names the step that failed.auth.ssh): alogread -ffollower logs each dropbear session when it authenticates and again when it ends.authorized_keyscomment, or its SHA256 fingerprint when there is no comment; the closing entry gives the session's duration.device.updated): entries say "name assigned", "renamed from 'old'" or "cleared name 'old'".dns_injection_requestedindevices.list.minorchangelog fragment.Verification
make start-wrt-test: 823 + 21 + 0 passed.make start-core-test: 33 + 1240 + 3 passed, 0 failed. This includeslogin_attempts_carry_their_peer_and_outcome.check:wrt,check:i18n:wrtandbuild:wrtpass.rebootgives "after a clean shutdown".system.restartgives "after a restart from StartWRT".reboot -fgives "after a power loss or crash".backup.restorethrough the RPC upload gives "after restoring a backup".dns_injection_requestedgoes on and off as permission is granted and revoked.bench.sh smokepasses before and after a reboot.