Universal SEO skill for Claude Code. 26 sub-skills + 19 sub-agents covering technical SEO, E-E-A-T, schema, GEO/AEO, agent readiness (Lighthouse Agentic Browsing, WebMCP, llms.txt), backlinks, local SEO, e-commerce, international SEO, Google APIs, and PDF/Excel reporting. 9 optional extensions for live SEO data.
fix(indexnow): compare the key file host, not a URL substring
Rudy Celekli7597b23b3f0a
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 648be42..b149d0c 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0## [Unreleased]+### Fixed++- **IndexNow key check compares hosts, not URL substrings.**+ `verify_key_published` treated `example.com` as present in+ `https://notexample.com/...` and rejected `Example.COM` against+ `https://example.com/...`. The key file host is compared as a hostname,+ before the file is fetched.+## [2.5.0] - 2026-10-22Security and accuracy fixes from a full audit, and Claude Desktop installs again.diff --git a/scripts/indexnow_submit.py b/scripts/indexnow_submit.pyindex 59a8042..a42e4cd 100644--- a/scripts/indexnow_submit.py+++ b/scripts/indexnow_submit.py@@ -142,7 +142,13 @@ def verify_key_published(IndexNow requires the key to be retrievable at the keyLocation URL.Missing or wrong content silently rejects every later submission, sothis pre-flight catches the common ownership-setup mistake.++ The key file host has to be the declared host. A substring check accepts+ ``example.com`` inside ``notexample.com`` and rejects a matching host+ written with different case."""+ if _normalized_host(key_location) != _normalized_host(host):+ return {"ok": False, "error": "keyLocation host does not match declared host"}try:resp = safe_requests_get(key_location, timeout=15)except URLSafetyError as exc:@@ -160,8 +166,6 @@ def verify_key_published("expected_length": len(key),"actual_length": len(resp.text.strip()),}- if host not in key_location:- return {"ok": False, "error": "keyLocation host does not match declared host"}return {"ok": True, "status_code": 200}diff --git a/tests/test_indexnow_submit.py b/tests/test_indexnow_submit.pynew file mode 100644index 0000000..816e1c2--- /dev/null+++ b/tests/test_indexnow_submit.py@@ -0,0 +1,62 @@+"""IndexNow keyLocation must be the declared host, not a substring of the URL.++`verify_key_published` used `host not in key_location` after a successful+fetch. That accepts https://notexample.com/ when the host is example.com,+and rejects https://example.com/ when the host is written Example.COM.+"""++from __future__ import annotations++import sys+from pathlib import Path++ROOT = Path(__file__).resolve().parents[1]+sys.path.insert(0, str(ROOT / "scripts"))++import indexnow_submit # noqa: E402++KEY = "a" * 32+++class _Response:+ status_code = 200+ text = KEY+++def test_lookalike_host_is_rejected_without_fetching(monkeypatch) -> None:+ def boom(*_args, **_kwargs):+ raise AssertionError("fetched a key file on another host")++ monkeypatch.setattr(indexnow_submit, "safe_requests_get", boom)+ result = indexnow_submit.verify_key_published(+ "example.com", KEY, "https://notexample.com/key.txt"+ )+ assert result == {+ "ok": False,+ "error": "keyLocation host does not match declared host",+ }+++def test_host_comparison_ignores_case(monkeypatch) -> None:+ monkeypatch.setattr(indexnow_submit, "safe_requests_get", lambda *_a, **_k: _Response())+ result = indexnow_submit.verify_key_published(+ "Example.COM", KEY, "https://example.com/key.txt"+ )+ assert result["ok"] is True+ assert result["status_code"] == 200+++def test_www_is_not_the_same_host(monkeypatch) -> None:+ monkeypatch.setattr(indexnow_submit, "safe_requests_get", lambda *_a, **_k: _Response())+ result = indexnow_submit.verify_key_published(+ "example.com", KEY, "https://www.example.com/key.txt"+ )+ assert result["ok"] is False+++def test_key_on_a_different_registrable_suffix_is_rejected(monkeypatch) -> None:+ monkeypatch.setattr(indexnow_submit, "safe_requests_get", lambda *_a, **_k: _Response())+ result = indexnow_submit.verify_key_published(+ "example.com", KEY, "https://example.com.evil.test/key.txt"+ )+ assert result["ok"] is False