Repository navigation
AskKeyDevices: reserve kind 14 and remove the approver code - #357
Merged
Merged
Conversation
Pairing makes an iPhone an approver (#336), so the approver code, its code proof and the approver confirmation (kind 14) are gone from the protocol library, with every remaining use in the apps and tests. - MessageKind drops kind 14 and documents it as reserved. A record of kind 14 is refused as an unknown kind from its plaintext kind, and an inner message of kind 14 when its layout is parsed, at the same point and with the same refusal as any other unknown kind. - Remove ApproverCode, ApproverConfirmation, ApprovalMessage.confirmation, sealApproverConfirmation, the two domain labels and PairedDeviceChange.setApprover. VerifiedApprovalMessage.requestDigest is no longer optional, since every remaining kind carries one. - The Mac coordinator, the iPhone app and the test support lose their .confirmation arms; comments name kinds 10-13. - Tests: drop the code proof and confirmation statement vectors; add a kind 14 refusal test (record and inner message, both directions, the messenger and the stateless verifier, compared with kind 15); flagged entries come from pairing or @testable access; the Vault's flag rule is exercised by direct list writes and adds instead of setApprover. - ADR 0014 states how kind 14 is refused now that the library dropped it.
- The kind 14 refusal test also runs every case through a named fetch (refused, deleted, token and list unchanged, handler never called) and checks that the raw-kind helper seals a valid receipt the Mac processes. - MessageKind and ADR 0014 name both refusals: a kind 14 record as an unknown kind, an inner message of kind 14 as malformed, as for any kind this build does not know. - Fix comments that still described kinds 11-14, the HMAC of the removed code proof, and the Broker's addition after turning approval on.
README's notification paragraph and a Broker test comment still described turning approval on and a flag write; pairing makes the approver now.
|
Cross adversarial review (GPT-6 Astra xhigh and Opus 5.5 xhigh, read-only, two rounds each; round 1 on 58b8e43, round 2 on 0531749) Neither reviewer found a P0 or P1 problem in either round. Both confirmed:
Fixed
Declined
Head 7efc357. Local results: AskKeyDevicesTests 219/0; AskKeyVaultTests 579/0, 17 skipped; AskKeyAppTests 853/0, 1 skipped; iPhone kit 163/0; extension 44/0; hygiene and module checks pass. |
This was referenced Nov 16, 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.
Closes #343
Summary
Removes the approver code, its code proof and the approver confirmation (kind 14) from
AskKeyDevices, as ADR 0014's #336 amendment (decision 2, Retired, Implementation tasks → 3) specifies, with every use left in the apps and tests.MessageKinddrops kind 14 and documents it as reserved. A record of kind 14 is refused asunknownKindfrom its plaintext kind, before decryption; an inner message of kind 14 inside a record of a known kind is refused when the inner layout is parsed (malformed). Both are exactly what kind 15 gets, in the messenger and in the stateless verifier the notification extension uses.ApproverCode(file deleted),ApproverConfirmation,ApprovalMessage.confirmation,DeviceMessageSealer.sealApproverConfirmation, theAskKey approver confirmation v1andAskKey approver code v1domain labels, andPairedDeviceChange.setApprover.VerifiedApprovalMessage.requestDigestis now non-optional, since it was nil only for a confirmation..confirmationarms go from the Mac coordinator, the iPhone app andFakeDeviceServices; comments name kinds 10–13. The Vault's flag rule is unchanged: the flag is accepted only in an add pairing authorized for an iOS card, and any change to a stored entry's flag is refused.Diff stat
34 files changed, 244 insertions(+), 374 deletions(-): 14 files in
Sources/(one deleted; the Broker file is a comment), 12 test files inTests/, 6 files iniOS/(one extension comment, the rest tests and handler arms), one paragraph of ADR 0014 and one sentence of README.Tests
swift build: passed.swift test --filter "AskKeyDevicesTests|AskKeyAppTests|AskKeyVaultTests": AskKeyDevicesTests 219 passed / 0 failed; AskKeyVaultTests 579 executed, 17 skipped, 0 failed; AskKeyAppTests 853 executed, 1 skipped, 0 failed. Againstmain, AskKeyDevicesTests drops from 221 to 219: three code and confirmation tests (testCodeProofAndConfirmationStatement,testApproverCodeEntryAndRedaction,testConfirmationNotSignedByTheApprovalKeyOverItsStatementIsRefused) are removed andtestKind14IsRefusedLikeAnyUnknownKindis added. After the review fixes, AskKeyDevicesTests was rerun: 219 passed / 0 failed. Vault and App counts are unchanged.bash scripts/build-ios.sh test: iPhone kit 163 passed / 0 failed, notification extension 44 passed / 0 failed, 88 screens rendered.New or rewritten tests:
ApprovalRefusalTests.testKind14IsRefusedLikeAnyUnknownKind: for kinds 14 and 15, in both directions, a record of that kind sealed with the sender's real keys (as an older build sealed kind 14) and an inner message of that kind inside a kind 12 or 13 record. Each is checked against the stateless verifier, a poll and a named fetch, and is deleted without effect; a valid receipt sealed by the same helper is processed, as a positive control.ApprovalTransportRuleTests.testRoutingAndTamperingRulesApplygains a "reserved kind 14" case for every approval kind.RemoteApprovalPairingTests.testARecordOfTheRetiredKind14IsRefusedAsAnUnknownKind: the Mac logs exactly oneunknownKindrefusal and the approver keeps its generation.DeviceApproverFlagTests: the flag-change refusals use direct list writes and adds instead ofsetApprover(stored flag off, stored entry's flag on, the same write under a fresh pairing authorization), and a refused write leaves the Broker set alone.ApprovalFlowTests: the held-message test now holds a kind 13 receipt under the new pairing instead of a confirmation; the round-trip test covers closed messages and receipts.NotificationProcessorTests.testAMacRemovedWhileTheRecordIsFetchedStaysGenericreplaces the stop-approving race: removal is how approval stops now.Checks
python3 scripts/check_hygiene.py: passed (size=0, test-support=0, debug=0, local-path=0, non-ascii-name=0, multica=0, cjk=0).python3 scripts/check_module_deps.py: passed.git grep -e setApprover -e ApproverCode -e ApproverConfirmation -- ':!docs/adr': no matches.Deviations and questions
setApprover,ApproverCodeorApproverConfirmationremains anywhere in the repository. The only matches left are in ADR 0014's Amend ADR 0014: pairing an iPhone makes it an approver #336 amendment: its Retired list (the list changesetApprover) and its Implementation tasks (file and type names such asApproverConfirmationSheet.swift,ApproverConfirmationFlow,ApproverCode.swift). Those sections record what was retired and how, so this PR keeps their text. It changes only the kind table's note, to say how kind 14 is refused now that the library dropped it.malformed, notunknownKind. The record's plaintext kind is checked first and givesunknownKind. An inner kind byte this build does not know fails the inner layout parse, which every unknown inner kind has always reported asmalformed. The test pins kind 14 to the same point and the same refusal as kind 15 on both paths, so kind 14 is not special-cased. Reporting an unknown inner kind asunknownKindwould change the refusal for every unknown kind and was left out of scope.ApprovalClosedOutcome.cancelledno longer says an approver was "turned off"; the extension'sNotificationProcessor.swiftcomment no longer mentions approval being stopped;LocalizationTestsrenames a local variable that containedApproverCode; from the cross review, README's notification paragraph and comments inBrokerApprovalStateMachine+Approvers.swift,ActiveApproverSetTests.swift,ApprovalPayloadTests.swiftandApprovalVectorTests.swiftno longer describe the retired switch, kinds 11–14 or the code proof's HMAC.