Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/domain-lists.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Domain lists
# Builds the domain-list pack (scripts/domain-lists.ts) and publishes it as assets of the release
# `domain-lists-<date>`, then points the release `domain-lists` at it by replacing its manifest.json. The CLIs read
# that manifest (`domain-lists update`). Neither release is ever marked Latest: that stays the package's.
on:
schedule:
- cron: "17 4 * * 1"
workflow_dispatch:
inputs:
publish:
description: "Publish the pack as a release (off: build and keep it as a workflow artifact only)"
type: boolean
default: true

concurrency:
group: domain-lists
cancel-in-progress: false

permissions: {}

jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 # v6.1.0
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 24
package-manager-cache: false
- run: pnpm install --frozen-lockfile
- run: node --max-old-space-size=4096 --experimental-strip-types scripts/domain-lists.ts pack
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: domain-lists
path: pack/
if-no-files-found: error

publish:
needs: build
if: github.event_name == 'schedule' || inputs.publish
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: domain-lists
path: pack
- name: publish the dated release, then move the pointer
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
TARGET: ${{ github.sha }}
run: |
version=$(jq -r .version pack/manifest.json)
{
echo "Domain lists ${version}, built by scripts/domain-lists.ts. Download with \`domain-lists update\`."
echo
echo "| Source | Signal | Lines | Licence | Class | Credit |"
echo "|---|---|---|---|---|---|"
jq -r '.sources[] | "| \(.title) | \(.signal) | \(.count // "fetched from the source") | [\(.licence)](\(.licence_url)) | \(.class) | \(.attribution) |"' pack/manifest.json
} > notes.md
tag="domain-lists-${version}"
if gh release view "$tag" > /dev/null 2>&1; then
gh release upload "$tag" pack/* --clobber
else
gh release create "$tag" pack/* --target "$TARGET" --latest=false --title "Domain lists ${version}" --notes-file notes.md
fi
if ! gh release view domain-lists > /dev/null 2>&1; then
gh release create domain-lists --target "$TARGET" --latest=false --title "Domain lists (newest)" \
--notes "Holds only manifest.json, which points at the newest dated domain-lists release."
fi
gh release upload domain-lists pack/manifest.json --clobber
22 changes: 22 additions & 0 deletions THIRD_PARTY_NOTICES
Original file line number Diff line number Diff line change
Expand Up @@ -827,3 +827,25 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The free-mail provider list (src/domain/free-mail-domains.generated.ts) is derived from free-email-domains
(https://github.com/microlinkhq/free-email-domains), under the MIT License:

The MIT License (MIT)

Copyright © 2017 Microlink <hello@microlink.io> (microlink.io)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit
persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

The domain-list pack that `domain-lists update` downloads is not part of this package. Each of its sources keeps its
own licence, credit and licence class, listed in the pack's manifest.json and by `domain-lists list`.
23 changes: 23 additions & 0 deletions changes/feat-domain-list-pack.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
### Added

- **The domain-list pack: more organizations get a sector, and the lists update without a release.**
`domainListsCommand` (experimental) gives a CLI `domain-lists update` and `domain-lists list`. `update` downloads the
newest pack from WireCat's GitHub release `domain-lists`, each file checked by sha256 the way `models download` checks
a model, and swaps the pack folder whole. The first pack holds UT1's sector and webmail lists (CC BY-SA 4.0, their
own files), the FDIC-insured US banks, UT1's malware and cryptojacking hosts, and Stop Forum Spam's toxic domains,
which each computer fetches from Stop Forum Spam itself because its terms forbid redistribution. Each source carries
its licence, credit and class: `commercial-ok`, or `non-commercial`, which WireCat may use and a paid service may
not; `--commercial-only` leaves those out. Sender domains are matched on this computer only, never sent anywhere.
Two sectors come from the pack, `gaming_gambling` and `adult`. UT1's webmail providers never make an organization.
Spam and malware lists never set a sector: the lookup reports them apart, for exact host names only, and nothing
reads them yet. `.github/workflows/domain-lists.yml` builds and publishes the pack weekly.
- **About 23,000 more free-mail providers are never an organization.** Built in from microlink's free-email-domains
(MIT), less the domains Wikidata calls an organization, such as `sky.com` or `orange.fr`, whose own bills come from
that domain. An organization already made on a domain that is now free mail stays.

### Changed — experimental

- **A sector from the rules is changed or removed when a newer list no longer gives it.** Rules mark their sector
`metadata.sector_by = 'rules'`; a sector with any other `sector_by` is the owner's and stays. When the built-in table
or the pack changes, the next kind pass works out every organization's sector again. An organization's `sector` can
now also be `gaming_gambling` or `adult`.
41 changes: 33 additions & 8 deletions docs/dev/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -724,20 +724,45 @@ proposes them instead. A no-reply address (`isNoReplyAddress`) is no one's: it n
(`registrableOf`, so `mail.bank.example` is `bank.example`): the organization already holding an address there, else
a new `company` named by the sender when the name is a company's or the domain's own word, else by the domain. Its
addresses go to `organization_identities` with method `domain`, author `rules`, and a bot's `sender_bots.organization_id`
is set (`people.listBots` filters by it). A human with an address there gets a `member-of` link (author `rule`), never a merge and never a proposal; a
human alone makes no organization. Free mail (`FREE_MAIL`), throwaway mail (`disposable-email-domains-js`) and
sending platforms (`SENDING_PLATFORMS`) are never a company domain. Two organizations holding one domain leave it
is set (`people.listBots` filters by it). A human with an address there gets a `member-of` link (author `rule`),
never a merge and never a proposal; a human alone makes no organization. Free mail (`FREE_MAIL`; about 23,000
providers in `src/domain/free-mail-domains.generated.ts`, built by `scripts/free-mail-domains.ts` from microlink's
MIT list less the domains Wikidata calls an organization; and the pack's `freemail` lists, UT1 `webmail`), throwaway
mail (`disposable-email-domains-js`) and sending platforms (`SENDING_PLATFORMS`) are never a company domain. An
organization made before its domain joined a free-mail list stays. Two organizations holding one domain leave it
ungrouped. Each organization holding a company domain takes that domain's `metadata.sector` (`Organization.sector`:
`airline`, `bank`, `financial`, `telecom`, `social`, `shop`, `delivery`, `news`, `government`; the first in that
order when its domains differ), from `src/domain/organization-sectors.generated.ts`. That table is built into the
package at release by `scripts/organization-sectors.ts` from the official websites (P856) of Wikidata items (CC0),
so nothing is looked up per sender. A sector is what an organization does; `Category` (client, supplier, …) is what
it is to the owner. The owner's word holds: a removed `member-of` leaves a rejected `relationship` proposal the rule checks;
`airline`, `bank`, `financial`, `telecom`, `social`, `shop`, `delivery`, `news`, `government`, then the pack's
`gaming_gambling` and `adult`; the first in that order when its domains differ). The built-in table wins:
`src/domain/organization-sectors.generated.ts`, built at release by `scripts/organization-sectors.ts` from the
official websites (P856) of Wikidata items (CC0). The domain-list pack fills its gaps (below). Nothing is looked up
per sender. A rule's sector carries `metadata.sector_by = 'rules'` (none on those #3350 wrote, read the same); a
newer table or pack changes or removes it, and any other `sector_by` is the owner's, which no rule touches. The store
keeps which lists it last worked sectors out from (`store_settings` key `organizations.sectors_from`: the table's
build date, the pack's version and its sources); when that changes, the next kind pass works out every
organization's sector again, and otherwise only those it makes. A sector is what an organization does; `Category`
(client, supplier, …) is what it is to the owner. The owner's word holds: a removed `member-of` leaves a rejected
`relationship` proposal the rule checks;
`knowledge.eraseOrganization` leaves a rejected `organization-domain` proposal per domain, so the rule never remakes
it; `moveToPerson` drops the rule's holds on the moved identities, and a person the owner kept as one holds nothing.
`people.similar` serves a form that adds a person: names starting like the typed words, the same `variantKey` first;
a `name:` search looks for the typed text in both scripts (`spellings`). Each row's `usernameSource` names the
messenger its `@username` belongs to.
- **The domain-list pack** (`src/domain/domain-lists.ts`, `src/services/domain-lists-download.ts`, the `domain-lists`
command). Lists too big, too often updated or share-alike for the package: UT1's sector categories and its webmail
list (CC BY-SA 4.0, their own files, so share-alike stays on them), FDIC-insured US banks, UT1 malware and
cryptojacking hosts, and Stop Forum Spam's toxic domains. `scripts/domain-lists.ts` builds one gzip file per source
and `manifest.json`; `.github/workflows/domain-lists.yml` (weekly, or by hand) publishes them as assets of the
release `domain-lists-<date>` and replaces `manifest.json` on the release `domain-lists`, the pointer the CLIs read.
Neither is marked Latest. `domain-lists update` downloads like `models download`: `installFiles` checks each file
against the manifest's sha256 as it arrives, then the pack folder (`<WireCat state>/lists/domains`) is swapped whole.
A list whose terms forbid redistribution (`upstream`, Stop Forum Spam) is fetched whole from its source by each
computer; its sha256 is recorded as it came. Each source carries its licence, credit and class: `commercial-ok`, or
`non-commercial`, which WireCat may use since it is free and a paid service may not. `--commercial-only` leaves
those out, and `lookupDomains(…, { commercialOnly: true })` skips them where they are installed. `sector` lists set
a sector; `freemail` lists keep a domain from ever making an organization (`isPackFreeMailDomain`, held in memory:
a few hundred domains); `bad` lists only say a host is known for malware or spam, match exact hosts (an entry for
`click.mail.brand.example` says nothing about `brand.example`) and never set a sector. `lookupDomains` reads each
list from disk a megabyte at a time for the hosts asked, since the biggest has hundreds of thousands of lines.

**Links and the review list.** A link records its method, confidence, author and time; an owner's link is never
replaced by a rule. Today only contacts have that shape. Who may be one person waits as an `identity_link` proposal; an
Expand Down
1 change: 1 addition & 0 deletions docs/reasons.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ headings.
| `document.scan-unturned` | `configuration_error` | tesseract has no osd data, so a page on its side is read as it lies; install it to read scans again | |
| `document.version-missing` | `not_found` | the local copy holds no such version of the document | |
| `documents.other-account` | `configuration_error` | the documents are signed in as another account than the tracker copy of the same provider | |
| `domain-lists.offline` | `permission_error` | updating the domain lists needs the network; --offline was requested | |
| `download.mismatch` | `invalid_response` | the downloaded file has other content than the listing said | |
| `enrichment.owner-only` | `permission_error` | only the owner turns enrichment on, not an agent | |
| `event.conference-exists` | `validation_error` | the event has a meeting link already, which its attendees use | |
Expand Down
2 changes: 1 addition & 1 deletion docs/storage/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ CREATE VIRTUAL TABLE identities_fts USING fts5(name, username, content='identiti

### `organizations`

A company, team, family or community the owner deals with. Projects, work accounts and people's identities belong to one. `metadata.sector` says what it does (`bank`, `airline`, `shop`, …), set from the company domains it holds and the Wikidata list built into the package.
A company, team, family or community the owner deals with. Projects, work accounts and people's identities belong to one. `metadata.sector` says what it does (`bank`, `airline`, `shop`, …), set from the company domains it holds, the Wikidata list built into the package and the domain-list pack; `metadata.sector_by` is `rules` for a rule's sector, which a newer list changes or removes.

| Column | Type | Constraints | References | Meaning |
|---|---|---|---|---|
Expand Down
Loading
Loading