Repository navigation
Web UI: fix user/password field staying red with correct credentials - #109414
Conversation
In `play.html`, the connection dot (`#url_status`) and the user/password field colour are driven by two independent checks: `checkURL` (an `OPTIONS` ping) and `checkCredentials` (a `POST SELECT version()`). `checkCredentials` guards its async response against `check_credentials_request_num`, but `resetCredentialsStatus` — run on every keystroke — only cleared the CSS classes without bumping that counter. As a result, a check started against an earlier wrong or incomplete value could still land and paint the field red after the user had already typed the correct credentials, while the independently-driven green dot stayed green. Nothing re-checked afterwards, because typing (as opposed to paste or URL edits) never triggered a check. Fix both problems: - `resetCredentialsStatus` now bumps `check_credentials_request_num`, so any in-flight credential check is invalidated on edit and a stale response can no longer paint the field. - A debounced `scheduleCredentialsCheck` re-checks credentials shortly after the user stops typing (or pastes), so correct credentials turn green and wrong ones red without an explicit action. This subsumes the old `paste` handlers, since a paste reaches it through the `input` event it triggers. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Workflow [PR], commit [f80f5ee] Summary: ✅
AI ReviewSummaryThis PR rewrites the Web UI credential-status flow around a single connection-surface commit, invalidates stale async probes, and extends that logic across the dropdown, page-blur, history-restore, and autofill paths. On the current head, the earlier race / premature-probe issues raised in review are addressed, and I did not find a remaining correctness or security regression in the changed paths. Final Verdict
|
Address review feedback: the debounced `input`-driven `scheduleCredentialsCheck` turned ordinary password typing into repeated authentication probes. Because `getServerStatus` appends `user`/`password` to the request URL and sends `SELECT version()`, a slow typist emitted `?password=s`, `?password=se`, ... as separate failed logins with partial secret prefixes before the final value was complete — polluting access logs and potentially tripping auth rate limits. Now editing a credential field only resets the indication (clear classes and invalidate any in-flight check via `resetCredentialsStatus`), without any network probe. The check itself runs on `change`, i.e. when the field is committed (typically on blur), so it uses only the final, complete value. This subsumes the old paste handlers, since a pasted value is committed by the following blur just like typed input, and correct credentials still turn green without an explicit action. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address review feedback: `resetCredentialsStatus` bumped the request number only on `user`/`password` edits, so a `url` edit left the previous credential probe live. Concrete trace: start `checkCredentials` against server A, edit `url` to server B; `checkURL` clears the dot and pings B but did not bump `check_credentials_request_num`, so the old response from A could land and repaint the auth fields for the wrong endpoint — and if B is unreachable, that stale color would stick because no replacement `checkCredentials` runs. Register `resetCredentialsStatus` as a `url` `input` handler too. It runs after the existing `checkURL` handler, so a successful ping to the new URL still triggers a fresh credential check; a failed ping now leaves the fields neutral rather than keeping the previous server's colour. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The previous commit ran `checkCredentials` on each field's `change` event. But `change` fires when focus moves from `user` to `password` (or back), so editing both fields in sequence sent a mismatched pair — the new user against the old password, or vice versa — as an unintended login attempt before the user had finished editing, briefly flashing red and polluting access logs. Move the check to `focusout` on the credential fields, skipping the case where `relatedTarget` is the sibling credential field (focus merely travelling within the pair). A `credentials_edited` guard set on `input` ensures that merely tabbing through the fields, without changing anything, emits no login attempt. So `checkCredentials` runs once, on the final complete pair, when focus leaves the credential block. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
…mmitted The previous `focusout` guard treated the credential pair (`user`/`password`) as the whole "finished editing" scope: it skipped the probe only when focus moved to the sibling credential field. But the connection tuple also includes `url`. In the natural order of setting up a new connection — type the credentials for a new server, then point `url` at it — moving focus from `user`/`password` into `url` counted as "finished", so `checkCredentials` fired `getServerStatus(old_url, new_user, new_password)` against the *previous* server. Because `getServerStatus` puts the credentials into the request URL, this disclosed the full final password to the previous server and logged a spurious failed login there. Treat the whole connection block `#inputs` (url + user + password) as one edit session: skip the probe while focus stays anywhere inside `#inputs`, and probe only once focus leaves the block. Genuine `url` edits are already re-checked by `checkURL`'s success path, so no coverage is lost. Follows up the review on #109414 Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Address the AI review Blocker (round 5). The round-4 wiring could still (1) skip the credential check entirely — editing `user`/`password`, moving into `url`, then leaving the block ran no `checkCredentials`, because only `user`/`password` had a `focusout` handler — and (2) probe too early: `checkURL` called `checkCredentials` on every successful `url` `input`, so the full password could be sent to a half-typed or still-old endpoint before the connection tuple was committed. Treat the whole `#inputs` block (url + user + password) as one edit session: - a single `focusout` listener on `#inputs` (the event bubbles) is the one commit point; it fires when focus leaves the block from any field, including `url`, and runs `checkURL(true)`, so an unreachable server leaves the fields neutral instead of blaming them; - `checkURL` takes a `probe_credentials` flag and probes only on the initial load and on that commit, never on intermediate `url` keystrokes; - a `url` edit marks the connection edited, so committing a url-only change re-checks the credentials against the new server. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses the AI-review blocker at `programs/server/play.html:3594`. A `checkURL(true)` ping arms a deferred `checkCredentials` on success, but the ping is asynchronous. The initial page-load ping (or one from an earlier commit) could resolve after the user had already resumed typing, and its success path called `checkCredentials` against the current, still-in-progress fields — sending `getServerStatus(url, user, "s")`, `"se"`, ... to the server. A `user`/`password` edit only bumped `check_credentials_request_num`, which guards the check *response*, not the ping-to-probe *chain*, so nothing stopped that call from being made in the first place. Add a `connection_generation` counter, bumped on every connection edit (`url`/`user`/`password` `input`). `checkURL` captures it when the ping starts and probes only if it is still current when the ping resolves, so any edit made while the ping is in flight invalidates the armed probe. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Addresses the AI-review blocker at `programs/server/play.html:4386`. The block-level `focusout` commit treated `relatedTarget === null` as "focus left `#inputs`". But `#inputs` contains non-focusable elements — the status dot `#url_status` and its children — and a pointer press on one of them blurs the active field with no new focus target, i.e. `relatedTarget === null`, while the interaction stayed inside the block. Typing credentials for a new server while `url` still points at the old one and then clicking the status dot was therefore treated as a commit and sent the full password to the *previous* server. Track whether the current pointer press landed inside `#inputs` (reset on release/cancel, so a keyboard move to nothing is unaffected) and skip the commit for a null-`relatedTarget` blur that happened during such a press. Only a real exit from the block now commits and probes. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
The previous commit suppressed the block commit when a pointer press landed on a non-focusable spot inside `#inputs` (the status dot or a gap), because that blurs the active field with `relatedTarget === null` without the user actually leaving the connection block. But suppressing that blur is not enough on its own: the field has already lost focus, so when the user then moves on (clicks the query editor or the `Run` button) no second `focusout` fires and the deferred check would never run, leaving the fields neutral forever. Concretely: edit `password`, click `#url_status`, then click the query editor. Remember a suppressed internal-click blur in `commit_deferred` and commit on the first later press outside `#inputs`. A credential field regaining focus (`focusin` inside the block) means editing resumed and the normal `focusout` will commit, so the deferred flag is dropped then. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Feedback from GPT-5.5: |
|
Web UI does not have tests for now, it's okay. |
After merging master, the connection inputs can be relocated behind the 🔑 button into a drop-down (`#connection-menu`); the credential re-check boundary only treated `#inputs` as the edit session, which broke down in that layout. Address two review findings from the interaction: - Moving focus from `user`/`password` to the 🔑 button — clicking it to close the drop-down, or `Escape` (whose close path refocuses it) — counted as "finished editing" and ran `checkURL(true)`, probing the *old* url with the new password via `getServerStatus`. That is exactly the premature-probe / password-disclosure this fix is meant to prevent. The edit surface is now resolved by `connectionSurface`: the whole `#connection-menu` while the inputs live in the drop-down, and `#inputs` inline. Focus staying anywhere in the connection UI keeps the session open; only leaving it commits. - The commit decision now reads the settled `document.activeElement` on the next microtask instead of the `focusout` `relatedTarget`, which is a transient intermediate value while the drop-down hides the focused field before handing focus to the 🔑 button. - The deferred commit (set after an internal-click blur onto the status dot) now also flushes on a `focusin` outside the surface (a keyboard `Tab` away) and on the drop-down closing, not only on a later pointer press, so keyboard users who press `Escape`/`Tab` no longer leave the auth fields neutral forever. Both issues were flagged by the automated review on the merge commit. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
Losing focus to the browser itself (address bar, another window) blurred the field to `<body>` with no pointer press inside the surface, so the `focusout` microtask fell through to `commitConnection` and could send a freshly typed password to the previous server. Detect page blur via `document.hasFocus` and defer the commit, like the internal-click blur, until a later transition that really leaves the connection surface.
|
The |
|
@groeneai, investigate the failure: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=109414&sha=b5c22cccae0a6cb219ef1a52e299f342b5261e4f&name_0=PR&name_1=Integration%20tests%20%28amd_msan%2C%207%2F8%29 and provide a fix in a separate PR. If the fix is already in progress, link it here. The failed test is |
|
Confirmed: the only red check is Fix in progress: #111029. It targets the actual root cause (a comment/settings-only Not opening a separate PR since #111029 already covers this; tracking it to merge. |
…on edit `window.onpopstate` dispatches synthetic `input` events on the connection fields to reproduce the side effects of a connection change when a Back/Forward restores a different connection, and that replay clears the password (it is never persisted to history). The `connection_edited` latch treated those replays as a real user edit, so a later focus change over the connection UI - without the user touching anything - reached the commit path and probed the restored server with the restored user and an empty password: an unrequested authentication attempt, logged there as a failed login. Gate the latch on `event.isTrusted`. Untrusted replays still invalidate as intended (they bump `connection_generation`, dropping any probe armed against the connection being navigated away from, and clear the stale credential badge); they just do not arm a commit. The `url` listener now shares `onCredentialInput`, which already did the same work.
|
The Failure: Known issue: #111421 — fix in progress in #109023 (still open, so merging |
A Back/Forward that lands on a different connection clears the password and replays synthetic `input` events. The `isTrusted` gate added in the previous commit stops those replays from arming a new edit session, but an edit session already in progress before the navigation survived it: with `connection_edited` (and possibly `commit_deferred`) still set, the first later focus change leaving the connection surface committed and probed the restored server with the cleared password, logging a spurious failed login there. Reset both latches in the restore path before the replay.
|
@groeneai, investigate the failures in the two
All of them are unrelated to this pull request, whose diff only touches
I could not find open issues tracking any of the three, so they likely need issues filed as well. |
|
I confirm all three are unrelated to this pull request. Two of the three already have both a tracking issue and a fix; only
1. STID
|
…t `input` The commit that re-checks the credentials on leaving the connection surface was licensed solely by the `connection_edited` latch, which is set from `input`. But `#user` and `#password` are browser-autofillable, and autofilling a saved login does not always fire `input` on them — the Documentation link already works around the same thing a few lines above. In that path nothing cleared the stale badge and nothing armed the commit, so the fields could keep showing `ok`/`fail` for the credentials the page was loaded with while already holding different ones, and finishing with the connection UI did not re-check them. Remember in `checked_connection` the tuple every `checkCredentials` is sent with, and license the commit from `connectionNeedsCheck` — the latch, or a current tuple that differs from the one the indication reflects. That catches a value change whatever raised it. `commitConnection` now also clears the indication, since a change with no `input` never went through `resetCredentialsStatus`. The history restore in `onpopstate` takes the restored tuple as the new baseline, for the same reason it drops both latches: it is not a user edit, and otherwise merely focusing a field and leaving again would probe the restored server with the cleared password.
|
The two CI reds on
@groeneai, investigate the second one — |
|
A fix is already in progress: #111993 (open). I confirm it covers the exact abort in this job, so no separate pull request is needed for it. The aborting query in this job is not the one the report printsThe report's which is an earlier fuzzer mutation that failed harmlessly with plus Measured, on the real statement
The frames of the first row match this job's It is not a sixth site of #107951, so please do not fold it thereRow 3 above is hand-written SQL with no fuzzing at all, and the analyzer accepts it: a matcher ( One defect, two STIDs, and one residualKeying on the message rather than the STID ( The twelfth is on #111993 itself and is a different carrier path that I still have to fix: with the matcher in PREWHERE the header is computed through CREATE TABLE r1 (a LowCardinality(String), v Int16) ENGINE = MergeTree ORDER BY a;
CREATE TABLE r2 (a String, w UInt64) ENGINE = MergeTree ORDER BY a;
SELECT w, r1.a, v FROM r1 INNER JOIN r2 ON r1.a = r2.a
PREWHERE ((arrayMap(z -> tuple(* EXCEPT w), [1])[1]).1) != '';still returns |
|
Fixing PR for the third item, Root cause: parallel-replicas eligibility for a join tree is decided by The investigation also found two more shapes of the same defect that no existing rule reached, and the |




In the Web UI (
play.html), the user name (and password) input field often remained red even when the credentials were correct and the connection dot was green.The connection dot (
#url_status) and the field colour are driven by two independent checks:checkURL(anOPTIONSping, which paints the dot) andcheckCredentials(aPOST SELECT version(), which paints the fields).checkCredentialsguards its async response againstcheck_credentials_request_num, butresetCredentialsStatus— run on every keystroke — only cleared the CSS classes without bumping that counter. So a credential check started against an earlier wrong or incomplete value could still land and paint the field red after the user had already typed the correct credentials, while the independently-driven green dot stayed green. Nothing re-checked afterwards, because typing (as opposed to paste or URL edits) never triggered a check.This fixes the problems:
resetCredentialsStatusnow bumpscheck_credentials_request_num, so any in-flight credential check is invalidated on edit and a stale response can no longer paint the field.#inputs: url + user + password). This is the single commit point, so it fires no matter which field was edited or focused last — includingurl(a natural order is to type the credentials for a new server, then pointurlat it). Probing earlier would misfire while the connection is still being assembled: moving betweenuserandpasswordsends a mismatched half-typed pair (the new user against the old password, or vice versa); moving focus intourlwould send the full final password to the previous server, disclosing it there and logging a spurious failed login; and aurlkeystroke that happens to hit a reachable intermediate endpoint would send the credentials there. Waiting until focus leaves the whole block means only the final, complete connection tuple is sent, and the commit pings the url and only then probes the credentials, so an unreachable server leaves the fields neutral rather than blaming them. A correct value turns green and a wrong one red without an explicit action. This subsumes the oldpastehandlers, since a pasted value is committed by the following focus change just like typed input. Probing on every keystroke was avoided deliberately:getServerStatusputs the credentials into the request, so it would otherwise emit login attempts with partial (and, for the password, secret) prefixes.checkURLno longer probes the credentials on every intermediateurlkeystroke — only on the initial page load and on the block-level commit — so the password is never sent to a half-typed or still-old endpoint while the URL is being edited. The invalidation also coversurledits: a URL change may point at a different server, so an in-flight credential check against the previous URL is invalidated and the stale colour cleared, preventing a response from the old endpoint from repainting the fields for the wrong server; and a url-only change is re-checked against the new server when the block is committed.Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Web UI: fix the user/password input field staying red even when the credentials are correct and the server is reachable, and re-check credentials once you finish editing the connection so a correct value is confirmed with green.
Documentation entry for user-facing changes
🤖 Generated with Claude Code
Version info
26.8.1.283(included in26.8and later)