feat: implement credential management UI#4638
Conversation
Coverage Report for CI Build 29570888571Coverage increased (+0.03%) to 12.399%Details
Uncovered Changes
Coverage Regressions2 previously-covered lines in 2 files lost coverage.
Coverage Stats
💛 - Coveralls |
|
@AlCalzone do you have support in mock server for it? |
1d22289 to
5a9a11e
Compare
Yeah, both CCs are extensively tested through mocks internally. |
There was a problem hiding this comment.
Pull request overview
This PR introduces an Access Control (User Credential / User Code) management feature across backend + frontend, adding a dedicated UI for users/credentials enrollment and operations, and hiding legacy User Code CC values from the generic value list when Access Control is available.
Changes:
- Added frontend Access Control helpers/constants/types and a new node “Access Control” tab UI (users, credentials, activity, admin code).
- Added new dialogs for adding/editing users and adding/replacing credentials.
- Extended backend
ZwaveClientwith Access Control APIs, state mapping, and event wiring to keep the UI snapshot updated.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/lib/accessControl.ts | Frontend enums/labels/helpers + shared Access Control types used by the new UI. |
| src/components/nodes-table/NodeDetails.vue | Hides userCode/userIdStatus values from the value list when Access Control is supported. |
| src/components/nodes-table/ExpandedNode.vue | Adds the “Access Control” node tab and lazy-loads the new component. |
| src/components/nodes-table/AccessControl.vue | New main Access Control UI (users/credentials/actions/enrollment/admin code). |
| src/components/dialogs/DialogAccessControlUser.vue | New dialog for creating/editing users, including optional initial credential. |
| src/components/dialogs/DialogAccessControlCredential.vue | New dialog for adding/replacing direct-entry credentials (PIN/password). |
| api/lib/ZwaveClient.ts | Backend Access Control API surface + cached state mapping + event handling updates. |
| <v-text-field | ||
| v-model="credential.data" | ||
| label="Value" | ||
| :hint="lengthHint" | ||
| persistent-hint | ||
| class="font-monospace" | ||
| :rules="credentialRules" | ||
| :disabled="saving" | ||
| /> |
There was a problem hiding this comment.
Fixed in d4eae67 — the initial credential is masked with an explicit reveal control.
AlCalzone
left a comment
There was a problem hiding this comment.
Deep review — feat: implement credential management UI
Verdict: Needs work — the approach is sound and composes well with the codebase, but a credential-leakage Blocker and a silent-data-loss Major should be fixed before merge.
Top 3 risks
- Cleartext PINs/passwords broadcast to every connected client and retained in the in-memory event buffer.
- Adding a user to a full lock silently overwrites user 1 instead of erroring.
- The admin-code path monkeypatches a zwave-js-private method with a non-reentrant wrapper and reports unconfirmed changes as success.
Strengths
- Composes with house style: canonical
validateMethods/allowedApis→callApidispatch, theemitNodeUpdate(node,{accessControl})snapshot pattern shared withuserCodes/schedule, and standard async-component tab registration. accessControl.tsis clean, well-factored pure logic; the result-code → user-message mappers are a nice UX touch.- Comprehensive: learning/enrollment, bulk delete, move-between-users, admin code — all wired end to end.
Themes
- Secret handling — credentials leak through the event stream, the state snapshot, and the mask function.
- The admin-code
handleCommandmonkeypatch — one construct drew correctness, design, readability, and operability findings at once. - Frontend/backend contract duplication — enums and types hand-mirrored instead of imported.
FYI (not line-anchored)
- Backcompat is fine: hiding
userCode/userIdStatus(NodeDetails.vue ~557) only filters the value grid; values stay innode.valuesand on MQTT, so automations are unaffected. But the legacy "Users" (UserCodeTable) tab in ExpandedNode.vue still renders alongside the new "Access Control" tab — two overlapping UIs for the same locks. _onNodeEvent(ZwaveClient.ts:7871) was broadened tozwaveNode?.nodeId ?? zwaveNode?.id; equal for root nodes, so no behavior change, but a shared dispatch helper was changed for one feature.- Confirmed not problems:
formatHexdoesn't duplicate the backendbuffer2hex/num2hex; no i18n infra exists so the hardcoded label maps bypass nothing; the two new dialogs are presentational and bypass no dialog base.
Coverage: All 7 specialists ran (Correctness, Security, DRY, Design/API, Operability, Tests, Readability). Performance not run — no DB/query/hot-loop surface in its lane. Reviewed against a worktree at PR head 6a0ab63.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This PR adds a dedicated credential management UI, powered by Z-Wave JS's new Access Control API.
It includes everything that belongs to it: managing credentials, moving them between users, fingerprint and other credential learning, bulk deletion, logging, etc.
This also removes the
userCodeanduserIdStatusvalues from the User Code CC dropdown, since those are no longer needed to manage codes.Screencast.From.2026-07-17.10-16-37.mp4