Repository navigation
Preserve device credentials in registrar on settings validation errors - #1496
jamiebrind merged 4 commits into
Conversation
…ting key_bytes to auth_key Previously, when LocalDevice.validateMetadata() threw a ValidationError (e.g. from validatePointTypes), LocalDevice.initialize() exited before configure() and Registrar.initializeDevices() returned early, skipping loadCredentials(). Registrar then pushed UPDATE with empty credentials alongside metadata.key_bytes (the base64 PKCS#8 private key), and ZanzaraIotAccessProvider.toDeviceMap() wrote metadata.key_bytes into auth_key when credentials were empty—corrupting broker public keys. - Call configure() before validateMetadata() in LocalDevice.initialize() - Remove early return in Registrar.initializeDevices() so loadCredentials() still runs after settings validation errors - Remove metadata.key_bytes fallback into auth_key in ZanzaraIotAccessProvider.toDeviceMap() - Add unit tests in RegistrarTest and ZanzaraIotAccessProviderTest
|
I think registrar needs to be updated too so that the private key is never transmitted to the cloud. An empty credential is also a valid case, and should result in credentials being removed if set. Are there tests which verify this behaviour? |
grafnu
left a comment
There was a problem hiding this comment.
I think Nour's comments about private keys is more important than mine. Is that something that's in-scope for this PR or is that getting out of hand? (The goal is to try and slowly improve the system, but not to make this PR stall out if it's unrelated...)
…dentials-on-settings-error # Conflicts: # udmis/src/main/java/com/google/bos/udmi/service/access/ZanzaraIotAccessProvider.java # udmis/src/test/java/com/google/bos/udmi/service/access/ZanzaraIotAccessProviderTest.java # validator/src/test/java/com/google/daq/mqtt/registrar/RegistrarTest.java
I don't think its in scope of this PR. @noursaidi how would we send keys to Zanzara if its not through Registrar. Or would we just send the public key, not the private. |
|
Yes -- that's it -- Zanzara does not need private keys! Conceptually,
private keys could never be visible and everything could work. We just have
them in the site model because sometimes we need to inject them into things
(that don't properly make their own private keys and have a way to export
the public key).
…On Wed, Nov 25, 2026 at 5:03 AM jamiebrind ***@***.***> wrote:
*jamiebrind* left a comment (faucetsdn/udmi#1496)
<#1496 (comment)>
I think Nour's comments about private keys is more important than mine. Is
that something that's in-scope for this PR or is that getting out of hand?
(The goal is to try and slowly improve the system, but not to make this PR
stall out if it's unrelated...)
I don't think its in scope of this PR. @noursaidi
<https://github.com/noursaidi> how would we send keys to Zanzara if its
not through Registrar. Or would we just send the public key, not the
private.
—
Reply to this email directly, view it on GitHub
<#1496?email_source=notifications&email_token=AAIEPD7E6XFAUAUJLWNKH73523KBVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMJWGMZDCOBTGU2KM4TFMFZW63VQOJSXM2LFO5PXEZLROVSXG5DFMSSWK5TFNZ2KYZTPN52GK4S7MNWGSY3L#issuecomment-7163218354>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIEPDZGW6KSGGLNWDDYLNT523KBVAVCNFSNUABFKJSXA33TNF2G64TZHMZDONBTGAZTEMRQHNEXG43VMU5TMNBZGIZDGMJZHEZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/AAIEPD6FQDGBJIOV674KBR3523KBVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMJWGMZDCOBTGU2KM4TFMFZW63VQOJSXM2LFO5PXEZLROVSXG5DFMSSWK5TFNZ2KUZTPN52GK4S7NFXXG>
and Android
<https://github.com/notifications/mobile/android/AAIEPD6JLXNUMUFUABOED7L523KBVA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMJWGMZDCOBTGU2KM4TFMFZW63VQOJSXM2LFO5PXEZLROVSXG5DFMSSWK5TFNZ2K4ZTPN52GK4S7MFXGI4TPNFSA>.
Download it today!
You are receiving this because your review was requested.Message ID:
***@***.***>
|
|
@grafnu I can remove them uploading in this same PR, or create a new one..... should be a simple fix. |
|
@jamiebrind -- I'd like to move this through or move it to draft, or close it out, any outstanding blockers you need help with? |
|
No it's all done.
I can address Nours Comments in another PR.
…On Mon, 30 Nov 2026 at 14:14, Trevor ***@***.***> wrote:
*grafnu* left a comment (faucetsdn/udmi#1496)
<#1496 (comment)>
@jamiebrind <https://github.com/jamiebrind> -- I'd like to move this
through or move it to draft, or close it out, any outstanding blockers you
need help with?
—
Reply to this email directly, view it on GitHub
<#1496?email_source=notifications&email_token=APKU5VUWTS3WFDYXGMUMRAD53V6DRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMRYGEYDIMRQGI42M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLDGN5XXIZLSL5RWY2LDNM#issuecomment-7281042029>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/APKU5VVJOFX36TBU5VQP2Q353V6DRAVCNFSNUABFKJSXA33TNF2G64TZHMZDONBTGAZTEMRQHNEXG43VMU5TMNBZGIZDGMJZHEZKC5QC>
.
Triage notifications, keep track of coding agent tasks and review pull
requests on the go with GitHub Mobile for iOS
<https://github.com/notifications/mobile/ios/APKU5VT2T6IWKDJ3GLITU5L53V6DRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMRYGEYDIMRQGI42M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJKTGN5XXIZLSL5UW64Y>
and Android
<https://github.com/notifications/mobile/android/APKU5VVPFEY3S4U7NMCXUKD53V6DRA5CNFSNUABFM5UWIORPF5TWS5BNNB2WEL2JONZXKZKDN5WW2ZLOOQXTOMRYGEYDIMRQGI42M4TFMFZW63VHNVSW45DJN5XKKZLWMVXHJLTGN5XXIZLSL5QW4ZDSN5UWI>.
Download it today!
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
We can discuss this and create another PR as I believe this is out of scope for this PR. |
…dentials-on-settings-error # Conflicts: # udmis/src/test/java/com/google/bos/udmi/service/access/ZanzaraIotAccessProviderTest.java
When LocalDevice.validateMetadata() threw a ValidationError (e.g. from validatePointTypes() in #1469), Registrar.initializeDevices() returned early before configure() and loadCredentials(), then still pushed UPDATE with credentials: []. In ZanzaraIotAccessProvider, the metadata.key_bytes fallback then overwrote auth_key with the private key bytes, breaking MQTT auth. Devices with settings errors now still report ERROR under settings while preserving their public key credentials.
Changes
LocalDevice.initialize(): call configure() before validateMetadata().
Registrar.initializeDevices(): remove the early return on settings errors so loadCredentials() and validateEnvelope() still run.
ZanzaraIotAccessProvider.toDeviceMap(): remove the metadata.key_bytes fallback into auth_key.
Tests: RegistrarTest.credentialsPreservedOnSettingsErrorTest and ZanzaraIotAccessProviderTest.testMetadataKeyBytesDoesNotOverwriteAuthKey.