Use of a try
... except
block where the except block does not contain anything other than comments and a continue
statement is considered bad security practice.
Whilst an attacker may be trying to exploit exceptions in your code, you should, at the very least, log these exceptions.
try:
do_things
except ThisBadException:
# do nothing!
continue
- Fix the reason why the exception occurs
- Consider using a
raise from
statement - Add logging to the except blog