2018-03-05 12:28:41 +01:00
|
|
|
from disposable_email_domains import blacklist
|
2016-10-31 23:28:20 +01:00
|
|
|
|
2020-06-11 00:54:34 +02:00
|
|
|
|
2018-05-10 19:13:36 +02:00
|
|
|
def is_reserved_subdomain(subdomain: str) -> bool:
|
2016-10-31 23:28:20 +01:00
|
|
|
if subdomain in ZULIP_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
2021-02-12 08:20:45 +01:00
|
|
|
if subdomain[-1] == "s" and subdomain[:-1] in ZULIP_RESERVED_SUBDOMAINS:
|
2016-10-31 23:28:20 +01:00
|
|
|
return True
|
|
|
|
if subdomain in GENERIC_RESERVED_SUBDOMAINS:
|
|
|
|
return True
|
2021-02-12 08:20:45 +01:00
|
|
|
if subdomain[-1] == "s" and subdomain[:-1] in GENERIC_RESERVED_SUBDOMAINS:
|
2016-10-31 23:28:20 +01:00
|
|
|
return True
|
|
|
|
return False
|
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
|
2018-05-10 19:13:36 +02:00
|
|
|
def is_disposable_domain(domain: str) -> bool:
|
2018-08-12 03:43:31 +02:00
|
|
|
if domain.lower() in WHITELISTED_EMAIL_DOMAINS:
|
|
|
|
return False
|
2016-11-05 03:26:30 +01:00
|
|
|
return domain.lower() in DISPOSABLE_DOMAINS
|
|
|
|
|
2021-02-12 08:19:30 +01:00
|
|
|
|
2020-09-02 02:50:08 +02:00
|
|
|
ZULIP_RESERVED_SUBDOMAINS = {
|
2020-10-23 02:43:28 +02:00
|
|
|
# Zulip terms
|
2021-02-12 08:20:45 +01:00
|
|
|
"stream",
|
|
|
|
"channel",
|
|
|
|
"topic",
|
|
|
|
"thread",
|
|
|
|
"installation",
|
|
|
|
"organization",
|
|
|
|
"realm",
|
|
|
|
"team",
|
|
|
|
"subdomain",
|
|
|
|
"activity",
|
|
|
|
"octopus",
|
|
|
|
"acme",
|
|
|
|
"push",
|
2016-12-25 21:31:34 +01:00
|
|
|
# machines
|
2021-02-12 08:20:45 +01:00
|
|
|
"zulipdev",
|
|
|
|
"localhost",
|
|
|
|
"staging",
|
|
|
|
"prod",
|
|
|
|
"production",
|
|
|
|
"testing",
|
|
|
|
"nagios",
|
|
|
|
"nginx",
|
2021-09-10 02:23:59 +02:00
|
|
|
"mg",
|
|
|
|
"front-mail",
|
2016-12-25 21:31:34 +01:00
|
|
|
# website pages
|
2021-02-12 08:20:45 +01:00
|
|
|
"server",
|
|
|
|
"client",
|
|
|
|
"features",
|
|
|
|
"integration",
|
|
|
|
"bot",
|
|
|
|
"blog",
|
|
|
|
"history",
|
|
|
|
"story",
|
|
|
|
"stories",
|
|
|
|
"testimonial",
|
|
|
|
"compare",
|
|
|
|
"for",
|
|
|
|
"vs",
|
2016-12-25 21:31:34 +01:00
|
|
|
# competitor pages
|
2021-02-12 08:20:45 +01:00
|
|
|
"slack",
|
|
|
|
"mattermost",
|
|
|
|
"rocketchat",
|
|
|
|
"irc",
|
|
|
|
"twitter",
|
|
|
|
"zephyr",
|
|
|
|
"flowdock",
|
|
|
|
"spark",
|
|
|
|
"skype",
|
|
|
|
"microsoft",
|
|
|
|
"twist",
|
|
|
|
"ryver",
|
|
|
|
"matrix",
|
|
|
|
"discord",
|
|
|
|
"email",
|
|
|
|
"usenet",
|
2020-10-23 02:43:28 +02:00
|
|
|
# Zulip names
|
2021-02-12 08:20:45 +01:00
|
|
|
"zulip",
|
|
|
|
"tulip",
|
|
|
|
"humbug",
|
2016-12-25 21:31:34 +01:00
|
|
|
# platforms
|
2021-02-12 08:20:45 +01:00
|
|
|
"plan9",
|
|
|
|
"electron",
|
|
|
|
"linux",
|
|
|
|
"mac",
|
|
|
|
"windows",
|
|
|
|
"cli",
|
|
|
|
"ubuntu",
|
|
|
|
"android",
|
|
|
|
"ios",
|
2016-12-25 21:31:34 +01:00
|
|
|
# floss
|
2021-02-12 08:20:45 +01:00
|
|
|
"contribute",
|
|
|
|
"floss",
|
|
|
|
"foss",
|
|
|
|
"free",
|
|
|
|
"opensource",
|
|
|
|
"open",
|
|
|
|
"code",
|
|
|
|
"license",
|
2016-12-25 21:31:34 +01:00
|
|
|
# intership programs
|
2021-02-12 08:20:45 +01:00
|
|
|
"intern",
|
|
|
|
"outreachy",
|
|
|
|
"gsoc",
|
|
|
|
"gci",
|
|
|
|
"externship",
|
2018-07-10 08:07:23 +02:00
|
|
|
# Things that sound like security
|
2021-02-12 08:20:45 +01:00
|
|
|
"auth",
|
|
|
|
"authentication",
|
|
|
|
"security",
|
2016-12-25 21:31:34 +01:00
|
|
|
# tech blogs
|
2021-02-12 08:20:45 +01:00
|
|
|
"engineering",
|
|
|
|
"infrastructure",
|
|
|
|
"tooling",
|
|
|
|
"tools",
|
|
|
|
"javascript",
|
|
|
|
"python",
|
2021-02-12 08:19:30 +01:00
|
|
|
}
|
2016-10-31 23:28:20 +01:00
|
|
|
|
|
|
|
# Most of this list was curated from the following sources:
|
|
|
|
# http://wiki.dwscoalition.org/notes/List_of_reserved_subdomains (license: CC-BY-SA 3.0)
|
2020-03-27 01:32:21 +01:00
|
|
|
# https://stackoverflow.com/questions/11868191/which-saas-subdomains-to-block (license: CC-BY-SA 2.5)
|
2020-09-02 02:50:08 +02:00
|
|
|
GENERIC_RESERVED_SUBDOMAINS = {
|
2021-02-12 08:20:45 +01:00
|
|
|
"about",
|
|
|
|
"abuse",
|
|
|
|
"account",
|
|
|
|
"ad",
|
|
|
|
"admanager",
|
|
|
|
"admin",
|
|
|
|
"admindashboard",
|
|
|
|
"administrator",
|
|
|
|
"adsense",
|
|
|
|
"adword",
|
|
|
|
"affiliate",
|
|
|
|
"alpha",
|
|
|
|
"anonymous",
|
|
|
|
"api",
|
|
|
|
"assets",
|
|
|
|
"audio",
|
|
|
|
"badges",
|
|
|
|
"beta",
|
|
|
|
"billing",
|
|
|
|
"biz",
|
|
|
|
"blog",
|
|
|
|
"board",
|
|
|
|
"bookmark",
|
|
|
|
"bot",
|
|
|
|
"bugs",
|
|
|
|
"buy",
|
|
|
|
"cache",
|
|
|
|
"calendar",
|
|
|
|
"chat",
|
|
|
|
"clients",
|
|
|
|
"cname",
|
|
|
|
"code",
|
|
|
|
"comment",
|
|
|
|
"communities",
|
|
|
|
"community",
|
|
|
|
"contact",
|
|
|
|
"contributor",
|
|
|
|
"control",
|
|
|
|
"coppa",
|
|
|
|
"copyright",
|
|
|
|
"cpanel",
|
|
|
|
"css",
|
|
|
|
"cssproxy",
|
|
|
|
"customise",
|
|
|
|
"customize",
|
|
|
|
"dashboard",
|
|
|
|
"data",
|
|
|
|
"demo",
|
|
|
|
"deploy",
|
|
|
|
"deployment",
|
|
|
|
"desktop",
|
|
|
|
"dev",
|
|
|
|
"devel",
|
|
|
|
"developer",
|
|
|
|
"development",
|
|
|
|
"discussion",
|
|
|
|
"diversity",
|
|
|
|
"dmca",
|
|
|
|
"docs",
|
|
|
|
"donate",
|
|
|
|
"download",
|
|
|
|
"e-mail",
|
|
|
|
"email",
|
|
|
|
"embed",
|
|
|
|
"embedded",
|
|
|
|
"example",
|
|
|
|
"explore",
|
|
|
|
"faq",
|
|
|
|
"favorite",
|
|
|
|
"favourites",
|
|
|
|
"features",
|
|
|
|
"feed",
|
|
|
|
"feedback",
|
|
|
|
"files",
|
|
|
|
"forum",
|
|
|
|
"friend",
|
|
|
|
"ftp",
|
|
|
|
"general",
|
|
|
|
"gettingstarted",
|
|
|
|
"gift",
|
|
|
|
"git",
|
|
|
|
"global",
|
|
|
|
"graphs",
|
|
|
|
"guide",
|
|
|
|
"hack",
|
|
|
|
"help",
|
|
|
|
"home",
|
|
|
|
"hostmaster",
|
|
|
|
"https",
|
|
|
|
"icon",
|
|
|
|
"im",
|
|
|
|
"image",
|
|
|
|
"img",
|
|
|
|
"inbox",
|
|
|
|
"index",
|
|
|
|
"investors",
|
|
|
|
"invite",
|
|
|
|
"invoice",
|
|
|
|
"ios",
|
|
|
|
"ipad",
|
|
|
|
"iphone",
|
|
|
|
"irc",
|
|
|
|
"jabber",
|
|
|
|
"jars",
|
|
|
|
"jobs",
|
|
|
|
"join",
|
|
|
|
"js",
|
|
|
|
"kb",
|
|
|
|
"knowledgebase",
|
|
|
|
"launchpad",
|
|
|
|
"legal",
|
|
|
|
"livejournal",
|
|
|
|
"lj",
|
|
|
|
"login",
|
|
|
|
"logs",
|
|
|
|
"m",
|
|
|
|
"mail",
|
|
|
|
"main",
|
|
|
|
"manage",
|
|
|
|
"map",
|
|
|
|
"media",
|
|
|
|
"memories",
|
|
|
|
"memory",
|
|
|
|
"merchandise",
|
|
|
|
"messages",
|
|
|
|
"mobile",
|
|
|
|
"my",
|
|
|
|
"mystore",
|
|
|
|
"networks",
|
|
|
|
"new",
|
|
|
|
"newsite",
|
|
|
|
"official",
|
|
|
|
"ogg",
|
|
|
|
"online",
|
|
|
|
"order",
|
|
|
|
"paid",
|
|
|
|
"panel",
|
|
|
|
"partner",
|
|
|
|
"partnerpage",
|
|
|
|
"pay",
|
|
|
|
"payment",
|
|
|
|
"picture",
|
|
|
|
"policy",
|
|
|
|
"pop",
|
|
|
|
"popular",
|
|
|
|
"portal",
|
|
|
|
"post",
|
|
|
|
"postmaster",
|
|
|
|
"press",
|
|
|
|
"pricing",
|
|
|
|
"principles",
|
|
|
|
"privacy",
|
|
|
|
"private",
|
|
|
|
"profile",
|
|
|
|
"public",
|
|
|
|
"random",
|
|
|
|
"redirect",
|
|
|
|
"register",
|
|
|
|
"registration",
|
|
|
|
"resolver",
|
|
|
|
"root",
|
|
|
|
"rss",
|
|
|
|
"s",
|
|
|
|
"sandbox",
|
|
|
|
"school",
|
|
|
|
"search",
|
|
|
|
"secure",
|
|
|
|
"servers",
|
|
|
|
"service",
|
|
|
|
"setting",
|
|
|
|
"shop",
|
|
|
|
"shortcuts",
|
|
|
|
"signin",
|
|
|
|
"signup",
|
|
|
|
"sitemap",
|
|
|
|
"sitenews",
|
|
|
|
"sites",
|
|
|
|
"sms",
|
|
|
|
"smtp",
|
|
|
|
"sorry",
|
|
|
|
"ssl",
|
|
|
|
"staff",
|
|
|
|
"stage",
|
|
|
|
"staging",
|
|
|
|
"stars",
|
|
|
|
"stat",
|
|
|
|
"static",
|
|
|
|
"statistics",
|
|
|
|
"status",
|
|
|
|
"store",
|
|
|
|
"style",
|
|
|
|
"support",
|
|
|
|
"surveys",
|
|
|
|
"svn",
|
|
|
|
"syn",
|
|
|
|
"syndicated",
|
|
|
|
"system",
|
|
|
|
"tag",
|
|
|
|
"talk",
|
|
|
|
"team",
|
|
|
|
"termsofservice",
|
|
|
|
"test",
|
|
|
|
"testers",
|
|
|
|
"ticket",
|
|
|
|
"tool",
|
|
|
|
"tos",
|
|
|
|
"trac",
|
|
|
|
"translate",
|
|
|
|
"update",
|
|
|
|
"upgrade",
|
|
|
|
"uploads",
|
|
|
|
"use",
|
|
|
|
"user",
|
|
|
|
"username",
|
|
|
|
"validation",
|
|
|
|
"videos",
|
|
|
|
"volunteer",
|
|
|
|
"web",
|
|
|
|
"webdisk",
|
|
|
|
"webmail",
|
|
|
|
"webmaster",
|
|
|
|
"whm",
|
|
|
|
"whois",
|
|
|
|
"wiki",
|
|
|
|
"www",
|
|
|
|
"www0",
|
|
|
|
"www8",
|
|
|
|
"www9",
|
|
|
|
"xml",
|
|
|
|
"xmpp",
|
|
|
|
"xoxo",
|
2021-02-12 08:19:30 +01:00
|
|
|
}
|
2016-11-05 03:26:30 +01:00
|
|
|
|
2020-09-02 02:50:08 +02:00
|
|
|
DISPOSABLE_DOMAINS = set(blacklist)
|
2018-08-12 03:43:31 +02:00
|
|
|
|
2020-09-02 02:50:08 +02:00
|
|
|
WHITELISTED_EMAIL_DOMAINS = {
|
2018-08-12 03:43:31 +02:00
|
|
|
# Controlled by https://www.abine.com; more legitimate than most
|
|
|
|
# disposable domains
|
2021-02-12 08:20:45 +01:00
|
|
|
"opayq.com",
|
|
|
|
"abinemail.com",
|
|
|
|
"blurmail.net",
|
|
|
|
"maskmemail.com",
|
2020-09-02 02:50:08 +02:00
|
|
|
}
|