Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## pr/standalone-password-change #1434 +/- ##
=================================================================
+ Coverage 64.16% 64.65% +0.48%
=================================================================
Files 164 166 +2
Lines 13812 13924 +112
=================================================================
+ Hits 8863 9003 +140
+ Misses 4949 4921 -28 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
e0c4b08 to
d003178
Compare
a2c42f1 to
e4c70bd
Compare
e4c70bd to
686306c
Compare
c740e74 to
f7f1d05
Compare
686306c to
127e52a
Compare
f7f1d05 to
6696226
Compare
127e52a to
50380a6
Compare
6696226 to
5a0df73
Compare
433f0c1 to
2fcc7aa
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Unsafe file replacement can expose the administrator-bootstrap token, while a bootstrap race can overwrite concurrent password changes and leave login credentials inconsistent with the keyring.
6 open issues
Hold the credentials lock throughout bootstrap recovery · New Create setup token files exclusively and fail closed on removal errors · New Use the configured TLS setting to build setup URLs · New Keep setup routes available after keyring configuration and restart · New Declare HTTP 201 as the setup endpoint's OpenAPI success status · New Document setup error responses with a code-bearing schema · New
What changed in this PR
Replaces terminal-based administrator setup with a loopback-only API for standalone keyring deployments, building on the authenticated password-change work.
Changes:
- Adds setup status and provisioning endpoints with a one-time token, credential validation, and keyring write verification.
- Integrates setup into startup and shares credential locking with login and password changes.
- Adds setup tests and OpenAPI declarations, and removes the terminal-input dependency.
| File | Description |
|---|---|
internal/entity/dto/v1/auth_setup.go |
Defines setup request and response types. |
internal/controller/openapi/tenant_test.go |
Exempts public setup routes from tenant headers. |
internal/controller/openapi/devices.go |
Declares setup endpoints in OpenAPI. |
internal/controller/openapi/devices_test.go |
Checks setup endpoint registration. |
internal/controller/httpapi/v1/login.go |
Reuses shared credential locking and keyring constants. |
internal/controller/httpapi/v1/login_test.go |
Updates password-change tests for shared types. |
internal/authsetup/manager.go |
Implements token lifecycle and credential provisioning. |
internal/authsetup/manager_test.go |
Tests provisioning, validation, rollback, and HTTP behavior. |
internal/authsetup/handler.go |
Exposes loopback-only setup handlers. |
internal/app/app.go |
Registers setup routes on the normal listener. |
go.sum |
Removes terminal dependency checksums. |
go.mod |
Removes the direct terminal dependency. |
config/config.go |
Derives the setup-token file path. |
cmd/app/secret_store.go |
Starts API-based setup instead of terminal prompts. |
cmd/app/main_test.go |
Replaces prompt tests with setup-service coverage. |
Review effort: Balanced
2fcc7aa to
321afb7
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Setup tokens can leak through tray logs and inherited Windows ACLs, enabling unauthorized administrator provisioning, while premature token replacement can invalidate pending setup.
6 open issues
Setup token is exposed in world-readable headless logs · New Concurrent tray launch can replace the active setup token · New Windows setup token file lacks owner-restricted ACLs · New Expired setup attempts are incorrectly reported as completed · New POSIX file-mode assertion fails on Windows · New Keep setup routes available after keyring configuration and restart
5 resolved since last review
Review effort: Balanced
1e409b8 to
03c0a73
Compare
e2acd49 to
321afb7
Compare
03c0a73 to
30689a7
Compare
db50ffc to
9669e35
Compare
30689a7 to
c03b687
Compare
c03b687 to
0dcbdc4
Compare
9669e35 to
e4b442e
Compare
0dcbdc4 to
e149975
Compare
e4b442e to
b2be741
Compare
Replace the terminal keyring prompt with a first-run setup page: - With AUTH_SECRET_BACKEND=keyring and no keyring entries, Console issues a one-time setup token (10-minute lifetime) and serves GET /api/v1/auth/setup/status and POST /api/v1/auth/setup on a separate HTTPS listener bound to 127.0.0.1; non-loopback peers or origins get 403 SETUP_LOCAL_ONLY. Setup stores the username and a PBKDF2 hash in the keyring and is single-use. - The token lives only in process memory and is never written to any file or log. - The browser and the tray "Open" action open the token-free /setup/redirect URL; that loopback-only endpoint redirects to /setup#<token>, so the token never appears in process arguments. - Headless (no embedded UI) startup on a terminal prints the setup URL with the token for copy/paste. When output is redirected it prints a token-free curl hint for /setup/redirect instead. Tray mode stays in the foreground while setup is pending. - Config backend, AUTH_DISABLED, and OIDC are unchanged. - Partial keyring state still fails closed. golang.org/x/term removed. Related: #1356 Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
b2be741 to
a217ff4
Compare


Summary
Replaces the terminal keyring prompt with a loopback first-run setup page. Stacked on #1433, so review only the top commit.
Scope
AUTH_SECRET_BACKEND=keyringand both keyring entries are missing, Console creates a single-use setup token valid for 10 minutes. It then starts a separate HTTPS listener bound to127.0.0.1(random port) that serves:GET /api/v1/auth/setup/statusPOST /api/v1/auth/setup(token,username,password,confirmPassword)GET /setup/redirect, which redirects to/setup#<token>Originthat is not loopback gets403 SETUP_LOCAL_ONLY.401, a weak password or mismatch400, and an already configured keyring409 SETUP_ALREADY_COMPLETED.cmd/appcreates oneauthsetup.Managerand the loopback listener;app.Runserves them. Restarting Console issues a new token.authsetup.Manager.Bootstrap):/setup/redirectURL, and the page clears the fragment withhistory.replaceState. Setup does not create a login session.noui):Headless setup URL (...): https://localhost:<port>/setup#<token>for manual copy and paste.golang.org/x/termis removed.Unchanged
AUTH_DISABLED, OIDC: no setup listener and no token.Testing notes
Prerequisites: a
nouibuild of this branch,AUTH_SECRET_BACKEND=keyring, and an unlocked keyring with nodevice-management-toolkitentries:1. Get the setup URL.
Headless setup URL ...: https://localhost:<port>/setup#<token>../console > console.log 2>&1). The log shows only the hint, with no token. Run thecurl ... %{redirect_url}command from the hint to get the same URL.2. Set up the shell.
SETUPis the URL's origin andTOKENis the part after#:3. Run the checks:
curl -sk "$SETUP/api/v1/auth/setup/status"{"setupRequired":true}printf '%s\n' nope "$U" "$P" "$P" | postINVALID_SETUP_TOKENprintf '%s\n' "$TOKEN" "$U" weak weak | postINVALID_CREDENTIALSprintf '%s\n' "$TOKEN" "$U" "$P" "$P" | post{"status":"configured"}SETUP_ALREADY_COMPLETED(single use){"setupRequired":false}POST /api/v1/authorize) with the new credentialssecret-tool lookup service device-management-toolkit username admin-password-hash$pbkdf2-sha256$Afterwards:
unset TOKEN P.4. Check that the token is not stored. In redirected mode, after stopping Console:
5. Check the edge cases:
127.0.0.1). A loopback request withOrigin: https://evil.examplegets 403SETUP_LOCAL_ONLY.admin-password-hashand restart; Console exits with the partial-credentials error.AUTH_SECRET_BACKEND=config, there is no setup listener and no setup log line.nouibuild): the browser opens/setup/redirect, lands on/setup, and the token disappears from the address bar.Unit tests:
go test -race -count=1 ./internal/authsetup ./internal/app ./cmd/app ./internal/controller/httpapi/... ./pkg/httpserverValidation
gofumpt -extra,go vet ./...,go test -race -count=1 ./...andgolangci-lintwith the CI config all pass. Thetrayandtray,nouibuilds compile.redirect_urlhint, and the config backend. The keyring runs continued through password change (feat(auth): keyring standalone password change #1433) and a restart.Known limitations
/setup/redirectduring the 10-minute window; access is limited to loopback.Related: #1356