add: [generate-google] merge three live sources, replacing the dead Wikipedia scrape - #385
Merged
Merged
Conversation
…ikipedia scrape Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0121gk7vaCXX9bMri7tC9XVd
| normalised = normalise_hostname(entry) | ||
| if normalised: | ||
| merged.add(normalised) | ||
| except (IOError, OSError, ValueError, KeyError): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
googlewarninglist generator scraped a Wikipedia page (List of Google domains) that no longer exists, and had been commented out ofgenerate_all.shsince the list was frozen on 2025-08-21 (669 entries). This PR replaces it with a generator that merges three live, verified sources, and restores the line ingenerate_all.sh.string→hostname(please review deliberately)This generator switches the warninglist's
typefrom"string"(with the old leading-dot entry convention, e.g..google.ad) to"hostname"(bare entries, e.g.google.ad). This is a user-visible, consumer-affecting change and is called out here on purpose so it gets a deliberate look, not a rubber stamp.Why: checked directly against MISP core's matching code (
MISP/MISP, 2.5 branch,app/Model/Warninglist.php):__evalString()(type"string") doesisset($listValues[$value])— an exact, byte-for-byte match with no dot handling. A stored entry of.google.adcan only ever match an attribute whose literal value is the string.google.ad— i.e., essentially never, since no real hostname attribute looks like that. This matches README.md's own description ofstringas "perfect match."__evalHostname()(type"hostname") is the actual suffix-walking mechanism — it walks the dot-separated suffixes of the attribute value and checks each against the list, which is what README.md documents as "hostname matching (e.g. domain matching from URL)."getFilteredEntries()in the same file loadshostname-type entries viastrtolower(trim($v, '.'))(dot-trimmed, lowercased) but loadsstring-type entries completely as-is — i.e. MISP core itself treats bare/lowercase as the canonical form for hostname-type lists.lists/tranco/list.jsonis the working in-repo precedent:type: "hostname"with bare entries.Net effect: the old leading-dot
stringshape (shared today bygoogle,microsoft, andmicrosoft-win10-connection-endpoints) appears to already be non-functional against current MISP core. This PR fixes it forgooglegoing forward; the other two lists are out of scope here and left untouched. The type switch itself does not change which domains are in the list (verified: 7469 both before and after switching the storage shape) — only whether the list actually fires.Sources merged
https://www.google.com/supported_domains— Google's own list of ccTLD variants of google.com (187 lines, one leading-dot domain per line). Authoritative, verified HTTP 200.https://raw.githubusercontent.com/nickspaargaren/no-google/master/google-domains— community-maintained hosts-file style blocklist of Google service domains (~6.8k lines,0.0.0.0 <domain>format). Verified themasterbranch is live (HTTP 200);mainreturns HTTP 404.https://raw.githubusercontent.com/v2fly/domain-list-community/master/data/google— v2fly/Xray-style structured domain list (709 lines) that starts with 18include:directives pulling in sibling files (android, blogspot, dart, fastlane, firebase, flutter, golang, google-deepmind, google-play, google-registry, google-scholar, google-trust-services, googlefcm, kaggle, opensourceinsights, polymer, v8, youtube).Handling the tricky bits (all documented in code comments)
include:directives are followed — these are genuinely Google-operated properties (Android, YouTube, Firebase, Google Trust Services, ...), so they're pulled in. The fetch is recursive with an explicitvisitedset and aMAX_INCLUDE_DEPTHcap (8) to guard against cycles/unexpected depth; verified none of the 18 first-level include files nest further (real depth is 1).full:/ bare prefixes are both treated as domain entries (bare = suffix match,full:= exact — both map onto this list's suffix-matchinghostnametype).keyword:andregexp:entries are dropped (2 found, both inside thegoogle-playinclude file) — these matching semantics (substring-anywhere, regex) cannot be represented by any type this list uses.@tagattributes (e.g.@cn) are stripped._spf.google.com) were rejected this way and are individually enumerated in the session's verification.generate_all.sh
Removed the stale
# TODO: Google page on Wikipedia does not exist anymore/ passivetotal-suggestion comment lines, uncommented the invocation, and changed it frompython3 generate-google.py > lists/google/list.jsonto a plainpython3 generate-google.py— like every other generator, this script now callswrite_to_file()internally instead of writing to stdout. Position in the file (right aftergenerate-disposal.py) is unchanged. Verified withbash -n generate_all.sh.Verification performed
generators.logshows only INFO lines, no ERROR/WARNING.git status --porcelainthat only the intended 3 files changed./,:,#,@,*, or uppercase, and none retain a leading dot.make_list_unique.py, thenjq -S+chmod -xnormalisation.jsonschema -i lists/google/list.json schema.json— exit 0, no output.tools/validate_values.py— exit 0.bash -n generate_all.sh— exit 0.Scope
Exactly
tools/generate-google.pyandgenerate_all.shin this PR (lists/google/list.jsonis a separate PR since it's a large generated-data diff).Update: the merge is additive
Review of an earlier revision of this branch found that 80 of the frozen list's 558 unique domains (e.g.
google.af,google.ar,duck.com) appeared in none of the three sources and were not recoverable by suffix matching — a silent regression. The generator now unions the already-committed entries in before writing, normalising them through the same path as the sources:So the generator only ever adds. Verified: 0 entries lost against the previous list; final count 7,549.
🤖 Generated with Claude Code
https://claude.ai/code/session_0121gk7vaCXX9bMri7tC9XVd