Skip to content

Commit 49b94e6

Browse files
committed
feat: add rule to check root user is member of group root
This rule makes sure that the assumptions of user `root` being uid=0 is the sole member of group `root` with gid=0 are true. This prevents access to any root-owned files by non-privileged users. Signed-off-by: Claudius Heine <ch@denx.de>
1 parent 458a6e7 commit 49b94e6

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

controls/os_spec.rb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -312,3 +312,17 @@
312312
end
313313
end
314314
end
315+
316+
control 'os-16' do
317+
impact 1.0
318+
title 'User \'root\' should be member of group \'root\' with gid \'0\''
319+
desc 'This prevents root-owned files and directories to be accessible to non-privileged users'
320+
describe passwd.uids(0) do
321+
its('users') { should cmp 'root' }
322+
its('gids') { should cmp 0 }
323+
end
324+
describe etc_group.where(gid: 0) do
325+
its('groups') { should cmp 'root' }
326+
its('users') { should be_empty }
327+
end
328+
end

0 commit comments

Comments
 (0)