mirror of
https://github.com/simple-login/app.git
synced 2025-02-24 15:53:22 +08:00
add sanitize check for alias, mailbox, contact reply-email
This commit is contained in:
parent
40892f8253
commit
8faae3d0d4
1 changed files with 14 additions and 5 deletions
19
cron.py
19
cron.py
|
@ -39,6 +39,7 @@ from app.models import (
|
||||||
AppleSubscription,
|
AppleSubscription,
|
||||||
Mailbox,
|
Mailbox,
|
||||||
Monitoring,
|
Monitoring,
|
||||||
|
Contact,
|
||||||
)
|
)
|
||||||
from server import create_app
|
from server import create_app
|
||||||
|
|
||||||
|
@ -313,12 +314,20 @@ def sanity_check():
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
|
||||||
for user in User.filter_by(activated=True).all():
|
for user in User.filter_by(activated=True).all():
|
||||||
if user.email.lower() != user.email:
|
if user.email.lower().strip().replace(" ", "") != user.email:
|
||||||
LOG.exception("%s does not have lowercase email", user)
|
LOG.exception("%s does not have sanitized email", user)
|
||||||
|
|
||||||
for mailbox in Mailbox.filter_by(verified=True).all():
|
for alias in Alias.query.all():
|
||||||
if mailbox.email.lower() != mailbox.email:
|
if alias.email.lower().strip().replace(" ", "") != alias.email:
|
||||||
LOG.exception("%s does not have lowercase email", mailbox)
|
LOG.exception("Alias %s email not sanitized", alias)
|
||||||
|
|
||||||
|
for contact in Contact.query.all():
|
||||||
|
if contact.reply_email.lower().strip().replace(" ", "") != contact.reply_email:
|
||||||
|
LOG.exception("Contact %s reply-email not sanitized", contact)
|
||||||
|
|
||||||
|
for mailbox in Mailbox.query.all():
|
||||||
|
if mailbox.email.lower().strip().replace(" ", "") != mailbox.email:
|
||||||
|
LOG.exception("Mailbox %s address not sanitized", mailbox)
|
||||||
|
|
||||||
LOG.d("Finish sanity check")
|
LOG.d("Finish sanity check")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue