LNS web Draft · 27 November 2026

6. Verification

A client accepts a file from Logos Storage only if its bytes hash to the SHA-256 pinned above it. The record pins the root list, and each list pins what it contains. Nothing from Storage is fetched or shown without a pin. On-chain pages and name icons are the exception: they come with the record (section 6.8).

Describes Names Browser 0.4.6 / core 0.3.6 (source commit 4a3c32a: Main.qml, logic.mjs, storage.rs, lib.rs, links.rs, cache.rs) and the round-3 gateway (serve.mjs, storage.mjs). Verification here means SHA-256 checks only. The record itself is not verified (section 6.11).

6.1 The hash chain

A pinned hash is a SHA-256 written above the bytes it names: in the record for the root list, or in a list entry for a file or subfolder. A client fetches bytes by CID from Logos Storage, hashes them, and compares the result with the pinned hash. Only bytes that match are parsed, drawn, cached or saved.

record (from your LEZ RPC)
  cid  cid.sha256  cid.type=links
  │  fetch cid, hash, compare with cid.sha256
  ▼
root list   ─ entry docs/  CID  sha256
  │  fetch CID, hash, compare, then parse
  ▼
folder list ─ entry intro.html  CID  sha256
  │  fetch CID, hash, compare
  ▼
file bytes  → drawn, cached or saved

A client checks each step before it takes the next. It never parses a list it has not checked, so a bad list cannot point the walk anywhere.

A client MUST compute the SHA-256 of every root list, folder list and file it fetches from Logos Storage, and MUST refuse the bytes if the hash differs from the pinned hash.

Browser: finishBasecampDownloadBytes in Main.qml (Storage module path) and StorageClient::download in storage.rs (HTTP path). Gateway: downloadVerified in serve.mjs and StorageClient.download in storage.mjs.

6.2 Checking a file

Checking a file has three parts: knowing what a CID and a hash each prove, reading the record, and walking the lists down to the file.

6.2.1 CIDs and hashes

The two values in an entry do different jobs. The CID says where to fetch. The SHA-256 says what to accept.

A client MUST treat the SHA-256, not the CID, as the identity of the bytes.

CID form: CID_RE in logic.mjs, is_valid_cid in storage.rs. No multihash decoding exists in either codebase.

6.2.2 Reading the record

A client asks its LEZ RPC for the record of the LNS name in the address. Three text entries describe the site (section 5.8):

EntryWhat the client does with it
cidThe root's CID. A leading cid=, cid: or cid:// is removed. A value that is not a valid CID counts as no site.
cid.sha256The pinned hash of the root. Required whenever cid is set.
cid.typelinks, manifest or single. A hint for how to read the root. Without it the client decides from the bytes, after they pass the hash check.

A client MUST refuse a site whose record has a cid but no valid cid.sha256. It MUST NOT fetch the root in that case.

Browser: Main.qml "Unverified file skipped — LNS record for … has no pinned cid.sha256 hash". Gateway: loadSiteRoot in serve.mjs answers 502 "Unverified site root".

The Names Browser binds the record to the name the user typed, not to any name the RPC returns, so an answer for one name cannot fill another name's older-version cache, avatar or display name.

A client MUST NOT open a bare cid:// address as a site, because nothing pins its hash.

Browser: Main.qml loadNativeStaticNavigation ("Unverified file skipped — direct cid:// URLs have no pinned SHA-256 hash"); core lib.rs fetch_static_site and fetch_site also refuse any root without a valid 64-hex expected_sha256. Section 7 notes where STATIC-PROFILE.md says otherwise.

Although parse_url (links.rs) and parseUrl (logic.mjs) parse cid://<cid>[/path], Names Browser 0.4.6 refuses to fetch or draw one. Because the CID's multihash is never checked against the bytes (section 6.2.1), a bare CID has no integrity check at all. Opening bare cid:// addresses safely in a future build would require verifying the CID multihash (or passing an explicit hash pin), distinguishing an lns-links/1 list from a single file by its # lns-links/1 header (section 5.9), and marking the view as unpinned by any LNS name.

If the record has no cid, the client reads the name's on-chain page instead (section 6.8).

6.2.3 Walking the tree

  1. Fetch the root by cid, hash it, compare with cid.sha256.
  2. If it is a list (cid.type=links or a first line of # lns-links/1), parse it under the rules of section 5.
  3. Resolve the path (section 5.7). For each folder on the way, fetch its list by CID, hash it, compare with the entry's SHA-256, and only then parse it.
  4. Fetch the final file by CID, hash it, compare with its entry's SHA-256.
  5. Render it (section 7), or offer it as a download (section 6.6).

Section 6.9 lists the size caps that apply while fetching.

A client MUST NOT fetch a file or folder whose entry has no SHA-256, and MUST NOT parse a folder list before its hash matches.

Browser: resolveLinksSync in logic.mjs, resolve_links_tree callers in lib.rs, "Unverified file skipped — entry has no pinned SHA-256 hash" in Main.qml. Gateway: requireSha256: true in serve.mjs.

6.3 Caches

Verified bytes are cached under their SHA-256, never under a CID. Two sites that pin the same bytes share one entry. A site cannot place bytes under another site's hash, because an entry is written only when the bytes hash to its key.

A client that caches verified bytes MUST key the cache by SHA-256 and MUST NOT write bytes that do not hash to the key.

put_verified and get_verified in cache.rs; getCachedLinksEntry and getCachedImageEntry in logic.mjs; blobCache.set(expSha, …) in serve.mjs.

6.4 Subresources

A page's subresources are verified the same way as the page. A site-relative reference is resolved through the same tree, so its pin comes from a checked list.

A client MUST NOT fetch a subresource that has no pinned SHA-256.

Browser: resolve_asset_target in lib.rs returns nothing for a cid:// source or an unpinned path, and the asset is counted in skipped_unverified. Gateway: unlisted cid:// references are dropped (serve.mjs).

6.5 New versions

When an LNS name now points to a new root, the new files may take time to arrive. The Names Browser can show the last version it verified for that name while it fetches the new one.

A client that shows a cached older version while it fetches a newer one MUST mark it as older and MUST NOT show it as verified.

formatBadgeState, staleVersionTabState and formatStaleVersionBanner in logic.mjs; tryRenderCachedStaleVersion in Main.qml.

Showing an older version at all is a choice of this implementation, not a requirement. The true wording for 0.4.6 is: "When an LNS name points to a new version and the last version this browser verified is still in its local cache, the browser shows that cached version, marked as older, while it fetches the new one."

Gateway. The gateway has no older-version banner. If the chain lookup fails, it keeps serving the last record it resolved for a name for up to 24 hours, and its responses allow CDN caches to serve stale copies on error for the same time. Neither is marked as older. Section 8 has the details.

6.6 Downloads

A file the browser does not render, such as .lgx, .zip, .dmg or .pdf, or a link with a download attribute, is offered as a download. Nothing is saved without a click.

  1. The user clicks Save. The browser resolves the file's CID and pinned SHA-256 through the verified tree.
  2. A confirmation shows the checked filename, the CID and the pinned hash. Filenames with control or BiDi characters, a leading dot, or any of / \ : * ? " < > | are refused.
  3. After the user confirms, the file is fetched into a private staging file in the cache folder.
  4. The core hashes the staging file. Only if it matches the pin is it moved into Downloads. Otherwise it is deleted and nothing reaches Downloads.

A client MUST ask the user before saving a file, MUST refuse a download that has no pinned SHA-256, and MUST NOT place a file in the user's Downloads folder before its hash matches.

prepareDownloadConfirmation in logic.mjs; finalize_staged_download_in_dir and the direct save path in lib.rs.

At most 16 download buttons are shown for a page. The gateway sends downloads with the same hash check as any other file.

6.7 What is refused

CaseNames BrowserGateway
Record has cid but no valid cid.sha256Error page, nothing fetched502
Bare cid:// addressError page, nothing fetchedNot applicable: gateway addresses are LNS names
Root, list or page hash mismatchError page "SHA-256 mismatch"502, no byte sent
Entry without a SHA-256"Unverified file skipped"502
Subresource unpinned or mismatchedNot drawn, counted as skipped502 when requested
Image or font with the wrong magic bytesNot drawn, not cachedHash-checked like any file; its Content-Type comes from an extension allowlist (section 8)
Fetch over its size capError or skipped413
Bad list (section 5)Error page502

6.8 On-chain pages and avatars

Two kinds of content come straight from the record through the RPC, not from Storage. There is no pin above them, so there is nothing to check them against.

The browser hashes both locally. That hash is only a cache key. It is not a check, because it is computed from the same bytes the RPC sent.

A client MUST refuse an on-chain root list of 10,240 bytes or more.

Main.qml (MAX_ONCHAIN_LINKS_BYTES); loadSiteRoot in serve.mjs. The gateway also refuses any on-chain page over 80 KiB (MAX_ONCHAIN_PAGE_BYTES).

6.9 Size caps while fetching

The Names Browser has two fetch paths with different caps. Both stop reading once a cap is passed.

What is fetchedBasecamp Storage module path (hashed in QML)External Storage node path (hashed in Rust)
Folder list2 MiB10 MiB per fetch, then the list limit of 2 MiB applies
Page (HTML root or file)512 KiB10 MiB per fetch
Stylesheet256 KiB10 MiB per fetch
SVG image64 KiB, also when sniffed in the first chunk10 MiB per fetch; SVG over 64 KiB is not drawn
Other assets4 MiB10 MiB per fetch; images over 4 MiB are not drawn

On the Basecamp Storage module path, a root whose record sets cid.type=links gets the 2 MiB folder-list cap; without cid.type=links, the root starts under the 512 KiB page cap (Main.qml). Section 7 lists the rendering caps that apply after a file is verified.

6.10 The gateway

The gateway applies the same pins before it sends a byte:

Section 8 covers what the gateway does after verification: sanitizing, headers and caching.

6.11 What is not verified

True claim wording. "Every file from Logos Storage is checked against the SHA-256 pinned in the LNS record (or its folder list) returned by your LEZ RPC before it is shown or saved, and a mismatch is refused. Small on-chain pages and name icons come directly from the LNS record through the RPC."

Use "returned by your LEZ RPC". Do not say a file is checked against "the on-chain record" without it.

Section 10 covers the trust model in full.