Expand description
Sites: the places a credential is used (roadmap R40).
A password manager keys a login to one URL. This vault keys it to an entry (a stable id and a
name) and lets the entry list several places: a login page, an API address, a service on the
LAN with its own port. A Site is only a normalised address. Nothing here reads a secret.
Three rules decide whether a page may be offered a credential, and each is here because a wrong answer fills a password into the wrong place:
- The host is compared after normalisation (lower case, no trailing dot, punycode), so
Example.COM.andexample.comare one site andpaypa1.comis notpaypal.com. - Every loopback spelling is one host (
localhost,*.localhost,127.0.0.0/8,::1), so a password saved forlocalhost:8989also answers at127.0.0.1:8989. The port stays significant: Sonarr and Radarr share a host and are different services. - A site stored without a scheme matches
https, and matcheshttponly on a private or loopback host, so a public site is never downgraded to plain text by a missing scheme.
The Rust side is the only implementation (invariant 10): the desktop reaches it over IPC and the extension host calls it directly.
Structs§
- Entry
Site - One address on an entry, as stored in the entry’s
sitesarray. - Family
- A named set of hosts that share a credential (for example MetaBrainz and its sister sites).
- Site
- A normalised address: scheme if one was given, host, port if one was given. The path, query and fragment are dropped, because a credential belongs to a service and not to a page of it.
Enums§
- Mode
- How strictly an origin must equal a stored site.
Constants§
- KINDS
- What a site is for. Free text is refused so the list stays something a UI can offer.
Functions§
- add_
site - Adds
value(fromsite_value) to the entry unless the same address is already there. Returns whether it was added. - alternate_
spellings - Pairs of addresses that name the same place in a different spelling:
localhost:8989and127.0.0.1:8989, ortv.example.organdhttps://tv.example.org. Both are kept (a stored address is never rewritten), but a person adding the second usually did not mean to. The same text twice is not a pair, and addresses that do not parse are skipped. - builtin_
families - The families that ship with the program (
data/site-families.json). - entry_
offered - Whether the entry may be offered at
origin: one of its sites matches, or the family it names has the origin’s host. A result oftruestill only means “offer it”. - entry_
sites - Every address an entry answers to: its
sites, plus the olderapi_urlread as one more site (awebsite for a password,apifor anything else), so nothing needs a migration. - families
- The families kept in the vault:
site_families: [{name, hosts}]. - family_
add - Adds hosts to the named family (creating it). Hosts are normalised to a bare host; a scheme, port or path in the input is dropped, because a family is a set of hosts.
- family_
has - Whether
originis a host of the family. The family host itself and its subdomains match; a look-alike (evilmusicbrainz.org) does not. A public host is matched overhttpsonly. - family_
remove - Removes a host from a family, or the whole family when
hostisNone. Returns whether anything was removed. - guess_
kind - The kind a bare address most likely has: a private host is
local, anapi.host isapi, anything else isweb. - is_
loopback - True for every spelling of this machine:
localhost,*.localhost(RFC 6761),127.0.0.0/8,::1and its IPv4-mapped form. - is_
private_ host - A host that is not on the public internet: loopback, RFC 1918 and link-local addresses, a
single-label name, and the names a home network uses (
.local,.lan,.home,.internal). - known_
families - Every family an entry may name: the ones in the vault, then the shipped ones whose name the vault does not use (a family of yours with the same name replaces the shipped one).
- parse_
site - Normalises
input: a full URL (https://sonarr.home:8989/app), an address and port (192.168.1.20:8989), or a bare host (localhost). - remove_
site - Removes the site that normalises to
input. Returns whether one was removed. - site_
matches - Whether a page at
originmay be offered a credential stored forstored. - site_
value - Builds the stored form of one site. The address is normalised, so what is stored is what is matched; the path of a URL is dropped (a credential belongs to a service, not a page).