You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
test_posix._test_all_chown_common ignores the effective gid when checking group-0 membership #151519
The guard uses only os.getgroups() (the supplementary groups). But the
kernel's permission check for changing a file's group accepts the group if it
is the process's effective/filesystem gidor one of the supplementary
groups (in_group_p() checks fsgid, which tracks egid). os.getgroups() does
not necessarily include the effective gid.
So when a process runs with effective gid 0 and a non-zero uid — common
in containers, user namespaces, and CI sandboxes — chown(file, -1, 0)
succeeds (the process is a member of group 0 via its egid), and the assertion
fails:
AssertionError: OSError not raised by chown
AssertionError: OSError not raised by lchown
The owner-changing assertions just above (chown(file, 0, 0) / (0, -1)) still
correctly raise, since changing the owner requires CAP_CHOWN, which such a
process does not have — so only the group-to-0 assertion is affected.
Activity
gh-151519: Check effective gid in `_test_all_chown_common` group-0 gu…
[3.13] gh-151519: Check effective gid in `_test_all_chown_common` gro…
[3.14] gh-151519: Check effective gid in `_test_all_chown_common` gro…
[3.15] gh-151519: Check effective gid in `_test_all_chown_common` gro…
pythongh-151519: Check effective gid in `_test_all_chown_common` grou…