domain-gate 3.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. domain_gate-3.0.0/CHANGELOG.md +31 -0
  2. domain_gate-3.0.0/DISCLAIMER.md +13 -0
  3. domain_gate-3.0.0/LICENSE +21 -0
  4. domain_gate-3.0.0/MANIFEST.in +10 -0
  5. domain_gate-3.0.0/NOTICE-PSL.md +8 -0
  6. domain_gate-3.0.0/PKG-INFO +213 -0
  7. domain_gate-3.0.0/README.md +190 -0
  8. domain_gate-3.0.0/SECURITY.md +12 -0
  9. domain_gate-3.0.0/domain_gate.egg-info/PKG-INFO +213 -0
  10. domain_gate-3.0.0/domain_gate.egg-info/SOURCES.txt +28 -0
  11. domain_gate-3.0.0/domain_gate.egg-info/dependency_links.txt +1 -0
  12. domain_gate-3.0.0/domain_gate.egg-info/entry_points.txt +3 -0
  13. domain_gate-3.0.0/domain_gate.egg-info/requires.txt +8 -0
  14. domain_gate-3.0.0/domain_gate.egg-info/top_level.txt +3 -0
  15. domain_gate-3.0.0/domain_gate.py +2395 -0
  16. domain_gate-3.0.0/domain_gate_mcp.py +128 -0
  17. domain_gate-3.0.0/domain_gate_psl.py +10549 -0
  18. domain_gate-3.0.0/pyproject.toml +35 -0
  19. domain_gate-3.0.0/requirements.txt +3 -0
  20. domain_gate-3.0.0/setup.cfg +4 -0
  21. domain_gate-3.0.0/tests/fixtures/rdap_established-example-store.com.json +107 -0
  22. domain_gate-3.0.0/tests/fixtures/rdap_sample-store-a.com.json +1 -0
  23. domain_gate-3.0.0/tests/fixtures/rdap_sample-store-b.com.json +1 -0
  24. domain_gate-3.0.0/tests/fixtures/rdap_sample-store-c.com.json +1 -0
  25. domain_gate-3.0.0/tests/fixtures/rdap_sample-store-d.com.json +1 -0
  26. domain_gate-3.0.0/tests/fixtures/rdap_young-example-mid.cyou.json +107 -0
  27. domain_gate-3.0.0/tests/fixtures/rdap_young-example-store.com.json +1 -0
  28. domain_gate-3.0.0/tests/test_domain_gate.py +885 -0
  29. domain_gate-3.0.0/tests/test_hardening.py +948 -0
  30. domain_gate-3.0.0/tests/test_mcp.py +71 -0
@@ -0,0 +1,31 @@
1
+ # Changelog
2
+
3
+ ## 3.0.0
4
+ Hardening release. Every item below has tests (offline; 199 at release) and most were checked by mutation (break the fix, watch the test fail).
5
+
6
+ **Correctness**
7
+ - Registrable domain now uses the Public Suffix List (was a hand-rolled table that was wrong for 29 of 38 probe cases). Platform subdomains (`*.myshopify.com`, `*.github.io`, ...) are treated as platform-hosted, not as the platform's age; CentralNic registry SLDs (`*.us.com`) are real registrations.
8
+ - Allowlist is exact-match plus an explicit list of country storefronts (was suffix-match, and missed `amazon.de`, `walmart.ca`, ...). Marketplaces get a "judge the seller, not the marketplace" note. Mixed-script IDN labels are flagged (homograph spoofing); `xn--` Latin IDNs are fine.
9
+ - A live TLS certificate's issue date is no longer used as an age (renewals made old stores look brand new and SKIP).
10
+ - A TLS handshake that never completes (EOF, reset, timeout, refused) is `ssl_unreachable` at a lower weight, not "bad certificate"; apex failures fall back to `www`.
11
+ - `.com.co` was wrongly routed to CentralNic (404); `.us` had no registry RDAP route; `.au` hides creation dates by policy and is treated as *unknown* instead of *young*.
12
+ - Invalid and duplicate inputs in batches were collapsed incorrectly.
13
+ - A long-lived gate no longer ages domains from its start time.
14
+
15
+ **Politeness and resilience**
16
+ - Built-in per-host rate limiting (rdap.org: 1 request per 1.1 s, under its 10 per 10 s limit), `Retry-After` honoured (capped at 30 s; `0` is not treated as permission), thread-safe, never sleeps while holding the lock.
17
+ - Negative and proxy results expire (a cached 404 can hide a newly registered domain): TTLs by kind.
18
+ - Port-43 WHOIS fallback for 37 ccTLDs with a circuit breaker; failures are never cached.
19
+ - crt.sh is skipped for domains whose registry date already shows they are over a year old.
20
+ - `--rdap-direct` / `DOMAIN_GATE_RDAP=direct`: query registry RDAP servers via the IANA bootstrap and never rdap.org.
21
+
22
+ **New**
23
+ - Advisory disclaimer (`DISCLAIMER.md`, README, MCP tool descriptions, and a `disclaimer` field on every JSON/MCP result). Results describe domain signals, not a determination that a site is a scam.
24
+ - Offline fixtures are synthetic (no captured third-party domain RDAP).
25
+ - `--score`: additive 0-100+ score with `BLOCK` (>=50), `REVIEW` (25-49), `PASS` (<25) bands.
26
+ - `--redirects`: follow the storefront's redirects and judge the destination too; refuses non-public targets (SSRF guard).
27
+ - `domain-gate-mcp`: stdio MCP server with `check_store_domain` and `check_store_domains`.
28
+ - Packaging (`pip install domain-gate[mcp]`), benchmark harness (`benchmark/`), Cursor plugin manifest, agent skill.
29
+
30
+ ## 2.x
31
+ Initial research tool: RDAP age, early-life change, TLS, first-cert timing, SPF/DMARC, crt.sh/WHOIS proxies.
@@ -0,0 +1,13 @@
1
+ # Disclaimer
2
+
3
+ Domain Gate is **advisory only**.
4
+
5
+ It reports public registration, TLS, and mail-authentication **signals** about a domain. It is **not** a determination that any site is a scam, is fraudulent, or is safe to buy from.
6
+
7
+ There may be **false positives** (a legitimate shop can look new or poorly authenticated) and **false negatives** (an aged or carefully prepared fake shop can look ordinary). A `PASS` is not proof a shop is honest. A `SKIP`, `FLAG`, or `BLOCK` band is not an accusation of fraud. Prefer wording like "registered 12 days ago" over "scam".
8
+
9
+ The software is provided **without warranty** of any kind. See the [MIT License](LICENSE).
10
+
11
+ **Verify a store independently before you pay.** This tool does not replace your own judgment, chargebacks policy, or other checks.
12
+
13
+ This same text is linked from the README, included in MCP tool descriptions, and attached to every JSON and MCP result in the `disclaimer` field.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Ben Foster
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,10 @@
1
+ include DISCLAIMER.md
2
+ include CHANGELOG.md
3
+ include SECURITY.md
4
+ include LICENSE
5
+ include NOTICE-PSL.md
6
+ include pyproject.toml
7
+ include requirements.txt
8
+ recursive-include tests *.py *.json
9
+ global-exclude *.py[cod]
10
+ global-exclude __pycache__
@@ -0,0 +1,8 @@
1
+ # Third-party data
2
+
3
+ `domain_gate_psl.py` is generated from the Mozilla-hosted **Public Suffix List**
4
+ (https://publicsuffix.org/), which is licensed under the Mozilla Public License
5
+ 2.0 (https://mozilla.org/MPL/2.0/). The list is data embedded unmodified in
6
+ spirit (parsed into Python tuples by `scripts/update_psl.py`); the original
7
+ file and its license text are available at https://github.com/publicsuffix/list.
8
+ Source file version is recorded in `domain_gate_psl.PSL_VERSION`.
@@ -0,0 +1,213 @@
1
+ Metadata-Version: 2.4
2
+ Name: domain-gate
3
+ Version: 3.0.0
4
+ Summary: Check whether an online store's domain looks safe to buy from: registration age, TLS and mail-auth evidence, as a CLI and an MCP server.
5
+ Author: ChewbaccaRoars
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ChewbaccaRoars/domain-gate
8
+ Project-URL: Repository, https://github.com/ChewbaccaRoars/domain-gate
9
+ Project-URL: Issues, https://github.com/ChewbaccaRoars/domain-gate/issues
10
+ Project-URL: Disclaimer, https://github.com/ChewbaccaRoars/domain-gate/blob/main/DISCLAIMER.md
11
+ Keywords: scam,fake-store,domain-age,rdap,whois,mcp,model-context-protocol,fraud,e-commerce
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ License-File: NOTICE-PSL.md
16
+ Requires-Dist: dnspython>=2.6
17
+ Provides-Extra: mcp
18
+ Requires-Dist: mcp<2,>=1.9; extra == "mcp"
19
+ Provides-Extra: dev
20
+ Requires-Dist: pytest>=8.0; extra == "dev"
21
+ Requires-Dist: mcp<2,>=1.9; extra == "dev"
22
+ Dynamic: license-file
23
+
24
+ # Domain Gate
25
+
26
+ <!-- mcp-name: io.github.chewbaccaroars/domain-gate -->
27
+
28
+ **Before you (or your AI agent) buy from a store you've never heard of, check the domain.**
29
+
30
+ Domain Gate is a CLI and an [MCP](https://modelcontextprotocol.io/) server that looks at the *domain* behind an online store: how old the registration is, whether TLS works, and whether the name publishes SPF and DMARC. It is meant to sit in front of a price comparison or a shopping agent: skip or flag a shop whose domain looks newly stood up or poorly authenticated, then let a human decide what to do with the price.
31
+
32
+ ```
33
+ $ domain-gate --score example.com young-example-store.com
34
+ example.com PASS age=11315d reasons=age_over_1y score=0 band=PASS
35
+ young-example-store.com SKIP age=20d reasons=age_under_60d score=40 band=REVIEW
36
+ ```
37
+
38
+ All signals use free, unauthenticated public sources (RDAP, IANA bootstrap, crt.sh, DNS-over-HTTPS). No API keys.
39
+
40
+ ## Disclaimer
41
+
42
+ Domain Gate is **advisory only**. It reports public registration, TLS, and mail-authentication **signals** about a domain. It is **not** a determination that any site is a scam, is fraudulent, or is safe to buy from.
43
+
44
+ There may be false positives and false negatives. A `PASS` is not proof a shop is honest. A `SKIP`, `FLAG`, or `BLOCK` band is not an accusation of fraud. Prefer "registered 12 days ago" over "scam". The software is provided **without warranty**; see the [MIT License](LICENSE). **Verify independently before you buy.**
45
+
46
+ The same text lives in [DISCLAIMER.md](DISCLAIMER.md) and is attached to every JSON and MCP result.
47
+
48
+ ## Install
49
+
50
+ ```bash
51
+ # CLI
52
+ pipx install domain-gate
53
+ # or: pip install domain-gate
54
+
55
+ # MCP server (stdio) — Claude Desktop, Claude Code, Cursor, VS Code, …
56
+ # Add this to the client's MCP config (Claude Desktop: claude_desktop_config.json;
57
+ # Cursor: Settings → MCP; VS Code: .vscode/mcp.json):
58
+ ```
59
+
60
+ ```json
61
+ {
62
+ "mcpServers": {
63
+ "domain-gate": {
64
+ "command": "uvx",
65
+ "args": ["--from", "domain-gate[mcp]", "domain-gate-mcp"]
66
+ }
67
+ }
68
+ }
69
+ ```
70
+
71
+ ```bash
72
+ # Claude Code
73
+ claude mcp add domain-gate -- uvx --from "domain-gate[mcp]" domain-gate-mcp
74
+
75
+ # From a clone, no publish required
76
+ pip install -e ".[mcp]"
77
+ domain-gate --score example.com
78
+ domain-gate-mcp # stdio MCP server
79
+ ```
80
+
81
+ Cursor can also install this repo as a plugin (`.cursor-plugin/plugin.json`, `mcp.json`, and an agent skill under `skills/`). There is a marketplace submission plan in `LAUNCH.md`; nothing has been submitted yet.
82
+
83
+ ## Example prompts (for an agent with the MCP server)
84
+
85
+ - "Check these seller domains before you recommend anything: store-a.example, store-b.shop"
86
+ - "Find the cheapest listing of this product; run every seller through domain-gate and drop SKIPs."
87
+ - "Is this shop's domain safe to order from? Show the evidence, not just a verdict."
88
+ - "I found this marketplace listing. Is the seller's own shop domain new?"
89
+
90
+ ## Tools and CLI
91
+
92
+ ```bash
93
+ domain-gate [--json] [--score] [--redirects] [--allow brand.com] [--rdap-direct] \
94
+ [--as-of 2026-12-01] [--cache-dir DIR] [--refresh] [--timeout 15] \
95
+ [--no-optional] domain [domain ...]
96
+ ```
97
+
98
+ Input is a list of domains or URLs (positional args or stdin). Built-in major
99
+ retailers and marketplaces are passed without lookups: Amazon (including
100
+ country storefronts), Walmart, Target, Best Buy, eBay, Costco, Home Depot,
101
+ Lowe's, Macy's, Crutchfield, Etsy, Mercari. Pass `--allow brand.com`
102
+ (repeatable) for a brand's official site once you have verified it.
103
+
104
+ - `--score` adds a 0–100+ weighted score and a `BLOCK` (≥50) / `REVIEW` (25–49) / `PASS` (<25) band. Use the band to rank, the reasons to explain.
105
+ - `--redirects` also follows the storefront and judges the destination (opt-in; see Security).
106
+ - `--rdap-direct` queries registry RDAP servers from the IANA bootstrap and never rdap.org. Same effect as `DOMAIN_GATE_RDAP=direct`. Prefer this at volume (see Politeness).
107
+ - `--as-of` pins "today" for reproducible scores. Results of each network call are cached under `--cache-dir` (default `./cache/` for the CLI, `~/.cache/domain-gate` for the MCP server). Pass `--refresh` to ignore the cache.
108
+
109
+ The MCP server exposes `check_store_domain` and `check_store_domains` (up to 25 names, duplicates collapsed). It shares one rate-limited fetcher across calls. Optional Wayback / ipinfo lookups are off.
110
+
111
+ ## How to read a result
112
+
113
+ | Verdict | Meaning | What to do |
114
+ |---|---|---|
115
+ | `SKIP` | Registered under 60 days ago | Drop the offer. Never use its price in a comparison. |
116
+ | `FLAG` | At least one red flag (see `reasons`) | Keep it only with the reasons attached. Don't recommend buying from it without an independent check. |
117
+ | `PASS` | No domain red flags, or a known major retailer | No label. This is *not* proof the store is honest. |
118
+
119
+ `score.band` is a second opinion. An established retailer that only FLAGs on missing DMARC usually stays in the `PASS` band.
120
+
121
+ ## What it checks
122
+
123
+ | Signal | Source | When it fires | Notes |
124
+ |---|---|---|---|
125
+ | Domain age | RDAP at `rdap.org` (or `--rdap-direct`: the registry server from the [IANA bootstrap](https://data.iana.org/rdap/dns.json)); CentralNic RDAP for registry SLDs such as `.us.com`; port-43 WHOIS for TLDs with no RDAP (e.g. `.de`). If there is still no date, the earliest crt.sh certificate is a labelled **age proxy** (a lower bound, not a registry date). | **SKIP** if under 60 days; **FLAG** if 60 days–1 year or no date (`age_unverified`). Proxy dates use `age_proxy_*` reasons. | A live certificate's issue date is a *renewal*, not an age, and is never used as one. Registries that withhold creation dates (notably `.au`) or have no RDAP and an empty WHOIS are `age_unavailable_tld`: unknown, not a flag. DENIC typically exposes only a `Changed` date, which is recorded but not treated as a creation date. |
126
+ | Early-life change | Same RDAP document: latest `last changed` / `transfer` | **FLAG** if a change falls in the first 120 days of the domain's life *and* within the last year | RDAP has no full history (see below). A change within 48 hours of registration is ignored as provisioning. |
127
+ | Live TLS | Certificate check on port 443 (apex, then `www`) | **FLAG** if the certificate is missing, expired, or invalid. A handshake that never completes is `ssl_unreachable` (lower score weight): the host may be down, or the caller's network may be filtering it. | Hostname verification uses the default CA bundle. |
128
+ | First certificate | `https://crt.sh/?q=<d>&output=json`, earliest `not_before` | **FLAG** if the first cert was issued within 7 days of registration *and* the domain is under 1 year old | Skipped when the registry date already shows the domain is over a year old. Timeouts degrade to `first_cert_unknown` and do not flag. |
129
+ | Email auth | DNS-over-HTTPS (dns.google, then Cloudflare), stub-resolver fallback. SPF at the apex, DMARC at `_dmarc.<d>` | **FLAG** if SPF is missing, SPF uses `+all` / `?all` / bare `all`, or DMARC is missing | DKIM is probed at common selectors and never flags on its own. A failed lookup is `spf_lookup_failed` / `dmarc_lookup_failed`, not "missing". |
130
+ | Platform subdomain | Public Suffix List (PRIVATE section) | **FLAG** `platform_subdomain` for `*.myshopify.com`, `*.github.io`, and similar | The platform's own registration age is not inherited. CentralNic registry SLDs (`*.us.com`) *are* real registrations. |
131
+ | Mixed-script IDN | The domain labels | **FLAG** if a label mixes scripts (homograph spoofing) | Pure-script IDNs (e.g. German umlauts) are informational only. |
132
+ | Redirects (`--redirects`) | Follow `https://<domain>/` | **FLAG** `redirect_offsite` if the destination is a different registrable domain; also `redirect_target_new_domain` if that domain itself is new | Opt-in. Non-public targets (private/loopback IPs, odd ports, internal names) are refused. |
133
+ | Privacy / Wayback / ASN | RDAP remarks, web.archive.org, ipinfo.io | Informational only | Off in the MCP server. |
134
+
135
+ Price is *not* a verdict input. A caller may attach a "price warning" when an offer is more than 50% under the median of other new offers; this tool will not auto-drop on price.
136
+
137
+ ### RDAP has no full history
138
+
139
+ A typical RDAP response includes a registration date, an expiration, and a single **latest** `last changed` timestamp. This gate can only inspect that latest change. A 20-year-old store touched last week will not flag on this signal. A domain transferred in its first 120 days and changed again last month will show only the later change — and will also not flag. That is a gap, not a pass from evidence.
140
+
141
+ ## Measured accuracy (2026-12-01)
142
+
143
+ Evaluated from this project's dev environment (America/New_York). TLS results depend on the caller's network: this box sinkholes plain DNS (`198.18.0.1`) and times out port-43 WHOIS; HTTPS, DoH, and RDAP work. Numbers below use a later "patient" crt.sh pass on undated names. The 254-name alleged-scam set is **not published** (see `benchmark/scam_sources.md`).
144
+
145
+ **Legitimate stores** (n=153: US majors, mid-size and small dealers, Shopify DTC, international chains, country-storefront allowlist checks, real `.shop` / `.store` brand names):
146
+
147
+ | | New gate (v3) | Previous scoring (v2.1-era) on the same names |
148
+ |---|---|---|
149
+ | Hard FP (`SKIP` or `BLOCK`) | **0/153 (0%)** | 17/153 (11.0%), almost all from treating a live certificate's renewal date as the domain's age |
150
+ | Review FP (score ≥ 25) | **6/153 (3.9%)** | 23/153 (15.0%) |
151
+ | Any FLAG (verdict ≠ PASS) | 15/153 (9.8%) | 46/153 (30.1%) |
152
+
153
+ The 6 review-band rows are premium `.shop` / `.store` parking pages (for example a brand's unused `brand.shop`) that did not complete a TLS handshake from this network, plus `microsoft.store` (certificate hostname mismatch). They are not everyday storefronts. Major US retailers, mid-size dealers, and 19/20 Shopify DTC names were `PASS` band. 0 hard false positives.
154
+
155
+ **Reported fake stores** (n=254 from public reporting + a small private subgroup; 56 still answering TLS, 198 not):
156
+
157
+ | | Live (n=56) | All 254 |
158
+ |---|---|---|
159
+ | Missed at band level (score &lt; 25) | **13/56 (23.2%)** | 18/254 (7.1%) |
160
+ | Missed at verdict (`PASS`) | **5/56 (8.9%)** | 5/254 (2.0%) |
161
+ | `BLOCK` / `REVIEW` / `PASS` | 11 / 32 / 13 | 22 / 214 / 18 |
162
+
163
+ The previous run on the same live names (then 53 with a valid certificate) missed 17/53 (32.1%) at band level and 6/53 at verdict. v3 resolved a registration or CT-log date for every live name (0/56 undated). Most remaining misses are **aged campaign domains** (often a year or more old) that only lack DMARC or have no domain-level tell at all — exactly the limit described below. Of the 198 names that no longer complete a handshake, almost all still FLAG (verdict miss 0/198); dropping the certificate points from those dead hosts ("ex-dead-SSL") leaves 112/254 (44.1%) under 25, because a takedown looks like a missing site, not a young domain.
164
+
165
+ `--redirects` (opt-in) found one legitimate off-site hop (a brand's marketing domain to its shop domain: FLAG, still `PASS` band) and two live-set hops, one of which moved a name into `BLOCK`. A side-by-side `--rdap-direct` run is in `benchmark/RESULTS.md` once it lands; use it at volume out of courtesy to rdap.org.
166
+
167
+ ## What it cannot tell you
168
+
169
+ - A carefully aged fake shop (wait a year, add SPF/DMARC, buy a normal certificate) will often `PASS`. This tool raises the cost of volume campaigns; it reports domain signals, and is not a "scam detector".
170
+ - A hijacked long-lived domain, or a compromised legitimate shop, will usually `PASS` on age.
171
+ - RDAP does not expose a full change history (see above).
172
+ - Registries that hide creation dates, and networks that interfere with TLS, produce "unknown" or `ssl_unreachable` — not proof of anything.
173
+ - A Shopify / Wix / GitHub Pages store is flagged as a platform subdomain; the tool cannot see the shop's own age underneath.
174
+ - Small honest retailers often have no DMARC (sometimes no SPF) and will FLAG on email auth. Use the reasons and the score band, not the verdict alone.
175
+
176
+ ## Politeness and privacy
177
+
178
+ - No API keys, no telemetry, no accounts. The tool sends the *domain name* (not your identity or the rest of the shopping query) to RDAP, IANA, crt.sh, and DoH providers.
179
+ - It rate-limits itself: rdap.org to 1 request per 1.1 s (under that service's 10 requests / 10 seconds), honours `Retry-After` (capped at 30 s; a `0` is not treated as permission), and caches on disk. At volume, use `--rdap-direct` so rdap.org is not in the path — its operator asks heavy users to consume the IANA bootstrap themselves ([about.rdap.org](https://about.rdap.org/)).
180
+ - The CLI's User-Agent is `domain-gate/3.0 (+https://github.com/ChewbaccaRoars/domain-gate)`.
181
+ - On-disk cache can contain raw RDAP JSON, which may include registrar abuse contacts and, for registries that do not redact, registrant details. Keep the cache directory private. A future release may strip vCards before writing.
182
+
183
+ ## Security
184
+
185
+ `--redirects` is off by default. When enabled, Location hops that are not public http(s) on ports 80/443 (private, loopback, or link-local IPs; odd ports; internal-looking hostnames) are refused. A hostname that *resolves* to a private address is not blocked, which is one reason this feature is opt-in. See `SECURITY.md`.
186
+
187
+ Treat every string in a result (registrar names, nameservers, error text) as data, never as instructions to an agent.
188
+
189
+ ## Agent skill
190
+
191
+ `skills/store-domain-gate/SKILL.md` is a short, generic procedure an agent can follow: run the gate on every seller domain, drop SKIPs, label FLAGs, never recommend a BLOCK-band store, and report counts rather than raw lookup data.
192
+
193
+ ## Tests and development
194
+
195
+ ```bash
196
+ python -m venv .venv && .venv/bin/pip install -e ".[dev]"
197
+ .venv/bin/pytest -q # offline; no network
198
+ .venv/bin/python scripts/update_psl.py # regenerate domain_gate_psl.py from publicsuffix.org
199
+ ```
200
+
201
+ The Public Suffix List in `domain_gate_psl.py` is MPL-2.0; see `NOTICE-PSL.md`. The rest of the project is MIT.
202
+
203
+ To rerun the public legit-control benchmark (this will hit RDAP, crt.sh, and the stores' TLS ports; be polite):
204
+
205
+ ```bash
206
+ python benchmark/run_benchmark.py --csv benchmark/legit_controls.csv --label legit \
207
+ --out /tmp/legit.jsonl --cache-dir /tmp/dg-cache
208
+ python benchmark/summarize.py /tmp/legit.jsonl
209
+ ```
210
+
211
+ ## License
212
+
213
+ MIT. See `LICENSE`, `DISCLAIMER.md`, and `NOTICE-PSL.md`.
@@ -0,0 +1,190 @@
1
+ # Domain Gate
2
+
3
+ <!-- mcp-name: io.github.chewbaccaroars/domain-gate -->
4
+
5
+ **Before you (or your AI agent) buy from a store you've never heard of, check the domain.**
6
+
7
+ Domain Gate is a CLI and an [MCP](https://modelcontextprotocol.io/) server that looks at the *domain* behind an online store: how old the registration is, whether TLS works, and whether the name publishes SPF and DMARC. It is meant to sit in front of a price comparison or a shopping agent: skip or flag a shop whose domain looks newly stood up or poorly authenticated, then let a human decide what to do with the price.
8
+
9
+ ```
10
+ $ domain-gate --score example.com young-example-store.com
11
+ example.com PASS age=11315d reasons=age_over_1y score=0 band=PASS
12
+ young-example-store.com SKIP age=20d reasons=age_under_60d score=40 band=REVIEW
13
+ ```
14
+
15
+ All signals use free, unauthenticated public sources (RDAP, IANA bootstrap, crt.sh, DNS-over-HTTPS). No API keys.
16
+
17
+ ## Disclaimer
18
+
19
+ Domain Gate is **advisory only**. It reports public registration, TLS, and mail-authentication **signals** about a domain. It is **not** a determination that any site is a scam, is fraudulent, or is safe to buy from.
20
+
21
+ There may be false positives and false negatives. A `PASS` is not proof a shop is honest. A `SKIP`, `FLAG`, or `BLOCK` band is not an accusation of fraud. Prefer "registered 12 days ago" over "scam". The software is provided **without warranty**; see the [MIT License](LICENSE). **Verify independently before you buy.**
22
+
23
+ The same text lives in [DISCLAIMER.md](DISCLAIMER.md) and is attached to every JSON and MCP result.
24
+
25
+ ## Install
26
+
27
+ ```bash
28
+ # CLI
29
+ pipx install domain-gate
30
+ # or: pip install domain-gate
31
+
32
+ # MCP server (stdio) — Claude Desktop, Claude Code, Cursor, VS Code, …
33
+ # Add this to the client's MCP config (Claude Desktop: claude_desktop_config.json;
34
+ # Cursor: Settings → MCP; VS Code: .vscode/mcp.json):
35
+ ```
36
+
37
+ ```json
38
+ {
39
+ "mcpServers": {
40
+ "domain-gate": {
41
+ "command": "uvx",
42
+ "args": ["--from", "domain-gate[mcp]", "domain-gate-mcp"]
43
+ }
44
+ }
45
+ }
46
+ ```
47
+
48
+ ```bash
49
+ # Claude Code
50
+ claude mcp add domain-gate -- uvx --from "domain-gate[mcp]" domain-gate-mcp
51
+
52
+ # From a clone, no publish required
53
+ pip install -e ".[mcp]"
54
+ domain-gate --score example.com
55
+ domain-gate-mcp # stdio MCP server
56
+ ```
57
+
58
+ Cursor can also install this repo as a plugin (`.cursor-plugin/plugin.json`, `mcp.json`, and an agent skill under `skills/`). There is a marketplace submission plan in `LAUNCH.md`; nothing has been submitted yet.
59
+
60
+ ## Example prompts (for an agent with the MCP server)
61
+
62
+ - "Check these seller domains before you recommend anything: store-a.example, store-b.shop"
63
+ - "Find the cheapest listing of this product; run every seller through domain-gate and drop SKIPs."
64
+ - "Is this shop's domain safe to order from? Show the evidence, not just a verdict."
65
+ - "I found this marketplace listing. Is the seller's own shop domain new?"
66
+
67
+ ## Tools and CLI
68
+
69
+ ```bash
70
+ domain-gate [--json] [--score] [--redirects] [--allow brand.com] [--rdap-direct] \
71
+ [--as-of 2026-12-01] [--cache-dir DIR] [--refresh] [--timeout 15] \
72
+ [--no-optional] domain [domain ...]
73
+ ```
74
+
75
+ Input is a list of domains or URLs (positional args or stdin). Built-in major
76
+ retailers and marketplaces are passed without lookups: Amazon (including
77
+ country storefronts), Walmart, Target, Best Buy, eBay, Costco, Home Depot,
78
+ Lowe's, Macy's, Crutchfield, Etsy, Mercari. Pass `--allow brand.com`
79
+ (repeatable) for a brand's official site once you have verified it.
80
+
81
+ - `--score` adds a 0–100+ weighted score and a `BLOCK` (≥50) / `REVIEW` (25–49) / `PASS` (<25) band. Use the band to rank, the reasons to explain.
82
+ - `--redirects` also follows the storefront and judges the destination (opt-in; see Security).
83
+ - `--rdap-direct` queries registry RDAP servers from the IANA bootstrap and never rdap.org. Same effect as `DOMAIN_GATE_RDAP=direct`. Prefer this at volume (see Politeness).
84
+ - `--as-of` pins "today" for reproducible scores. Results of each network call are cached under `--cache-dir` (default `./cache/` for the CLI, `~/.cache/domain-gate` for the MCP server). Pass `--refresh` to ignore the cache.
85
+
86
+ The MCP server exposes `check_store_domain` and `check_store_domains` (up to 25 names, duplicates collapsed). It shares one rate-limited fetcher across calls. Optional Wayback / ipinfo lookups are off.
87
+
88
+ ## How to read a result
89
+
90
+ | Verdict | Meaning | What to do |
91
+ |---|---|---|
92
+ | `SKIP` | Registered under 60 days ago | Drop the offer. Never use its price in a comparison. |
93
+ | `FLAG` | At least one red flag (see `reasons`) | Keep it only with the reasons attached. Don't recommend buying from it without an independent check. |
94
+ | `PASS` | No domain red flags, or a known major retailer | No label. This is *not* proof the store is honest. |
95
+
96
+ `score.band` is a second opinion. An established retailer that only FLAGs on missing DMARC usually stays in the `PASS` band.
97
+
98
+ ## What it checks
99
+
100
+ | Signal | Source | When it fires | Notes |
101
+ |---|---|---|---|
102
+ | Domain age | RDAP at `rdap.org` (or `--rdap-direct`: the registry server from the [IANA bootstrap](https://data.iana.org/rdap/dns.json)); CentralNic RDAP for registry SLDs such as `.us.com`; port-43 WHOIS for TLDs with no RDAP (e.g. `.de`). If there is still no date, the earliest crt.sh certificate is a labelled **age proxy** (a lower bound, not a registry date). | **SKIP** if under 60 days; **FLAG** if 60 days–1 year or no date (`age_unverified`). Proxy dates use `age_proxy_*` reasons. | A live certificate's issue date is a *renewal*, not an age, and is never used as one. Registries that withhold creation dates (notably `.au`) or have no RDAP and an empty WHOIS are `age_unavailable_tld`: unknown, not a flag. DENIC typically exposes only a `Changed` date, which is recorded but not treated as a creation date. |
103
+ | Early-life change | Same RDAP document: latest `last changed` / `transfer` | **FLAG** if a change falls in the first 120 days of the domain's life *and* within the last year | RDAP has no full history (see below). A change within 48 hours of registration is ignored as provisioning. |
104
+ | Live TLS | Certificate check on port 443 (apex, then `www`) | **FLAG** if the certificate is missing, expired, or invalid. A handshake that never completes is `ssl_unreachable` (lower score weight): the host may be down, or the caller's network may be filtering it. | Hostname verification uses the default CA bundle. |
105
+ | First certificate | `https://crt.sh/?q=<d>&output=json`, earliest `not_before` | **FLAG** if the first cert was issued within 7 days of registration *and* the domain is under 1 year old | Skipped when the registry date already shows the domain is over a year old. Timeouts degrade to `first_cert_unknown` and do not flag. |
106
+ | Email auth | DNS-over-HTTPS (dns.google, then Cloudflare), stub-resolver fallback. SPF at the apex, DMARC at `_dmarc.<d>` | **FLAG** if SPF is missing, SPF uses `+all` / `?all` / bare `all`, or DMARC is missing | DKIM is probed at common selectors and never flags on its own. A failed lookup is `spf_lookup_failed` / `dmarc_lookup_failed`, not "missing". |
107
+ | Platform subdomain | Public Suffix List (PRIVATE section) | **FLAG** `platform_subdomain` for `*.myshopify.com`, `*.github.io`, and similar | The platform's own registration age is not inherited. CentralNic registry SLDs (`*.us.com`) *are* real registrations. |
108
+ | Mixed-script IDN | The domain labels | **FLAG** if a label mixes scripts (homograph spoofing) | Pure-script IDNs (e.g. German umlauts) are informational only. |
109
+ | Redirects (`--redirects`) | Follow `https://<domain>/` | **FLAG** `redirect_offsite` if the destination is a different registrable domain; also `redirect_target_new_domain` if that domain itself is new | Opt-in. Non-public targets (private/loopback IPs, odd ports, internal names) are refused. |
110
+ | Privacy / Wayback / ASN | RDAP remarks, web.archive.org, ipinfo.io | Informational only | Off in the MCP server. |
111
+
112
+ Price is *not* a verdict input. A caller may attach a "price warning" when an offer is more than 50% under the median of other new offers; this tool will not auto-drop on price.
113
+
114
+ ### RDAP has no full history
115
+
116
+ A typical RDAP response includes a registration date, an expiration, and a single **latest** `last changed` timestamp. This gate can only inspect that latest change. A 20-year-old store touched last week will not flag on this signal. A domain transferred in its first 120 days and changed again last month will show only the later change — and will also not flag. That is a gap, not a pass from evidence.
117
+
118
+ ## Measured accuracy (2026-12-01)
119
+
120
+ Evaluated from this project's dev environment (America/New_York). TLS results depend on the caller's network: this box sinkholes plain DNS (`198.18.0.1`) and times out port-43 WHOIS; HTTPS, DoH, and RDAP work. Numbers below use a later "patient" crt.sh pass on undated names. The 254-name alleged-scam set is **not published** (see `benchmark/scam_sources.md`).
121
+
122
+ **Legitimate stores** (n=153: US majors, mid-size and small dealers, Shopify DTC, international chains, country-storefront allowlist checks, real `.shop` / `.store` brand names):
123
+
124
+ | | New gate (v3) | Previous scoring (v2.1-era) on the same names |
125
+ |---|---|---|
126
+ | Hard FP (`SKIP` or `BLOCK`) | **0/153 (0%)** | 17/153 (11.0%), almost all from treating a live certificate's renewal date as the domain's age |
127
+ | Review FP (score ≥ 25) | **6/153 (3.9%)** | 23/153 (15.0%) |
128
+ | Any FLAG (verdict ≠ PASS) | 15/153 (9.8%) | 46/153 (30.1%) |
129
+
130
+ The 6 review-band rows are premium `.shop` / `.store` parking pages (for example a brand's unused `brand.shop`) that did not complete a TLS handshake from this network, plus `microsoft.store` (certificate hostname mismatch). They are not everyday storefronts. Major US retailers, mid-size dealers, and 19/20 Shopify DTC names were `PASS` band. 0 hard false positives.
131
+
132
+ **Reported fake stores** (n=254 from public reporting + a small private subgroup; 56 still answering TLS, 198 not):
133
+
134
+ | | Live (n=56) | All 254 |
135
+ |---|---|---|
136
+ | Missed at band level (score &lt; 25) | **13/56 (23.2%)** | 18/254 (7.1%) |
137
+ | Missed at verdict (`PASS`) | **5/56 (8.9%)** | 5/254 (2.0%) |
138
+ | `BLOCK` / `REVIEW` / `PASS` | 11 / 32 / 13 | 22 / 214 / 18 |
139
+
140
+ The previous run on the same live names (then 53 with a valid certificate) missed 17/53 (32.1%) at band level and 6/53 at verdict. v3 resolved a registration or CT-log date for every live name (0/56 undated). Most remaining misses are **aged campaign domains** (often a year or more old) that only lack DMARC or have no domain-level tell at all — exactly the limit described below. Of the 198 names that no longer complete a handshake, almost all still FLAG (verdict miss 0/198); dropping the certificate points from those dead hosts ("ex-dead-SSL") leaves 112/254 (44.1%) under 25, because a takedown looks like a missing site, not a young domain.
141
+
142
+ `--redirects` (opt-in) found one legitimate off-site hop (a brand's marketing domain to its shop domain: FLAG, still `PASS` band) and two live-set hops, one of which moved a name into `BLOCK`. A side-by-side `--rdap-direct` run is in `benchmark/RESULTS.md` once it lands; use it at volume out of courtesy to rdap.org.
143
+
144
+ ## What it cannot tell you
145
+
146
+ - A carefully aged fake shop (wait a year, add SPF/DMARC, buy a normal certificate) will often `PASS`. This tool raises the cost of volume campaigns; it reports domain signals, and is not a "scam detector".
147
+ - A hijacked long-lived domain, or a compromised legitimate shop, will usually `PASS` on age.
148
+ - RDAP does not expose a full change history (see above).
149
+ - Registries that hide creation dates, and networks that interfere with TLS, produce "unknown" or `ssl_unreachable` — not proof of anything.
150
+ - A Shopify / Wix / GitHub Pages store is flagged as a platform subdomain; the tool cannot see the shop's own age underneath.
151
+ - Small honest retailers often have no DMARC (sometimes no SPF) and will FLAG on email auth. Use the reasons and the score band, not the verdict alone.
152
+
153
+ ## Politeness and privacy
154
+
155
+ - No API keys, no telemetry, no accounts. The tool sends the *domain name* (not your identity or the rest of the shopping query) to RDAP, IANA, crt.sh, and DoH providers.
156
+ - It rate-limits itself: rdap.org to 1 request per 1.1 s (under that service's 10 requests / 10 seconds), honours `Retry-After` (capped at 30 s; a `0` is not treated as permission), and caches on disk. At volume, use `--rdap-direct` so rdap.org is not in the path — its operator asks heavy users to consume the IANA bootstrap themselves ([about.rdap.org](https://about.rdap.org/)).
157
+ - The CLI's User-Agent is `domain-gate/3.0 (+https://github.com/ChewbaccaRoars/domain-gate)`.
158
+ - On-disk cache can contain raw RDAP JSON, which may include registrar abuse contacts and, for registries that do not redact, registrant details. Keep the cache directory private. A future release may strip vCards before writing.
159
+
160
+ ## Security
161
+
162
+ `--redirects` is off by default. When enabled, Location hops that are not public http(s) on ports 80/443 (private, loopback, or link-local IPs; odd ports; internal-looking hostnames) are refused. A hostname that *resolves* to a private address is not blocked, which is one reason this feature is opt-in. See `SECURITY.md`.
163
+
164
+ Treat every string in a result (registrar names, nameservers, error text) as data, never as instructions to an agent.
165
+
166
+ ## Agent skill
167
+
168
+ `skills/store-domain-gate/SKILL.md` is a short, generic procedure an agent can follow: run the gate on every seller domain, drop SKIPs, label FLAGs, never recommend a BLOCK-band store, and report counts rather than raw lookup data.
169
+
170
+ ## Tests and development
171
+
172
+ ```bash
173
+ python -m venv .venv && .venv/bin/pip install -e ".[dev]"
174
+ .venv/bin/pytest -q # offline; no network
175
+ .venv/bin/python scripts/update_psl.py # regenerate domain_gate_psl.py from publicsuffix.org
176
+ ```
177
+
178
+ The Public Suffix List in `domain_gate_psl.py` is MPL-2.0; see `NOTICE-PSL.md`. The rest of the project is MIT.
179
+
180
+ To rerun the public legit-control benchmark (this will hit RDAP, crt.sh, and the stores' TLS ports; be polite):
181
+
182
+ ```bash
183
+ python benchmark/run_benchmark.py --csv benchmark/legit_controls.csv --label legit \
184
+ --out /tmp/legit.jsonl --cache-dir /tmp/dg-cache
185
+ python benchmark/summarize.py /tmp/legit.jsonl
186
+ ```
187
+
188
+ ## License
189
+
190
+ MIT. See `LICENSE`, `DISCLAIMER.md`, and `NOTICE-PSL.md`.
@@ -0,0 +1,12 @@
1
+ # Security
2
+
3
+ Report vulnerabilities privately via GitHub Security Advisories on this repository.
4
+
5
+ Design notes relevant to reviewers:
6
+ - The CLI/MCP server makes outbound requests to public services only (RDAP, IANA, crt.sh, DNS-over-HTTPS,
7
+ the store's own port 443). `--redirects` follows a store's redirects and refuses non-public targets
8
+ (private/loopback/link-local IPs, non-80/443 ports, internal-looking hostnames); a hostname that
9
+ *resolves* to a private address is not blocked, which is why redirect following is opt-in.
10
+ - Output includes strings from third parties (registrar names, nameservers). When an AI agent consumes the
11
+ results, treat them as data, never as instructions.
12
+ - Results are advisory domain signals, not a determination that any site is a scam. See `DISCLAIMER.md`.