Skip to content

Commit d7d608d

Browse files
committed
Add domain blocklist
1 parent bac63ed commit d7d608d

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

webapp/webapp.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@
3636
WEBAPP_HTML = os.environ.get('WEBAPP_HTML', 'webapp.html')
3737
WEBAPP_DIR = os.environ.get('WEBAPP_DIR', os.path.dirname(os.path.abspath(__file__)))
3838

39+
DOMAIN_BLOCKLIST = []
40+
3941
DICTIONARY = ('auth', 'account', 'confirm', 'connect', 'enroll', 'http', 'https', 'info', 'login', 'mail', 'my',
4042
'online', 'payment', 'portal', 'recovery', 'register', 'ssl', 'safe', 'secure', 'signin', 'signup', 'support',
4143
'update', 'user', 'verify', 'verification', 'web', 'www')
@@ -137,6 +139,9 @@ def api_scan():
137139
return jsonify({'message': 'Bad request'}), 400
138140
if len(domain) > DOMAIN_MAXLEN:
139141
return jsonify({'message': 'Domain name is too long'}), 400
142+
for block in DOMAIN_BLOCKLIST:
143+
if str(block) in domain:
144+
return jsonify({'message': 'Not allowed'}), 400
140145
try:
141146
session = Session(j.get('url'), nameservers=NAMESERVERS)
142147
except Exception as err:

0 commit comments

Comments
 (0)