Repository navigation
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1364 +/- ##
==========================================
+ Coverage 64.07% 64.16% +0.08%
==========================================
Files 163 167 +4
Lines 13737 14276 +539
==========================================
+ Hits 8802 9160 +358
- Misses 4935 5116 +181 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ab4a0f4 to
7ec1430
Compare
a294d6b to
2fe8b43
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Password updates are unsynchronized with logins and concurrent changes, risking data races and inconsistent credentials, while config-mode verification and environment-managed password persistence also have unresolved defects.
4 open issues
What changed in this PR
Adds an authenticated password-change API for standalone Console administrators, supporting the credential-management workflow in #1356.
Changes:
- Adds current-password verification, confirmation and strength checks, and backend-specific password storage.
- Shares password-strength validation with first-run setup and adds authentication and UI-route tests.
- Documents password changes and forgotten-password recovery by deleting both administrator keyring entries.
| File | Description |
|---|---|
README.md |
Links to administrator password-management guidance. |
pkg/secrets/password.go |
Adds shared, Unicode-aware password-strength validation. |
pkg/secrets/password_test.go |
Tests password length and character diversity. |
internal/controller/httpapi/v1/login.go |
Implements password validation and backend-specific saving. |
internal/controller/httpapi/v1/login_test.go |
Tests authentication, validation, and backend-specific behavior. |
internal/controller/httpapi/ui_test.go |
Checks that /account/password serves the UI shell. |
internal/controller/httpapi/router.go |
Registers the protected endpoint for standalone authentication. |
docs/standalone-authentication.md |
Documents password changes and manual keyring recovery. |
cmd/app/secret_store.go |
Reuses shared password-strength validation during setup. |
Review effort: Balanced
c4b52b7 to
5320c1f
Compare
1b0368c to
454763b
Compare
5320c1f to
a9363b3
Compare
454763b to
960a47c
Compare
a9363b3 to
4907fbe
Compare
960a47c to
f684f77
Compare
4907fbe to
4703293
Compare
f684f77 to
885e261
Compare
1b3cf3c to
f7bff0e
Compare
885e261 to
cfe0842
Compare
f7bff0e to
b9ecdd0
Compare
cfe0842 to
4b6217a
Compare
b9ecdd0 to
e3012ce
Compare
4b6217a to
89d6cb4
Compare
89d6cb4 to
0eda42c
Compare
fe6b466 to
9b8d014
Compare
9f38364 to
613e8f1
Compare
7ef62f6 to
6a8f035
Compare
613e8f1 to
7332423
Compare
0ad946f to
229e90a
Compare
7feec1e to
375e499
Compare
e52a966 to
b5cf24b
Compare
There was a problem hiding this comment.
🟡 Changes recommended
Test packages cannot compile, and the setup redirect exposes the token to other local OS users, allowing them to set administrator credentials.
7 open issues
Fix embedded Auth fields in test composite literals · New Prevent unauthenticated local disclosure of the setup token · New Wire the browser setup route to secure token transfer · New Synchronize credential-cache updates during setup status checks · New Protect setup-token reads and writes from data races · New Account for outstanding redirection tokens after password rotation · New Use the correct keyring service name during recovery · New
9 resolved since last review
Bind JWTs to credentials to revoke them after recovery Prevent rollback from overwriting a later password change Resolve auth-state paths before building SQLite file URIs Serialize TLS certificate generation across server listeners Avoid exposing setup tokens in process arguments Initialize and restore singleton config in the test Verify passwords outside the auth-state database transaction Log the token-free setup URL for headless installations Route the tray Open action to the setup page
Review effort: Balanced
3c594ca to
38cfd35
Compare
38cfd35 to
7887ddf
Compare
7887ddf to
3c594ca
Compare
0aaa23a to
254a224
Compare
f354e97 to
e996a11
Compare
Add POST /api/v1/authorize/password for AUTH_SECRET_BACKEND=keyring with the #1364 password-change behaviour: - Registered only for standalone keyring auth. The config backend, AUTH_DISABLED and OIDC keep their existing routes, login, and token claims, and create no auth-state file. - Verifies the current password, confirmation, and the shared admin password policy (pkg/secrets.IsStrongAdminPassword, also used by the CLI); rejects reuse of the current password; stores a PBKDF2 hash. - Revokes every earlier session: keyring-mode tokens carry a durable auth_version (SQLite auth-state DB next to config.yml) and an HMAC tag of the stored credential, both checked on each protected request. A failed revocation rolls the credential back. - Login and password change share one credential lock; credentials are read live from the keyring, so the handler no longer rewrites the shared config (which raced with concurrent logins). - OpenAPI, Postman, and docs updated. Related: #1356 Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>
Replace the terminal keyring prompt with the #1364 first-run flow: - 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 writes the username and a PBKDF2 hash, verifies the write, and rolls back on failure. - The token lives only in process memory and is never written to any file: not to a token file, the auth-state DB, or a log file. cmd/app and app.Run share one authsetup.Manager. - 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 or the tray lock file. - Headless (no embedded UI) startup on a terminal prints the setup URL with the token for copy/paste, as in #1364. 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: no setup listener and no auth-state file. - Partial keyring state still fails closed. golang.org/x/term removed. Related: #1356 Signed-off-by: Nabendu Maiti <nabendu.bikash.maiti@intel.com>



Summary
Add a protected Console API flow for changing standalone administrator credentials, plus the ADR Phase 2 first-run setup service for keyring deployments. The caller must be authenticated and provide the current password before a new one is saved to the configured backend.
Changes
POST /api/v1/authorize/password).GET /api/v1/auth/setup/status,POST /api/v1/auth/setup) on a loopback-only TLS listener with a one-time, file-backed setup token.Testing for reviewers
-kis only for the default self-signed certificate. Replaceadmin/Current-Pass1with your values.Password change (any backend, signed-in session)
First-run setup (
AUTH_SECRET_BACKEND=keyring, nodevice-management-toolkitkeyring entries)Verify the stored value is a hash, not the password (Linux example):
secret-tool lookup service device-management-toolkit username admin-password-hash # starts with $pbkdf2$Validation
Fixes: #1356