From d091691b3d4e4c291ddb717cd6c107461404bc57 Mon Sep 17 00:00:00 2001 From: Tim Abbott Date: Thu, 19 Jan 2017 15:59:06 -0800 Subject: [PATCH] lint: Require access_message to access Message objects. --- tools/lint-all | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tools/lint-all b/tools/lint-all index 65f03555d3..925c5fabbd 100755 --- a/tools/lint-all +++ b/tools/lint-all @@ -344,6 +344,11 @@ def build_custom_checkers(by_lang): '''Do not call self.client directly for put/patch/post/get. See WRAPPER_COMMENT in test_helpers.py for details. '''}, + # Directly fetching Message objects in e.g. views code is often a security bug. + {'pattern': '[^r][M]essage.objects.get', + 'exclude': set(["zerver/tests", "zerver/worker/queue_processors.py"]), + 'description': 'Please use access_message() to fetch Message objects', + }, # This rule might give false positives in virtualenv setup files which should be excluded, # and comments which should be rewritten to avoid use of "python2", "python3", etc. {'pattern': 'python[23]',