Skip to content

Commit

Permalink
Fix file_permissions_unauthorized_sgid
Browse files Browse the repository at this point in the history
Fix rule file_permissions_unauthorized_sgid for bootable containers.
We will filter out the /sysroot directory from our scan because it
contains only the physical root and not the real file system.

See:
https://containers.github.io/bootc/filesystem-sysroot.html#sysroot-mount
  • Loading branch information
jan-cerny committed Nov 12, 2024
1 parent 33a7ba2 commit 86b165e
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@
<unix:sgid datatype="boolean">true</unix:sgid>
</unix:file_state>

<unix:file_state id="state_file_permissions_unauthorized_sgid_sysroot" version="1"
comment="Used to filter out all files in the /sysroot directory">
<unix:filepath operation="pattern match">^/sysroot/.*$</unix:filepath>
</unix:file_state>

{{%- set var_local_mount_points = "var_" ~ rule_id ~ "_local_mountpoints" -%}}
{{{ create_local_mount_points_list(var_local_mount_points) }}}

Expand All @@ -28,6 +33,7 @@
var_ref="{{{ var_local_mount_points }}}"/>
<unix:filename operation="pattern match">^.*$</unix:filename>
<filter action="include">state_file_permissions_unauthorized_sgid_set</filter>
<filter action="exclude">state_file_permissions_unauthorized_sgid_sysroot</filter>
</unix:file_object>

<local_variable id="var_file_permissions_unauthorized_sgid_all_sgid_files" version="1"
Expand Down

0 comments on commit 86b165e

Please sign in to comment.