2
0
mirror of https://gitlab.com/apparmor/apparmor synced 2025-08-30 13:58:22 +00:00

utils: test in test-minitools for resiliency against unparseable profiles

Since all the tools that load profiles go through the same module, this should
be sufficient as a first pass.

Signed-off-by: Ryan Lee <ryan.lee@canonical.com>
This commit is contained in:
Ryan Lee 2025-02-27 16:05:35 -08:00
parent e71e27be70
commit e80d5bd3d4

View File

@ -66,6 +66,17 @@ class MinitoolsTest(AATest):
None,
'Audit flag could not be removed in profile ' + self.local_profilename)
def test_audit_with_garbage(self):
# Inject a garbage profile into the profile directory and check that
# test_audit still passes
with open(self.profile_dir + "/duchamps_readymades", "w") as fil:
fil.write("a porcelain toilet rotated on its side and signed")
try:
self.test_audit()
finally:
os.unlink(self.profile_dir + "/duchamps_readymades")
def test_complain(self):
# Set test profile to complain mode and check if it was correctly set
subprocess.check_output(