Skip to content

Web UI: remember passwordless logins and drop a stale autofilled password - #118638

Merged
alexey-milovidov merged 11 commits into
masterfrom
play-remember-passwordless-login
Oct 5, 2026
Merged

alexey-milovidov merged 11 commits into
masterfrom
play-remember-passwordless-login

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Sep 7, 2026 •

Copy link
Copy Markdown
Member

The Web UI (play.html) offers the login to the browser's password manager after each Run (navigator.credentials.store). The Credential Management API cannot express an empty password: PasswordCredential rejects it with TypeError: 'password' must not be empty., and there is no API to delete a saved login. So once a password was saved for a server/user and that user later authenticates with an empty password (the account was switched to no_password, or its password was removed), the browser keeps the stale entry and autofills it on every visit, and the page sends the stale secret with every request. From the user's point of view the page "still remembers the previous password".

The page cannot fix the browser's store, but it can remember on its own which logins are passwordless:

  • A successful authentication with an empty password (the credential probe checkCredentials, or a query run with a 2xx response) records the [server, user] login in localStorage; a successful authentication with a non-empty password forgets it again. The server identity and effective user are normalized the same way as sameServerAddress and effectiveConnectionUser.
  • When a password shows up in the field for a login remembered as passwordless and the browser filled it in (the :autofill pseudo-class), it is dropped before it is shown as checked or sent: on the input event autofill raises, and at the points that read the field to build a request (the credential probe, postOne/postAll, the completion query), since autofill does not always raise input.
  • A typed password is never touched. Picking the saved login from the browser's suggestions while the entry exists drops it too; the authentication then fails visibly and typing the password once resolves it (and forgets the entry).

Verified in headless Chromium against a local server with a passwordless default user: the probe and a query run with an empty password record the login, a rejected password changes nothing, and a simulated autofilled password is dropped via the input path, the probe, and the completion URL, while a typed one is kept.

Related: #118637

Changelog category (leave one):

  • Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Web UI: when a login last succeeded with an empty password, a stale password autofilled by the browser's password manager for that server and user is no longer used.


Workflow [PR]
Sync PR [sync-upstream/pr/118638]

Version info

  • Merged into: 26.10.1.1612-master (included in 26.10 and later)

…word

The page offers the login to the browser's password manager after each
Run, but the Credential Management API cannot express an empty password
(`PasswordCredential` rejects it with a `TypeError`) and there is no API
to delete a saved login. So after a server/user was saved with a password
and later authenticates with an empty one, the browser keeps the stale
entry and autofills it on every visit, and the page sends the stale secret
with every request.

Remember in `localStorage` which server/user logins last succeeded with an
empty password (recorded from the credential probe and from a successful
query run, forgotten again when a non-empty password succeeds), and drop
a browser-autofilled password (`:autofill`) for such a login when it shows
up: on the `input` event autofill raises, and at the points that read the
field to build a request. A typed password is always kept.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [200935e]

Summary: ✅


AI Review

Summary

This PR teaches /play to remember passwordless logins and strip stale browser-autofilled passwords, and the new Node harness is a good regression net for the helper logic. I’m still requesting changes because the new 403 classification is incomplete: one server-side post-auth 403 (SET_NON_GRANTED_ROLE) still leaves the passwordless marker stale, so the original autofill bug persists for that class of requests.

PR Metadata
  • Changelog category should be Bug Fix, not Improvement: this PR fixes incorrect existing behavior rather than adding a new capability.
  • Changelog entry is required for Bug Fix and the current text is specific enough; it can stay as-is once the category is corrected.
Findings
  • ⚠️ Majors
    • [programs/server/play.html:10423] rememberAuthenticationOutcome still treats every 403 except ACCESS_DENIED as an authentication failure, but the server also maps SET_NON_GRANTED_ROLE to 403 after the user has already authenticated. A request sent with a newly typed real password and ?role= (or another role-setting path) can therefore leave passwordless_logins unchanged, so the next visit still clears the now-correct saved password.
    • Suggested fix: classify the actual auth-failure codes (UNKNOWN_USER, WRONG_PASSWORD, AUTHENTICATION_FAILED; plus REQUIRED_PASSWORD on 401) instead of whitelisting only ACCESS_DENIED, and add a harness case for SET_NON_GRANTED_ROLE (403 / 512).
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions:
    • Handle SET_NON_GRANTED_ROLE as a post-auth 403 in rememberAuthenticationOutcome (or invert the logic to reject only real auth-failure codes).
    • Extend test_play_passwordless_logins with a SET_NON_GRANTED_ROLE regression case.

LLVM Coverage Report

Measured on commit 200935e.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 92.10% 92.10% +0.00%
Branches 79.60% 79.60% +0.00%

Changed lines: Uncovered code analysis did not run: No coverable C/C++ source files changed (contrib/ is excluded from coverage).

Newly covered: +173 lines in 53 files (-170 lines lost coverage) · Details

Full report

@clickhouse-gh clickhouse-gh Bot added the pr-improvement Pull request with some product improvements label Sep 7, 2026
Comment thread programs/server/play.html Resolved
Comment thread programs/server/play.html Resolved
@clickhouse-gh clickhouse-gh Bot added the comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... label Sep 7, 2026
alexey-milovidov and others added 3 commits September 16, 2026 11:25
…ke the passwordless-login bookkeeping best-effort

`dropAutofilledStalePassword` now also runs before `loadDatabases` (opening the databases
panel), before the download rerun, before `storeCredentials` and in `sendCredentialsToTerminal`,
so a stale autofilled password for a login remembered as passwordless is dropped on every path
that sends or stores it, not only on credential checks, query submission and completions.

`rememberLoginPassword` and `loadPasswordlessLogins` swallow `localStorage` failures
(`QuotaExceededError`, storage policy exceptions), so a successful authentication check or
query is never turned into a client-side error by the bookkeeping.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
The `:autofill` selector detection called `CSS.supports` while the page script was being
evaluated. The headless harnesses of `test_play_image_preview` and
`test_play_reconcile_startup` run the extracted script in a Node `vm` context without a
`CSS` global, so the whole script failed with `ReferenceError: CSS is not defined`. The
detection now yields no selector where `CSS.supports` is unavailable, which leaves the
stale-password handling inert there, as it already is in a browser supporting neither form.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118638&sha=5e5b5018080d4bf074737d61603ce90eaa0df59c&name_0=PR&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%201%2F6%29
PR: #118638

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Comment thread programs/server/play.html Resolved
@clickhouse-gh clickhouse-gh Bot added comp-cli clickhouse-client (interactive CLI) and client library. and removed comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... labels Sep 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 200935e99 with master e9b645ed8 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of 33e5818c7; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

Comment thread programs/server/play.html Resolved
alexey-milovidov and others added 3 commits September 23, 2026 02:25
…d request

`rememberLoginPassword` was only called from `checkCredentials` and from a 2xx
response in `postImpl`. On deployments where `checkURL` never reaches
`checkCredentials` (the ping probes the origin, not the configured path), the
database panel, `auxiliaryQuery` or the completions can be the first request
to authenticate with a newly typed password, and a query that fails after
authenticating (a syntax error, an unknown table) also proves the credentials.

The new `rememberAuthenticationOutcome` is called from `auxiliaryQuery`,
`loadCompletions` and `postImpl` (on the response the framing retries settled
on). `401`/`403` never update the entry; another error updates it when the
server itself produced it (`X-ClickHouse-Exception-Code`); without that proof
a non-empty password still forgets the entry, but an empty one is not
remembered. Adds the `test_play_passwordless_logins` harness test.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@clickhouse-gh clickhouse-gh Bot added comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... and removed comp-cli clickhouse-client (interactive CLI) and client library. labels Sep 27, 2026
alexey-milovidov and others added 2 commits October 3, 2026 13:46
…s proof of authentication

The `Format` button sent `password_elem.value` without `dropAutofilledStalePassword`, so a stale
autofilled password could still be sent by it. It now goes through the guard like the other
requests built from the live connection fields.

`rememberAuthenticationOutcome` ignored every `403`, but `ACCESS_DENIED` (a missing privilege) is
also answered with `403` and is thrown only after a successful authentication. The
`X-ClickHouse-Exception-Code` header tells it apart, so a `403` with `ACCESS_DENIED` now updates
the passwordless entry like any other error of the query. The harness pins both cases.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 @groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118638&sha=fd719b912618&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20parallel%29 (05082_kill_and_system_on_cluster_access_types: KILL PART_MOVE_TO_SHARD reads system.part_moves_between_shards, which fails with KEEPER_EXCEPTION "No node, path /clickhouse/tables//s1/part_moves_shard" for a replicated table of a concurrently running test) and provide a fix in a separate PR. If the fix is already in progress, link it here. This PR only changes play.html.

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator

The fix is #122132, merged 2026-09-28. Reads of system.part_moves_between_shards threw No node, path .../part_moves_shard whenever any replicated table on the server (here one from a concurrent test) was attached without its Keeper tree.

The failed run tested fd719b912618 on 2026-09-27, before #122132 merged. The current head 3e608fb18fa contains it (e823efceee5 is an ancestor). In CIDB the test has 0 failures in 26302 runs since the merge.

@alexey-milovidov

Copy link
Copy Markdown
Member Author

🕵 Merged master to pick up #123738, which fixes the Build (amd_fuzzers) link failure (R_X86_64_PC32 relocation out of range). Thanks @groeneai for confirming that #122132 covers 05082_kill_and_system_on_cluster_access_types.

None of the other failures on 3e608fb18fa are related to this PR, which only changes play.html:

@groeneai, please investigate this failure: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=118638&sha=3e608fb18fa21cca1be96ccb82b9c2f54b308ffc&name_0=PR&name_1=Stateless%20tests%20%28arm_binary%2C%20s3%20storage%2C%20DBReplicated%2C%20parallel%2C%201%2F2%29 (the view check returns 10 instead of 100, and stored alias is bare returns 0 instead of 1) and fix it in a separate PR. If a fix is already in progress, link it here.

Comment thread programs/server/play.html Resolved
@groeneai

groeneai commented Oct 5, 2026

Copy link
Copy Markdown
Collaborator

The fix is in progress: #123790 (it includes the change from my #123774, closed in its favor). In its own run on 2a290a03b667, 05237_with_expression_alias_scope_descendant passes in the arm_binary DBReplicated job.

The diff on 3e608fb18fa is the same deterministic one as on the other PRs: under DatabaseReplicated, the replayed DDL qualified nested, an alias declared inside the WITH expression, with the database, so the view read the table nested (10) instead of the alias (100). The new head 200935e9989 includes #123789, which reverted the arm_binary DBReplicated jobs, so this job does not run on it until #123790 brings it back with the fix.

@alexey-milovidov alexey-milovidov self-assigned this Oct 5, 2026

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Ok.

@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Oct 5, 2026
Merged via the queue into master with commit 94ab0be Oct 5, 2026
149 checks passed
@alexey-milovidov
alexey-milovidov deleted the play-remember-passwordless-login branch October 5, 2026 19:38
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
@clickhouse-gh clickhouse-gh Bot added comp-web-ui Web UI embedded in the server: Play, the dashboards, the merges and processors visualisers, the w... and removed comp-protocols Server wire protocols + request/response handling (native TCP, HTTP, MySQL/PostgreSQL wire protoc... labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp-web-ui Web UI embedded in the server: Play, the dashboards, the merges and processors visualisers, the w... pr-improvement Pull request with some product improvements pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants