You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Change regex definitions to use raw strings (#285)
Change regex definitions to use raw strings in order to avoid e.g.
pylint throwing `SyntaxError` due to invalid escape sequences like
`'\.'` which should either be written as `'\\.'` or `r'\.'` instead.
Please refer to https://docs.python.org/3/howto/regex.html for further
details.
We already have implicit unit tests to cover this change as the regex
raw strings are used e.g. in the `migerrors` cronjob, which is
automatically generated and checked against the constant fixture version
in `tests/test_mig_shared_install.py`.
Copy file name to clipboardExpand all lines: mig/shared/defaults.py
+3-2Lines changed: 3 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -497,10 +497,11 @@
497
497
498
498
# Detect and ban cracking attempts and unauthorized vulnerability scans
499
499
# A pattern to match usernames unambiguously identifying cracking attempts
500
-
CRACK_USERNAME_REGEX='(root|bin|daemon|adm|admin|administrator|superadmin|localadmin|mysqladmin|lp|operator|controller|ftp|irc|nobody|sys|pi|guest|financeiro|Management|www|www-data|mysql|postgres|oracle|mongodb|sybase|redis|hadoop|zimbra|cpanel|plesk|openhabian|tomcat|exim|postfix|sendmail|mailnull|postmaster|mail|uucp|news|teamspeak|git|svn|cvs|user|ftpuser|ubuntu|ubnt|supervisor|csgoserver|device|laboratory|deploy|lighthouse|TO BE ANNOUNCED|support|info|test[0-9]*|user[0-9]*|[0-9]+|root;[a-z0-9]+)'
500
+
# NOTE: use raw strings to avoid escapes causing SyntaxError on recent python
501
+
CRACK_USERNAME_REGEX=r'(root|bin|daemon|adm|admin|administrator|superadmin|localadmin|mysqladmin|lp|operator|controller|ftp|irc|nobody|sys|pi|guest|financeiro|Management|www|www-data|mysql|postgres|oracle|mongodb|sybase|redis|hadoop|zimbra|cpanel|plesk|openhabian|tomcat|exim|postfix|sendmail|mailnull|postmaster|mail|uucp|news|teamspeak|git|svn|cvs|user|ftpuser|ubuntu|ubnt|supervisor|csgoserver|device|laboratory|deploy|lighthouse|TO BE ANNOUNCED|support|info|test[0-9]*|user[0-9]*|[0-9]+|root;[a-z0-9]+)'
501
502
# A pattern to match failed web access prefixes unambiguously identifying
0 commit comments