Skip to content

Commit

Permalink
[PATCH] [fix] Drop duplicate fileinfo checks from 'addedfiles'
Browse files Browse the repository at this point in the history
The fileinfo permissions checks were in both the permissions and
addedfiles inspections.  We only need them in the permissions
inspection.

Fixes: #1105

Signed-off-by: David Cantrell <dcantrell@redhat.com>
  • Loading branch information
dcantrell committed Apr 24, 2023
1 parent 959e480 commit 1806bd5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 65 deletions.
6 changes: 0 additions & 6 deletions lib/inspect_addedfiles.c
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,6 @@ static bool addedfiles_driver(struct rpminspect *ri, rpmfile_entry_t *file)
}
}

/* Check for any new setuid or setgid files */
if (!S_ISDIR(file->st.st_mode) && (file->st.st_mode & (S_ISUID|S_ISGID))) {
match_fileinfo_mode(ri, file, NAME_ADDEDFILES, remedy_addedfiles, &result, &reported);
goto done;
}

/*
* Report that a new file has been added in a build comparison.
*/
Expand Down
59 changes: 0 additions & 59 deletions test/test_addedfiles.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,65 +168,6 @@ def setUp(self):
self.waiver_auth = "Anyone"


# Expected security mode as defined in fileinfo -> INFO
class ExpectedSecurityModeRPMs(TestRPMs):
def setUp(self):
super().setUp()

self.rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)

self.inspection = "addedfiles"
self.result = "INFO"
self.waiver_auth = "Not Waivable"


class ExpectedSecurityModeKoji(TestKoji):
def setUp(self):
super().setUp()

self.rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)

self.inspection = "addedfiles"
self.result = "INFO"
self.waiver_auth = "Not Waivable"


class ExpectedSecurityModeCompareRPMs(TestCompareRPMs):
def setUp(self):
super().setUp()

self.before_rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)
self.after_rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)

self.inspection = "addedfiles"
self.result = "INFO"
self.waiver_auth = "Not Waivable"


class ExpectedSecurityModeCompareKoji(TestCompareKoji):
def setUp(self):
super().setUp()

self.before_rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)
self.after_rpm.add_installed_file(
"usr/bin/mount", rpmfluff.SourceFile("mount.bin", ri_bytes), mode="4755"
)

self.inspection = "addedfiles"
self.result = "INFO"
self.waiver_auth = "Not Waivable"


# Unexpected security file (not defined in fileinfo) -> BAD
# This check only happens for comparison runs because rpminspect needs a
# before build to know that something new was added.
Expand Down
2 changes: 2 additions & 0 deletions test/test_permissions.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def setUp(self):
)

self.inspection = "permissions"
# SRPM is a no-op
self.result = "OK"


Expand Down Expand Up @@ -84,6 +85,7 @@ def setUp(self):
)

self.inspection = "permissions"
# SRPM is a no-op
self.result = "OK"


Expand Down

0 comments on commit 1806bd5

Please sign in to comment.