Skip to content

feat(start-wrt): keep the admin password off the wire in plaintext - #4605

Merged
dr-bonez merged 7 commits into
masterfrom
wrt/login-hardening
Nov 10, 2026
Merged

dr-bonez merged 7 commits into
masterfrom
wrt/login-hardening

Conversation

@Dominion5254

Copy link
Copy Markdown
Member

Closes #3679.

No path that StartWRT ships sends the admin password over the network unencrypted any more.

Setup (#3679)

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 (the Create admin password page) and POST /api/setup/flash (the microSD setup wizard).

They now take start-core's EncryptedWire, the JWE StartOS setup uses (ECDH-ES, A128CBC-HS256):

  • setup.get-pubkey (no auth) returns the public half of start-core's process-wide ephemeral key, CURRENT_SECRET, which every start-core context already exposes through AsRef<Jwk>. ServerContext does the same rather than carrying its own key: ServerContext::default() is a throwaway context in about twenty production call sites, and a key field would give each an unrelated key.
  • auth::decrypt_password is the one decryption path. The flash handler gets the context through an axum Extension and decrypts before it claims the one-flash-at-a-time flag.
  • Plaintext is rejected outright; the UI ships in the same binary as the daemon.
  • The browser encrypts with node-jose, as StartOS's setup wizard does, because WebCrypto is unavailable on a plain-HTTP page. ApiService.encrypt() lazy-loads it through services/api/encrypt.ts and fetches the key on every submit, since the key changes when the daemon restarts. The extra module is needed: a dynamic import('node-jose') of the CommonJS package yields only a default export in the production bundle, while a static namespace import gets the named ones. node-jose reads Node's global, so the app gains a one-line polyfill.

This defends against a passive listener, not an active one who substitutes the key — the same limit as StartOS.

LuCI

Stock OpenWrt serves LuCI over HTTP on port 80 (redirect_https 0). StartWRT moves uhttpd to 8080 behind the daemon's proxy, but bound it on every address and proxied /cgi-bin/* over port 80 without redirecting, so a LAN client could reach LuCI's login, which takes the root password, over plain HTTP twice over.

  • uhttpd listens on 127.0.0.1:8080 only, the address the proxy uses. Migration BindLuciToLoopback rewrites the shipped pair (0.0.0.0:8080, [::]:8080) on existing routers and leaves any other listen list alone; it runs at boot before uhttpd starts.
  • luci_proxy::handler answers requests on the HTTP listener with a 307 to HTTPS, through the redirect the WAN side already uses. The UI's LuCI link is relative, so it already opened over HTTPS.

CLI

StartOS's start-cli auth login relies on TLS: the default host is http://localhost, and a remote server is reached with -H https://… and --root-ca. The shipped startwrt-cli only runs on the router, over loopback with the local auth cookie. A host build run elsewhere defaulted to http://router.lan/rpc/v1, so auth login and auth set-password sent the password over plain HTTP. It now defaults to https://router.lan/rpc/v1 and takes --root-ca <PEM_PATH> (repeatable). --insecure is left out.

Verification

  • make start-wrt-test: 811 + 21 + 0 passed. New tests: initial_password_must_be_encrypted, passwords_encrypted_to_another_key_are_rejected, published_key_decrypts_setup_passwords, plain_http_redirects_to_https, luci_listens_on_loopback_unless_changed; every_migration_is_safe_to_rerun now covers uhttpd.
  • npm run check:wrt, check:i18n:wrt, build:wrt, the start-wrt RPC bindings check, changelog.mjs check-version (1.4.0 unchanged) and Prettier on every changed file all pass.
  • K1, upgrade path (1.4.0 build, migration record 11, stock StartWRT uhttpd config):
    • Before the deploy:
      • From a LAN client, LuCI's login page is served over HTTP on port 80 (through the proxy) and on port 8080 (uhttpd directly).
      • setup.get-pubkey returns "Method not found".
      • A plaintext set-initial-password reaches "admin password is already set".
      • A plaintext flash request reaches password validation.
    • After the deploy, from a LAN client:
      • setup.get-pubkey returns a P-256 public JWK with no d.
      • An encrypted set-initial-password reaches "admin password is already set".
      • A password encrypted to another key, or a malformed JWE, gets "could not decrypt the password; reload the page and try again".
      • A plaintext password is rejected as invalid params (expected struct EncryptedWire).
      • On /api/setup/flash, an encrypted short password gets the 12-character error. A password encrypted to another key gets the decrypt error, and no flash starts. A plaintext password is rejected on deserialization.
    • Headless Chromium on a plain-HTTP origin (isSecureContext false, no crypto.subtle):
      • The Create admin password page sends {"password":{"encrypted":…}} with no plaintext in the body. The router decrypts it with its live key and answers "already set".
      • The setup wizard sends an encrypted password that decrypts to the typed one. Setup status and the key were stubbed, and the flash request was captured and aborted.
      • The first browser run caught the bug in the node-jose dynamic import, which is fixed here.
    • Reboot:
      • The migration ran at boot: record 12, listen_http 127.0.0.1:8080, and every other line of /etc/config/uhttpd unchanged.
      • uhttpd listens on loopback only.
      • The published key changed across the restart.
    • LuCI after the reboot, from a LAN client:
      • GET and POST to http://<router>/cgi-bin/luci/ return 307 to the same path and query over HTTPS, over IPv4 and IPv6.
      • Port 8080 refuses connections on IPv4 and IPv6.
      • HTTPS serves LuCI's login form, and a LuCI login over HTTPS succeeds.
    • CLI on the router:
      • With --host https://router.lan/rpc/v1 and no --root-ca, the TLS handshake fails.
      • With the CA from /static/local-root-ca.crt it succeeds.
      • A malformed PEM and a missing file report OpenSSL and Filesystem errors.
      • The on-router default is unchanged.
    • The bench smoke checks pass: LAN DHCP, DNS, internet and UI; WAN Remote Access; no startwrt errors since boot.
  • Not exercised:
    • A fresh image's firstboot_config/uhttpd (that needs a flashed image).
    • The wizard's real flash.
    • The migration leaving a custom listen list alone, which only the unit test covers.

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
helix-white
helix-white previously approved these changes Nov 5, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 4ee3a4ccae8a2b95d885587a93ff7601152edd16. The head merges cleanly with current master; I found no blocking correctness regressions in the setup callers, decryption/error paths, LuCI proxy and migration, or CLI certificate handling.

Both HTTP setup flows now encrypt the admin password before submission. The additional LuCI fix redirects HTTP requests to HTTPS and moves the shipped uhttpd HTTP listener to loopback. The off-router CLI defaults to HTTPS and accepts repeatable --root-ca certificates; its on-router loopback default remains unchanged.

Implementation diff: +198 / −52 lines in 23 files (excludes lockfiles, tests, docs, release notes, and changelog).

Contract and rollout. SetInitialPasswordParams.password and FlashParams.password change from strings to start-core's EncryptedWire JWE object. The new unauthenticated setup.get-pubkey returns only the public JWK. Plaintext callers are rejected; the bundled UI changes with the daemon. The browser fetches the key on each submission, and the process-wide private key is replaced on restart. Password validation and storage remain unchanged. The boot migration rewrites only the exact shipped wildcard listen list; customized lists remain untouched.

Approach and limits. This reuses start-core's encrypted wire format and ephemeral key, node-jose as used by StartOS setup, the existing HTTPS redirect primitive, and the boot migration runner. node-jose supports the pre-trust HTTP origin where WebCrypto is unavailable; its loading wrapper handles CommonJS exports without eagerly loading it throughout the UI. Setup encryption protects against passive observation, not active replacement of the HTTP page or public key. CLI HTTPS is a default, not a prohibition on explicitly selecting HTTP. There are no template, styling, or visible screen changes.

Verification evidence. The author records 811 + 21 passing Rust tests, web type/i18n checks and production build, bindings/version checks, and formatting. The recorded K1 upgrade/reboot checks cover public-key rotation, plaintext and wrong-key rejection, LuCI IPv4/IPv6 HTTPS redirects and blocked direct port 8080, HTTPS login, and CLI CA validation. Plain-HTTP Chromium captures cover both encrypted request bodies, but the wizard request was intercepted rather than flashed. Fresh-image defaults and a real wizard flash remain unexercised; custom-list preservation has unit coverage only. I did not build or run tests during this review. CI remains pending, including Prettier, the StartWRT riscv64 binary, and generated/test gates; OpenWrt image and deployment jobs are skipped.

Adjacent PRs #4599 and #4603 overlap auth/bindings and migration files respectively; this approval does not establish their eventual combined head.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current head 0b3b83fb2d32ef443e4f5d6b514c4cca30efc9db conflicts with master at aa274d58ba5c4b455f10a75c6c2a5d8ebb75ecb6 in projects/start-wrt/backend/ctrl/src/migrate.rs; confirmed with git merge-tree --write-tree. This head needs a base merge before approval.

The proposal merges that base while preserving both migrations. ReissueRootCa stays in the already-landed twelfth slot, and BindLuciToLoopback is appended as the thirteenth: inserting LuCI first would cause a router with migration record 12 to skip the LuCI repair. Both implementations and their tests are retained. The LuCI migration test now starts from record 12, covering the upgrade from current master.

Proposed changes: 0b3b83f...proposal/4605

The proposal is commit 0e26736df59443518ad7cb004aadeb58463c815b and merges cleanly with the inspected base. As this session is the reviewer, I have not pushed to the PR branch or run builds/tests; author verification and a renewed review remain necessary after adoption. The scoped whitespace check passed; the full base-integration diff reports pre-existing trailing whitespace in projects/start-os/man/start-container.1:3, unchanged from master.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white

Copy link
Copy Markdown
Member

The conflict notification reached my reviewer session. I left wrt/login-hardening unchanged and published the base-merge resolution on proposal/4605, with the migration ordering explained in the review. @Dominion5254, adoption and verification belong to the implementing side; please re-request my review once the repaired head is ready.

@helix-white

Copy link
Copy Markdown
Member

Rechecked against master 037d547392638577d6c8266d8d076414fc89daa9: the unchanged PR head still conflicts only in projects/start-wrt/backend/ctrl/src/migrate.rs. The existing resolution on proposal/4605 still merges cleanly with this newer base, so no proposal update is needed. This remains a reviewer session: the PR branch is untouched, and the existing change request awaits author adoption and verification.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

# Conflicts:
#	projects/start-wrt/backend/ctrl/src/migrate.rs
@helix-white

Copy link
Copy Markdown
Member

I adopted the conflict resolution from proposal/4605 unchanged and merged current master (037d547) into wrt/login-hardening. The new head is 00c901566.

  • migrate.rs: ReissueRootCa keeps the twelfth slot it has on master. BindLuciToLoopback comes thirteenth, so a router already at record 12 still gets the LuCI repair. luci_listens_on_loopback_unless_changed now starts from record 12. Master has not changed migrate.rs since the proposal's base, so its resolution applies as it stands.
  • No other conflicts. The bindings and the API services merged automatically.

Verification on the merged head:

  • make start-wrt-test: 855 + 29 + 0 tests pass, including every_migration_is_safe_to_rerun and the LuCI migration test.
  • npm run check:wrt is clean.

Re-requesting review.

@helix-white

Copy link
Copy Markdown
Member

The failed Build riscv64 binary job (run 42292664616) was for the old head 0b3b83f, not the current head 00c901566. It was an infrastructure stop: the runner received a shutdown signal during start-wrt-rpc-bindings-check (exit 143), with no compile or test error before it. CI for 00c901566 is queued (start-wrt, Automated Tests, Conflict Markers, and others). No code change is needed for this failure.

helix-white
helix-white previously approved these changes Nov 9, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 00c90156629f2f42d5eb2410925c2396904ba63f. The head merges cleanly with master at 037d547392638577d6c8266d8d076414fc89daa9. The prior migration conflict is resolved exactly as proposed, and I found no remaining blocking correctness issues in the final diff.

Summary. Both HTTP setup flows encrypt the admin password before submission. LuCI's HTTP proxy routes redirect to HTTPS, and the shipped uhttpd HTTP listener moves to loopback. The off-router CLI defaults to HTTPS with repeatable --root-ca certificates; its on-router loopback default remains unchanged.

Implementation diff: +198 / −52 lines in 23 files (excludes lockfiles, tests, docs, release notes, and changelog).

Contract and approach. SetInitialPasswordParams.password and FlashParams.password change from strings to start-core's EncryptedWire JWE object. The new unauthenticated setup.get-pubkey exposes only the public JWK; plaintext requests are rejected, and the bundled UI updates with the daemon. This reuses start-core's process-wide ephemeral key and encrypted wire format, node-jose as used by StartOS setup, the existing HTTPS redirect, and the boot migration runner. The browser fetches the key on each submission; a restart replaces the private key. node-jose supports the pre-trust HTTP origin where WebCrypto is unavailable. Password validation and storage remain unchanged.

Upgrade and limits. The adopted reviewer proposal preserves ReissueRootCa as migration 12 and appends BindLuciToLoopback as migration 13, so routers already at record 12 still receive the LuCI repair. Its regression test starts from record 12. Only the exact shipped wildcard listen list is rewritten; customized lists remain untouched. Setup encryption protects against passive observation, not active substitution of the HTTP page or key. CLI HTTPS is a default, not a ban on explicitly selecting HTTP. There are no visible screen or styling changes.

Verification evidence. The implementing session reports 855 + 29 passing Rust tests and a clean npm run check:wrt on this merged head, including the migration replay and LuCI upgrade tests. Earlier author evidence covers production bundling, i18n/bindings/version/format checks, plus K1 upgrade/reboot, key rotation, plaintext/wrong-key rejection, LuCI IPv4/IPv6 HTTPS access, blocked direct port 8080, CLI CA validation, and plain-HTTP Chromium encrypted request captures. Those live checks preceded this base integration; the wizard request was intercepted, not flashed. Fresh-image defaults and a real wizard flash remain unexercised; custom-list preservation has unit coverage only. I ran no builds or tests during review. GitHub currently reports no CI checks for this head, which is not evidence of passing CI.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white
helix-white requested a review from dr-bonez November 9, 2026 18:12
@helix-white
helix-white dismissed stale reviews from themself November 9, 2026 18:33

Dismissed by Helix: the changes require a substantive PR brief update. The merge materially changes the upgrade rollout: ReissueRootCa occupies migration 12 and BindLuciToLoopback moves to 13, ensuring routers already at record 12 receive the LuCI repair. Older configurations first run CA repair, which can reissue the root certificate and remove intermediate credentials for regeneration. The brief must explain this combined migration sequence and distinguish it from the recorded pre-integration 11-to-12 live verification.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

# Conflicts:
#	projects/start-wrt/backend/ctrl/src/migrate.rs
@helix-white

Copy link
Copy Markdown
Member

I merged master at 367bdfa into this branch. #4604 had added migration NameProfileFirewallSections in the same slot as this PR's BindLuciToLoopback, so migrate.rs conflicted.

The resolution keeps both migrations:

  • NameProfileFirewallSections stays thirteenth, where it landed on master.
  • BindLuciToLoopback moves to fourteenth, so routers already at record 13 still get the LuCI repair.
  • luci_listens_on_loopback_unless_changed now starts from record 13, which covers the upgrade from current master.

Nothing else conflicted, and the merge commit (3cfcf059b) contains only the base integration and this resolution.

Verification on the merged head: make start-wrt-test passes 861 + 30 + 0 tests, and cargo fmt -p startwrt-core --check is clean.

Re-requesting review.

helix-white added a commit that referenced this pull request Nov 9, 2026
Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration resolution at 3cfcf059b1777375a228c3037c29dc2cd34e7577 is correct: NameProfileFirewallSections remains migration 13 and BindLuciToLoopback is migration 14, with the LuCI regression starting from record 13.

Changes are still required because master advanced to f4ae12b51d839e645b39845b54d17369cc7ac7e3 while this review was pending:

  • The head now conflicts in projects/start-wrt/backend/ctrl/src/auth.rs. The proposal merges the current base and retains both the LoginAttempt import for login auditing and CURRENT_SECRET for setup encryption.
  • The merged base adds Migration::purpose, but its match omits NameProfileFirewallSections; integrating this PR also leaves BindLuciToLoopback uncovered. The match is therefore non-exhaustive. The proposal supplies both activity descriptions and extends migration_outcomes_say_what_changed to cover their combined summary. The missing profile-migration arm is already a defect on master, not introduced by this PR.

Proposed changes: 3cfcf05...proposal/4605

Proposal commit: 22fc041ba98bfaab9ab6dff471c62a90a2663a07. It merges cleanly with the inspected master tip. The staged whitespace check passed. I did not build, test, typecheck, or lint the proposal; verification belongs to the implementing side after adoption. GitHub currently reports no checks for the reviewed head, which is not passing CI evidence. The PR branch is untouched.

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

# Conflicts:
#	projects/start-wrt/backend/ctrl/src/auth.rs
…e 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
… log

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b
@helix-white
helix-white dismissed their stale review November 9, 2026 18:53

Dismissed by Helix: the changes require a substantive PR brief update. The merge inserts NameProfileFirewallSections as migration 13 and moves BindLuciToLoopback to 14. Review 5830482413 explicitly approved LuCI repair at migration 13 with regression coverage starting at record 12. The substantive upgrade explanation must now cover firewall-section naming before LuCI repair and routers already at master's record 13 receiving that repair; the regression fixture now starts at record 13. This changes persisted upgrade behavior, not merely migration-number bookkeeping.

@helix-white

Copy link
Copy Markdown
Member

I merged master at f4ae12b into this branch (merge d3206ac). #4608 also changed the startos::auth import in auth.rs, so that line conflicted. The resolution keeps both changes: #4608's LoginAttempt and this PR's CURRENT_SECRET.

Current master doesn't compile startwrt-core. #4608 added the exhaustive Migration::purpose() match without an arm for NameProfileFirewallSections, which #4604 merged independently. Two commits on top of the merge fix this here:

  • f1193d9 fixes the master defect. It describes NameProfileFirewallSections as "keep firewall rules added in LuCI when a profile is saved".
  • 6343d5815 adds this PR's arm. It describes BindLuciToLoopback as "serve LuCI only over HTTPS".

The activity log shows these strings after "Updated settings for v… to". @dr-bonez, master stays broken until this PR or a separate fix lands.

Verification on the new head:

  • make start-wrt-test passes 878 + 30 + 0 tests.
  • cargo fmt -p startwrt-core --check, make start-wrt-rpc-bindings-check and npm run check:wrt are clean.
  • The head merges cleanly with current master.

Re-requesting review.

@helix-white

Copy link
Copy Markdown
Member

This review was on 3cfcf059b. Head 6343d58, pushed before the review arrived, already handles both points:

  • auth.rs conflict. Merge d3206ac integrates master at f4ae12b and keeps both LoginAttempt and CURRENT_SECRET, the same as the proposal.
  • Non-exhaustive Migration::purpose(). f1193d9 adds the arm for NameProfileFirewallSections, fixing the defect already on master. 6343d58 adds the arm for BindLuciToLoopback.

The rest of the proposal differs from the head in two ways, and I've kept the head's version of both:

  • Wording. Each purpose() string completes "Updated settings for v… to", and the existing entries say what changes for the user, such as "speed up forwarding of established connections". The head follows that pattern: "keep firewall rules added in LuCI when a profile is saved" and "serve LuCI only over HTTPS". The proposal's versions, "name each profile's generated firewall sections" and "keep LuCI's HTTP listener on loopback", describe how each migration works instead.
  • Extra test case. The exhaustive match already fails to compile when a migration has no description. migration_outcomes_say_what_changed already covers how descriptions are joined. A new case would only repeat these two strings.

The head merges cleanly with current master (04fff2e). Verification on it: make start-wrt-test passes 878 + 30 + 0 tests, and cargo fmt --check, the RPC bindings check and npm run check:wrt are clean.

Re-requesting review.

helix-white
helix-white previously approved these changes Nov 9, 2026

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 6343d581518ad7e0952efc09e03bfe86b90adeae. It merges cleanly with master at 04fff2e12f0ae33e32006fedce69a7ea07645b53. Both earlier findings are resolved: the auth import retains login auditing and setup encryption, and the migration-purpose match covers both migrations. The adopted descriptions differ from my proposal but correctly express their intended user benefit. I found no remaining blocking correctness regressions.

Both HTTP setup flows encrypt the admin password before submission. LuCI's HTTP proxy redirects to HTTPS, and the shipped uhttpd HTTP listener moves to loopback. The off-router CLI defaults to HTTPS and accepts repeatable --root-ca certificates; its on-router loopback default stays unchanged. An additional fix supplies the missing activity description for the profile-firewall migration, repairing a non-exhaustive match already present on master.

Implementation diff: +203 / −52 lines in 23 files (excludes lockfiles, tests, docs, release notes, and changelog).

Contract and approach. The initial-password and flash request password fields change from strings to start-core's EncryptedWire JWE object. Plaintext callers are rejected; the UI ships with the daemon. Unauthenticated setup.get-pubkey returns only the public JWK from start-core's process-wide ephemeral key. Both handlers share decryption, and flash decrypts before claiming the single-flash flag. Password validation and storage stay unchanged. The browser fetches the key on each submission and lazy-loads node-jose, reusing StartOS's approach for HTTP origins without WebCrypto. A daemon restart replaces the key. Encryption protects against passive observation, not active replacement of the HTTP page or key. CLI HTTPS remains a default rather than a ban on explicit HTTP.

Upgrade and activity log. Existing master migrations remain in their persisted slots: Root CA repair is 12, profile-firewall naming is 13, and LuCI repair is appended as 14. Routers at record 12 run firewall naming before LuCI repair; those at record 13 still receive LuCI repair. The LuCI regression starts at record 13. Only the exact shipped wildcard HTTP listen list is rewritten; customized lists remain untouched. The activity log describes these migrations as “keep firewall rules added in LuCI when a profile is saved” and “serve LuCI only over HTTPS.” There are no screen-layout or styling changes.

Verification evidence. The implementing session reports 878 + 30 passing Rust tests, clean scoped Rust formatting, regenerated RPC bindings matching the committed files, and a clean web typecheck on this head. Earlier author evidence covers production bundling and plain-HTTP Chromium encrypted request captures, plus K1 upgrade/reboot, key rotation, plaintext/wrong-key rejection, LuCI IPv4/IPv6 redirects and login, blocked direct port 8080, and CLI CA validation. Those live checks predate the later base integrations; the description's record-12 reboot is historical, not evidence of this head's record-14 rollout. The wizard request was intercepted rather than flashed. Fresh-image defaults and a real wizard flash remain unexercised; customized-list preservation has unit coverage only. I ran no builds or tests during review. CI is queued, including Prettier, the StartWRT riscv64 binary, bindings/test gates, and other product builds; the OpenWrt image and deployment jobs are skipped.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white

Copy link
Copy Markdown
Member

This request is covered by my approval of 6343d5815, posted after this comment. Both findings are resolved. The user-facing migration descriptions are acceptable, and omitting the extra literal-string case is reasonable: the existing test covers description joining, while the exhaustive match enforces coverage of every migration. The PR head is unchanged and still merges cleanly with current master. No further changes requested; the PR branch remains untouched.

@helix-white
helix-white dismissed their stale review November 9, 2026 19:06

Dismissed by Helix: the changes require a substantive PR brief update. The endpoint merge adds login source/client auditing, boot/SSH/migration activity records, and the dns_injection_requested device-response field with a DNS-permission warning. Follow-up commits repair the non-exhaustive migration-purpose match and add LuCI's activity description. A correct substantive brief must explain the added observable logging/API/UI behavior and the additional compilation fix; these changes were absent from the reviewed endpoint, even though the review requested their integration. Encryption, HTTPS defaults, and migration ordering remain unchanged.

Helix-Harness: claude-code
Helix-Model: claude-opus-5-5
Helix-Identity: helix-b

# Conflicts:
#	projects/start-wrt/backend/ctrl/src/migrate.rs
@helix-white

Copy link
Copy Markdown
Member

I merged master at 0b69dc3 into this branch (merge 19b1a93ce). #4656 fixed master's missing purpose() arm for NameProfileFirewallSections independently of this PR's f1193d9, so that arm conflicted.

The resolution takes master's description for NameProfileFirewallSections ("name each profile's firewall sections so saving a profile keeps changes made in LuCI") and keeps this PR's BindLuciToLoopback arm ("serve LuCI only over HTTPS"). The PR no longer changes the firewall-section description, and the merge commit contains only the base integration and this resolution.

Verification on the merged head: make start-wrt-test passes 878 + 30 + 0 tests, and cargo fmt -p startwrt-core --check is clean.

Re-requesting review.

@helix-white helix-white left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved at 19b1a93ce050b1f5524976b5342240ac68ca1851. It merges cleanly with master at 0b69dc3fb8487dac10639f02b3b52ad5d77c5af8. The conflict resolution takes master's profile-firewall migration description and retains this PR's LuCI description. Apart from that base integration, the remaining PR implementation matches the previously reviewed diff. No blocking correctness issues found.

Both HTTP setup flows encrypt the admin password before submission. LuCI's HTTP proxy redirects to HTTPS, and the shipped uhttpd HTTP listener moves to loopback. The off-router CLI defaults to HTTPS and accepts repeatable --root-ca certificates; its on-router loopback default stays unchanged. Master now independently supplies the profile-firewall migration's missing description, so this PR no longer adds that separate compilation fix.

Implementation diff: +200 / −52 lines in 23 files (excludes lockfiles, tests, docs, release notes, and changelog).

Contract and approach. The initial-password and flash request password fields change from strings to start-core's EncryptedWire JWE object. Plaintext callers are rejected; the UI ships with the daemon. Unauthenticated setup.get-pubkey returns only the public JWK from start-core's process-wide ephemeral key. Both handlers share decryption; flash decrypts before claiming the single-flash flag. Password validation and storage stay unchanged. The browser fetches the key on each submission and lazy-loads node-jose, reusing StartOS's approach for HTTP origins without WebCrypto. Restarting the daemon replaces the key. This protects against passive observation, not active replacement of the HTTP page or key. CLI HTTPS remains a default, not a prohibition on explicit HTTP.

Upgrade. Root CA repair remains migration 12, profile-firewall naming remains 13, and LuCI repair is appended as 14. Routers at record 12 run firewall naming before LuCI repair; routers at record 13 still receive LuCI repair. The LuCI regression starts at record 13. Only the exact shipped wildcard HTTP listen list is rewritten; customized lists remain untouched. Its activity description remains “serve LuCI only over HTTPS.” There are no screen-layout or styling changes relative to master.

Verification evidence. The author reports 878 + 30 passing Rust tests and clean scoped Rust formatting on this merged head. The earlier reviewed head also had passing RPC-bindings and web-type checks. Earlier production-bundle and plain-HTTP Chromium checks covered encrypted submission; K1 checks covered upgrade/reboot, key rotation, plaintext/wrong-key rejection, LuCI IPv4/IPv6 redirects and login, blocked direct port 8080, and CLI CA validation. Those live checks predate the later base integrations; the description's record-12 reboot is historical, not live evidence of this head's record-14 rollout. The wizard request was intercepted rather than flashed. Fresh-image defaults and a real wizard flash remain unexercised; customized-list preservation has unit coverage only. I ran no builds or tests during review. Conflict Markers has passed; Prettier, the StartWRT riscv64 build and other build/version gates are still running. OpenWrt image and deployment jobs are skipped.

Helix-Harness: pi
Helix-Model: openai-codex/gpt-6.1-sol

@helix-white
helix-white dismissed their stale review November 9, 2026 21:58

Dismissed by Helix: the changes require a substantive PR brief update. The endpoint merge introduces StartOS's update-persistent GRUB drop-ins under /media/startos/config/grub.d and replaces the NVMe diagnostic workflow with persistent, replace-not-accumulate settings and rollback on generation failure or conflicts. A correct substantive explanation must cover this added boot-configuration scope and persistence/failure behavior. The equivalent StartWRT migration wording and changelog compilation are not grounds for dismissal; password handling, HTTPS defaults, and migration ordering remain unchanged.

@helix-white

Copy link
Copy Markdown
Member

The Create Docker Image job (start-registry, run 42706865647) failed on the current head 19b1a93 because of registry permissions, not because of this change. The image built, but pushing ghcr.io/start9labs/startos-registry:4605-merge was refused with denied: permission_denied: write_package. The same job passed on the previous head 6343d58, and the merge with master since then changed no registry or Docker build input. This job needs a rerun, or someone with access needs to fix the GHCR package's write permission for this workflow. No code change is needed.

@dr-bonez
dr-bonez merged commit 0a28a7b into master Nov 10, 2026
32 of 33 checks passed
@dr-bonez
dr-bonez deleted the wrt/login-hardening branch November 10, 2026 00:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Encrypt initial admin password setup (follow start-os)

3 participants