fix(envfactory): reject primary mobile key absent from mobileKeys[]#728
Merged
aaron-zeisler merged 1 commit intoJun 30, 2026
Merged
Conversation
A defined primary mobile key (the wire's mobKey) that is not present in mobileKeys[] is structurally malformed — the mobile-key analogue of the existing anchor-not-in-array invariant. Without this guard the primary would be silently left undesignated, clearing it on reconcile and breaking event forwarding. Add NewPrimaryMobileKeyNotInSetError and a primaryMobileInArray check to BuildAcceptedSet, and document the new case on MalformedCredentialSetError.
This was referenced Jun 29, 2026
keelerm84
approved these changes
Jun 30, 2026
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.
Note
Stacked PR — splitting #724 (review/merge bottom-up):
mobileKeys[]AcceptedKeyssdkKeys[]/mobileKeys[]on/statusBase of the stack (off
feat/concurrent-keys); every PR above builds on it.Summary
Reject a defined primary mobile key (the wire's
mobKey) that is absent frommobileKeys[], mirroring the existing anchor-not-in-array invariant.This is the base of the stack that splits #724. It is a small, self-contained correctness fix, but the feature PRs above depend on it: the per-entry primary-mobile designation introduced in #729 and this validation are two halves of one change, so they travel together in the stack.
Background
BuildAcceptedSetalready rejects a defined anchor SDK key absent fromsdkKeys[](NewAnchorNotInSetError). The primary mobile key had no equivalent guard: a definedmobKeymissing frommobileKeys[]would be silently left undesignated, clearing the primary on reconcile and breaking event forwarding.Changes
NewPrimaryMobileKeyNotInSetErrorand document the new case onMalformedCredentialSetError.primaryMobileInArraycheck toBuildAcceptedSet.TestBuildAcceptedSet_PrimaryMobileNotInArray.