security: gate verify screen confirmation behind an in-app-only arm (#34) - #73
Open
konkomaji wants to merge 1 commit into
Open
security: gate verify screen confirmation behind an in-app-only arm (#34)#73konkomaji wants to merge 1 commit into
konkomaji wants to merge 1 commit into
Conversation
…i5arga#34) protestchat:// deep links, QR codes on a website, or another app could push straight onto /verify/<id> with a live "They match, mark verified" button, skipping the in-person comparison that verification exists to prove happened. That is a social-engineering assist against the one MITM defence the app has (A5), aimed at stressed, non-expert users. The confirm/deny buttons are now gated on an in-memory, single-use flag that only the in-app Verify press in chat can set (src/lib/verify-session.ts). A screen reached any other way still shows the correct safety-number digits, since a link cannot forge them either way, but offers no confirmation action. Translations for verify.externalOrigin across hi/bn/mr/te/ta are a best effort and should get the same native-speaker review noted for the rest of the i18n work.
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.
Why
app.jsonregisters theprotestchat://scheme, and expo-router auto-linking meant any website, QR code, or other app could pushprotestchat://verify/<publicId>straight onto the navigation stack, landing on a live "They match, mark verified" button with zero confirmation.A link cannot forge a matching safety number, but it delivers a pre-armed verification UI outside the in-person ritual, a social-engineering assist against the app's one MITM defence (A5), aimed at exactly the stressed, non-expert users the threat model describes: "Your organizer sent you this link to verify them, tap here, the numbers match."
What changed
src/lib/verify-session.ts: an in-memory, single-use "this id was armed by the in-app Verify press" flag. A URL cannot set it, since whatever a link puts in/verify/<id>is exactly the same param the in-app button would have produced, so origin has to be proven by something a link literally cannot carry.src/app/chat/[id].tsx: the existing "Verify" action in the mode notice now callsarmVerification(conversationId)immediately before navigating.src/app/verify/[id].tsx: consumes the arm once on mount. If armed, behaviour is unchanged (match / no-match buttons). If not armed, meaning the screen was reached by deep link, QR, or another app, it still shows the correct safety-number digits (a link cannot forge those either way) but replaces the confirmation buttons with a caution notice explaining verification has to be started from the person's chat.contact?.verifiedundo path is untouched; downgrading trust needs no gate.Test plan
npm test(236 tests, including 5 new for the arm/consume/expiry behaviour inverify-session.test.ts)npm run typechecknpm run lintnpm run i18n:checkprotestchat://verify/<id>from outside the app on a device and confirm the caution notice appears with no confirm actionSafety / docs
docs/THREAT-MODEL.mdFixed section updated with this entry.verify.externalOriginadded to all six locales. The hi/bn/mr/te/ta translations are a best effort on my part and should get the same native-speaker review already noted for the rest of the i18n work.Closes #34