fix: editing an unmanaged code left every PIN on the card in cleartext - #1519
Merged
Conversation
_startEditing set the card-global _revealed to get the code being edited. _cancelEdit restored it; _saveCode never did. _formatCode reads that same flag for every row, so clicking an unmanaged slot un-masked every managed user's PIN, and saving left them on screen until someone noticed the eye or reloaded. The reveal bought nothing anyway: the prefill reads the CURRENT payload, still masked because the resubscribe it kicked off had not landed, so a masked slot has always prefilled empty. Removed rather than repaired -- repairing it would mean revealing every row to edit one. A card configured 'Always Masked' was also pulling every cleartext PIN over the websocket on the first edit click, rendering none of it. Separately, a refused write reached console.error and nothing else, so the row sat there with the typed value looking like nothing was sent. It now says what went wrong, beside the row it is about. Entire-Checkpoint: f8ad7d7721bf
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1519 +/- ##
==========================================
+ Coverage 99.16% 99.19% +0.03%
==========================================
Files 66 66
Lines 8462 8457 -5
Branches 520 521 +1
==========================================
- Hits 8391 8389 -2
+ Misses 71 68 -3
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
raman325
added a commit
that referenced
this pull request
Aug 29, 2026
* origin/main: fix: editing an unmanaged code left every PIN on the card in cleartext (#1519) build(deps-dev): bump aioesphomeapi in the homeassistant group (#1512) build(deps-dev): bump @types/node from 26.2.0 to 26.3.0 (#1513) # Conflicts: # custom_components/lock_code_manager/www/generated/lock-code-manager.js
5 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed change
Editing an unmanaged code put every PIN on the card in cleartext
_startEditingset the card-global_revealedto true and resubscribed withreveal: true._cancelEditrestored it._saveCodenever did._formatCodegates masking on that same card-global flag, so it applies to every row — managed users included. On alcm-lock-codescard at the defaultmasked_with_reveal, clicking an unmanaged slot's code un-masks every code on the card; pressing Enter leaves them there, in cleartext, until someone notices the eye icon or reloads.The reveal bought nothing. The prefill reads
slot.codefrom the current payload — still masked, because the resubscribe it kicked off has not landed — so a masked occupied slot has always prefilled empty. I removed the reveal rather than repairing the prefill: repairing it would mean revealing every row in order to edit one. If the box should prefill, that wants a per-slot reveal, which is a different change.A card explicitly configured
code_display: 'masked'("Always Masked") was also resubscribing withreveal: trueon the first edit click, pulling every managed user's cleartext PIN over the websocket. Nothing rendered it, but the card was asking for what it was configured never to show.A refused write said nothing
The comment claims user-facing; nothing user-facing happened.
ws_set_usercodereally does raise — a duplicate code, a lock that will not take it — and the card stayed in edit mode with the typed value and "Enter to save", indistinguishable from a submission that never went out. It now shows the reason beside the row._errorcould not be reused for this: it replaces the slot list, so setting it would have hidden the very row the message is about.Type of change
Additional information
main— v6 only renamed the two websocket command strings inside_saveCode. Targetingmainso current users get it._startEditingfails them.console.errorhad been called — it pinned the bug. It now asserts what the user sees.prekclean; bundle rebuilt.