From b6e024c39589267b614d16aeed682e464dd1d7c8 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Tue, 23 Jul 2024 20:49:50 +0200 Subject: [PATCH] My_webapp has a legit case for chown root x_x --- package_linter.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/package_linter.py b/package_linter.py index 0f9bec6..d293bec 100755 --- a/package_linter.py +++ b/package_linter.py @@ -493,7 +493,7 @@ class App(TestSuite): self.path = path self.manifest_ = Manifest(self.path) self.manifest = self.manifest_.manifest - self.scripts = {f: Script(self.path, f) for f in scriptnames} + self.scripts = {f: Script(self.path, f, self.manifest.get("id")) for f in scriptnames} self.configurations = Configurations(self) self.app_catalog = AppCatalog(self.manifest["id"]) @@ -2262,9 +2262,10 @@ class AppCatalog(TestSuite): # |_| # ################################## class Script(TestSuite): - def __init__(self, app_path, name): + def __init__(self, app_path, name, app_id): self.name = name self.app_path = app_path + self.app_id = app_id self.path = app_path + "/scripts/" + name self.exists = file_exists(self.path) if not self.exists: @@ -2689,6 +2690,11 @@ class Script(TestSuite): @test() def chownroot(self): + + # Mywebapp has a legit use case for this >_> + if self.app_id == "my_webapp": + return + if self.containsregex( r"^\s*chown.* root:?[^$]* .*install_dir" ) and not self.contains('chown root:root "$install_dir"'):