From 4a5d619ad1e49eaad91d623cb841963b434567ec Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 31 Mar 2020 20:06:03 +0200 Subject: [PATCH] Do not fail miserably if not able to parse nginx conf --- package_linter.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/package_linter.py b/package_linter.py index 5be5792..6eef4a8 100755 --- a/package_linter.py +++ b/package_linter.py @@ -240,7 +240,11 @@ class App(): if do_path_traversal_check: from lib.nginxparser import nginxparser - nginxconf = nginxparser.load(open(self.path + "/conf/" + filename)) + try: + nginxconf = nginxparser.load(open(self.path + "/conf/" + filename)) + except Exception as e: + print_warning_not_reliable("Could not parse nginx conf ... : " + str(e)) + nginxconf = [] for location in find_path_traversal_issue(nginxconf): print_error(