Repository navigation
Offer Change keys in the desktop app's server - #702
Conversation
6224b01 to
3a43676
Compare
3a43676 to
6dffd7a
Compare
6dffd7a to
12b1242
Compare
12b1242 to
5b8d1f7
Compare
|
@jserv The two The one red lane is |
A server the desktop app starts as its child gets no Change keys: the code it asks for is made in run_web and printed to a terminal the desktop user never sees, so SetupContext is left out for a child. A child now takes its code from CODETRIAL_CHANGE_KEYS_CODE, ignoring one shorter than 24 letters and digits, and does not print it. A launch from a terminal still makes and prints its own code, and a child given none still gets no Change keys. The desktop side of sysprog21#687 follows. Change-Id: I1044d348f980a97067c591b093d56fae42984e55
The desktop app starts the server as its child and hands it the Change keys code in the environment. Nothing ran that path: the unit tests pass the code into finish, and no CLI test started a child with one. The test starts the binary as the desktop app does, with CODETRIAL_EXIT_WITH_STDIN and the code set, checks that a wrong code is refused and the handed one rewrites the config, and that the code never reaches stdout, which the app writes to a log file. Change-Id: Iea6ba45fe95672c2ebcbca63ca268793b316d288
Keys entered at the desktop app's first Setup could not be changed afterwards without editing the config file by hand, because its server had no Change keys code anyone could read. The app now makes a code on every launch and hands it to the server in CODETRIAL_CHANGE_KEYS_CODE. With the interview in its window, it fills the code into the server's own /setup page; with the interview in the default browser, where it cannot fill a field, its start page shows the code instead. The code never travels in a URL. A save takes effect at the next launch; restarting the server on it is sysprog21#688. Close sysprog21#687 Change-Id: If3fc34eae7782ba7a867489f52fdca74f7ee7e34
|
Some review comments on this pull request are not settled yet. Please refine the change per the review comments listed below, reply on each thread with what you changed or why you did not, and mark each thread resolved yourself once it is settled (Resolve conversation, at the bottom of the thread). The pull request stays blocked while review threads are open. Not addressed at the current head:
Checked at 5b8d1f7. |
5b8d1f7 to
90af116
Compare
|
Thank @Patriciaath999 for contributing! |
The desktop app's server offered no Change keys: #528 asks for a code printed only to the terminal that started the server, and the desktop app's child has none. This is part 1 of #564, scoped on #687.
The app makes a 32-hex-digit code from the OS generator on every launch and hands it to its child in
CODETRIAL_CHANGE_KEYS_CODE.run_webreads it throughcodetrial::handed_change_keys_code, besideexit_when_stdin_closes, where it decides the server is a child, and carries it inLaunchedBy::Parent, sofinishbuildsSetupContextfrom it and never prints it; a value shorter than 24 letters and digits counts as absent, so a careless launcher gets no Change keys instead of a weak code. A launch from a terminal still makes and prints its own code, and the loopback andtrusted_proxy_hops == 0conditions are unchanged.The code reaches the person in the app's own window and never in a URL:
Which page gets the code is decided by
navigation::change_keys_code_for, built onjudge:/setuppage when it finishes loading. The page enables the field itself once/api/setupanswers and keeps the value, so the field appears filled.A save takes effect at the next launch; restarting the server on it is #688.
docs/desktop.mdlists the new variable with the other launcher options, the README's configuration table has a row for it, and the Setup page's hint under the code field now names the desktop app as well as the terminal.The two launcher-environment parsers moved to
tests/config/launcher.rs:tests/config.rswas at its 1500-line ceiling.Validation:
scripts/test.sh rustin WSL, the lane CI runs asgates (rust), passed at 90af116: lib 2115, web 227, cli 67, desktop 12 (Unix-only tests included), config 58. Among them: which loaded URLs get the code indesktop/tests/unit/navigation.rs;finishwith and without a handed code intests/unit/bin.rs; the binary started as the desktop app starts it refusing a wrong code, saving with the handed one and never printing it;binary_web_reads_deployment_keys_from_the_config_filefinding nostd::env::varinrun_web; and a code of exactly 24 letters and digits accepted, which fails if the bound is raised. Not run there: 3 browser tests (no Playwright locally) andcargo-deny.cargo test --bins --test '*', desktopcargo test,cargo fmt --checkfor both crates, clippy andscripts/check-rust-style.py./codetrial-reviewon 90af116 against 2021548 reported no P0 to P2 finding. Two P3 notes stay as they are: after a save the Setup page still says to restart the server, which the restart in Restart the desktop server after Change keys saves #688 replaces; and the app now refuses to start if the OS random generator fails.Overlaps: #561 adds a module next to the one added in
tests/config.rs, and #584 editssrc/launch.rsnearfinishandtests/unit/web/setup_edit.rsnear the same test helper; whichever merges second rebases, with no shared lines changed.Close #687