-
Notifications
You must be signed in to change notification settings - Fork 69
feat: Origin identification proposal #91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
feat: Origin identification proposal #91
Conversation
|
|
||
| **Response statuses:** | ||
|
|
||
| - **Phase 1** (first 6 months): `ok`, `unknown` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It’s not obvious to a future reader whether we’re in Phase 1 or Phase 2 right now. Could we add something to make the current phase clear? Add dates?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can only add dates after we start the rollout.
|
|
||
| 3) **Rollout Phase Awareness** | ||
|
|
||
| - **Phase 1 (first 6 months)**: Only `ok` and `unknown` statuses returned |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On the one hand, this should be obvious, but still — why do we need to split the rollout into two phases? Why can’t we just show the statuses right away?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we need time to update sdk on the dapps side, otherwise we don't have guarantees that client connects to the bridge before opening wallet.
| - `ok` + whitelisted domain → show verification mark ✅ | ||
| - `danger` → display strong warning, recommend declining | ||
| - `warning` → display caution message | ||
| - `unknown` → proceed without special indicators |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if /verify endpoint is not available or wallet gets an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be treated as danger
Proposal: Enhancing End-User Security in TonConnect with origin information
1. Summary
We are introducing a verification step in TonConnect that allows wallets to confirm the true source of both connection and transaction requests, and allows users to further assess the legitimacy of the transaction by following best practices from other fields (e.g., Google, Apple, Telegram).
Just like these platforms, wallets will be able to show users where the request came from and what device or environment initiated it, giving them clear context before approving.
This protects users from phishing and impersonation attacks while requiring no changes from dApps and keeping backward compatibility.
2. Problem
Today, wallets have no reliable way to know if a request truly comes from the dApp the user sees. Attackers can impersonate legitimate dApps, send requests through their backend, and trick users into connecting or signing malicious transactions.
3. Solution
We will have the TonConnect bridge capture the origin, User-Agent and IP address for each connection and message request.
4. Benefits
okresult comes from a whitelisted domain.5. Wallet Implementation Effort Estimate
/verifyfor connects6. Technical Details
6.1 Connect Verification
The TonConnect bridge stores:
Wallet sends:
POST ${TonConnectBridgeUrl}/verify{ "type": "connect", "client_id": "<id>", "origin": "<protocol+domain>" }Statuses returned:
ok,unknownok,danger,warningIf status is
okand the domain is on the whitelist → wallet shows verification mark.6.2 Transaction Verification
When the bridge receives a message, it collects the request source data into the following struct:
Process:
BridgeRequestSourcestruct to JSON.tofield in message) with:box.SealAnonymous(nil, data, receiverSessionPublicKey, rand.Reader)BridgeRequestSource string `json:"request_source"`Wallet handling:
request_source.BridgeRequestSourceJSON.6.3 Rollout Plan
Phase 1 – First 6 months
/verifyfor connects: onlyokandunknown.BridgeRequestSource.ok+ whitelisted domain → verification mark shown.Phase 2 – Following 6 months
/verifyfor connects:ok,danger,warning.6.4 Wallet Integration Process Standard
Connection Verification
client_id,origin,IP./verifywith typeconnect.Transaction Verification
request_source(base64-encoded encryptedBridgeRequestSource) in the message payload.POST /myip(can be cached) endpoint for comparison6.5 Sample Wallet Messages
Danger:
Warning:
Verification Mark (ok + whitelisted):
✅ Verified dApp — confirmed request from a trusted source.