mirror of
https://github.com/pezkuwichain/pezkuwi-wallet-android.git
synced 2026-11-20 01:26:11 +00:00
425079281c5f9992286e3b12a1fe4e4ac4546b48
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
425079281c |
Resolve and serve .kurd sites from verified content, never via DNS (#37)
* Resolve .kurd names on chain and keep them away from DNS and search The Navnisan pallet is live on Zagros People. The wallet now reads a name's record and every ancestor's at one finalized block, checks that each record sits under the parent its name implies, and judges validity the way the pallet does (expiry, 30-day grace for leases, a subname valid only under the registration it was set against). Records are decoded by hand, so a lookup does not depend on the chain's runtime being loaded; the decoder is tested against records read from the live chain, and namehash against the vectors the pallet pins. Names are read through the light client, which proves each value. The chain's own connection is RPC first, so it is not used for names. When the light client cannot answer, two RPC nodes on different hosts must return the same records; an answer reached that way is marked unverified, and an official, institutional, reserved or zone name is then refused rather than opened. The light client tracked its users with one set, so the RPC fallback releasing a chain would stop it under any other reader. Each holder now keeps its own lease. A .kurd host never reaches system DNS or the search engine: the search box offers no web address or search for it, and the DApp browser answers every request to such a host itself, including loadUrl and resources a page embeds. The DuckDuckGo query is now URL-encoded. * Verify .kurd site content block by block A name's content is an IPFS CID on chain; mirrors serve it as a CAR. Every block in the CAR is checked against its CID while it is read, and one block that does not match refuses the whole CAR, so a mirror can withhold content but cannot change it. Files are then assembled only by following CIDs taken from blocks already checked, starting from the CID the chain gave rather than the roots the CAR claims. Supported: CIDv1 and CIDv0, dag-pb and raw, sha2-256 and inlined identity blocks; UnixFS files of any chunking, plain directories and HAMT-sharded directories (murmur3-x64-64, as Kubo builds them). An ipns contenthash, a symlink, an escaping path segment or a file over 32 MiB is refused. Tested against CARs Kubo produced, taken unchanged from ipfs/gateway-conformance (MIT / Apache-2.0), including a 238-shard HAMT, a CAR with a missing block and nodes with their fields in either order; murmur3 also against Guava's reference vector. * Serve .kurd sites from verified content under their own origin The DApp browser now answers https://<name>.kurd itself: the name is resolved on chain, its content root fetched from IPFS trustless gateways as a CAR for the requested path, verified block by block, and only then served. The page's origin is the full name, so cookies, storage and permissions belong to that name alone, and every response carries a policy the wallet writes: nothing loads or connects outside the name, no workers, no framing. Gateways are tried in order and one that fails, withholds or changes a block is skipped. A gateway saying "not found" is believed only once the parent directory, verified, shows the name is absent. A directory is served through its index.html. The gateway list is the signed kurd/gateways.json from the config repository when it can be read, otherwise the gateways measured reachable from Turkiye; entries can only be https origins. Bad paths (dot segments, encoded slashes, malformed escapes, non-UTF-8) are refused before any lookup. A refused, missing or unavailable name, ipns content and feeds get their own status; a name's resolution is reused for a minute so one page does not resolve it once per resource. * Give the runtime component the app's HTTP client for .kurd content The site server fetches CARs over the shared client, so gateway requests use the same DNS-over-HTTPS-first resolver as the rest of the app. * Hear the DApp bridge only from the top frame of the page shown The polkadot-js and MetaMask bridges were exposed with addJavascriptInterface, which every frame of a page can call. A third-party frame inside an authorised DApp -- an ad, an embed -- could ask for the account list or a signature, and the request was shown in the DApp's name, because authorisation follows the page the tab shows. The bridges now use a web message listener: the WebView reports each message's origin and frame, and only a message from the top frame whose origin is the page shown is heard. On a WebView too old to report them, the bridge stays off instead of trusting the page. The bridge is also added before the tab's first load, since it reaches only documents loaded after it. * Let .kurd pages reach the chain through the wallet's connection A .kurd page may only connect to its own name, so it cannot open a node connection of its own. The provider half of the polkadot-js extension API (pub(rpc.listProviders, startProvider, send, subscribe, subscribeConnected)) now answers it over the wallet's connection to Pezkuwi and Zagros relay, Asset Hub and People, which falls back to the light client. Offered only when the tab shows a .kurd page, judged by the WebView's page rather than the message. Only calls that read state, estimate fees or submit an extrinsic the user already signed pass; key, peer and offchain methods do not. A subscription ends when the tab leaves the page's origin. Calls are answered off the request queue so a slow node does not hold up the page, and params are forwarded as the page wrote them rather than reparsed (a block number must not become 123.0). * Offer a typed .kurd name in DApp search as the name itself Typing a valid .kurd name now shows it under its own heading, with the shield and "resolved on chain, never sent to a search engine", and opens https://<name>/ in the browser. An invalid one is offered nowhere: not as a web address, not as a search. * Let runtime unit tests log a warning with its cause The test stand-in for android.util.Log had no w(tag, msg, throwable), so any code under test that logged a failure that way stopped with NoSuchMethodError instead of carrying on: the .kurd fetcher logs each gateway it skips. * Show what was verified about a .kurd page, and stop at what was not The address bar of a .kurd page carries a badge in place of the padlock: Official for a name Parliament gave, Registered for a bought one, Not verified for one the reader chose to open on two RPC nodes' word. Tapping it shows the block the name was proven at, the owner (a state institution or an account), the content CID, and a button to clear the site's storage, cookies and permissions. A page that did not open is replaced by a notice instead of a blank page: an official name that cannot be verified now (retry, never open), a name read through RPC nodes only (go back, or open anyway), an unregistered name, a name without a site, and content no mirror could deliver verifiably. Behind it the site server keeps each name's page state, set only by the page's own document, and holds back a name read through RPC nodes until the reader chooses to open it. Texts in Kurmanji, English and Turkish. * Warn before opening a .kurd name that imitates an official one Zone names are institutional by construction, and the commonest imitation folds the zone into the label: serok-gov.kurd or serokgov.kurd for serok.gov.kurd. When a typed name has such a candidate and the candidate resolves, proven, as an official name, search asks first: go to the official name, or open the typed one anyway. The check runs only for names with a candidate and gives up after a few seconds; the opened page still shows by its badge whether it is official. * Say on the signing screen what kind of .kurd name asks A signature requested from a .kurd page now names the page by its .kurd name with its kind: Official, Bought (not official) or Not verified. For a name that is not official, the reader is told to check the full name, since the state did not give it; for one opened without proof, to sign only when sure whose site it is. * Judge a DApp request by the page that sent it, not the page shown by then Bridge requests are handled one at a time, after they arrive. A page could send a request and navigate at once, and its request was then authorised, and named on the signing screen, as the next page's: a .kurd page could have its signature request shown as Official by moving to an official name. Every request now carries the origin the WebView reported for its message (the polkadot-js url the page writes is no longer read). A request whose origin is not the page shown when it is handled is refused, and the signing screen is built from the asking origin's own .kurd state, refusing as well if the tab has moved on. * Serve .kurd feeds from their publisher's newest signed release A feed name (a site that changes many times a day) carries its publisher's key and an anchor: the newest release the chain was told of. The wallet asks the gateways for the publisher's IPNS record, verifies each against the key the chain gives (never the key in the record or its name), refuses expired ones, V1-only ones and ones whose legacy fields contradict the signed data, and serves the newest release at or past the anchor. When none is confirmed, it serves the anchor itself and the browser says that a newer version could not be found; the release the chain already names is always served from the chain's root. Verification is tested against records Kubo signed, taken unchanged from ipfs/gateway-conformance (MIT / Apache-2.0). |
||
|
|
a294aa1a6b |
Initial commit: Pezkuwi Wallet Android
Security hardened release: - Code obfuscation enabled (minifyEnabled=true, shrinkResources=true) - Sensitive files excluded (google-services.json, keystores) - Branch.io key moved to BuildConfig placeholder - Updated dependencies: OkHttp 4.12.0, Gson 2.10.1, BouncyCastle 1.77 - Comprehensive ProGuard rules for crypto wallet - Navigation 2.7.7, Lifecycle 2.7.0, ConstraintLayout 2.1.4 |