Skip to content

lint: warn about potential UID/GID drift under /etc; respect tmpfiles chown (z/Z) (#1562)#1570

Open
rishi-jat wants to merge 2 commits intobootc-dev:mainfrom
rishi-jat:fix/1562-uid-drift-lint
Open

lint: warn about potential UID/GID drift under /etc; respect tmpfiles chown (z/Z) (#1562)#1570
rishi-jat wants to merge 2 commits intobootc-dev:mainfrom
rishi-jat:fix/1562-uid-drift-lint

Conversation

@rishi-jat
Copy link

@rishi-jat rishi-jat commented Sep 1, 2025

Description

This adds a new container lint (etc-uid-drift) that warns when files or directories under /etc are owned by non-root users or groups that aren’t numerically pinned in systemd-sysusers and aren’t covered by systemd-tmpfiles chown rules. The goal is to help catch ownership that can “drift” across upgrades when /etc persists.

The lint parses usr/lib/sysusers.d to find users/groups with fixed numeric IDs, and scans usr/lib/tmpfiles.d for z/Z entries (chown at boot, either exact or recursive). It walks /etc (skipping symlinks, handling non‑UTF8 paths), and warns on entries where uid/gid is non-root, not pinned via sysusers, and not covered by a tmpfiles chown. For example, if a component uses a floating user but ships a tmpfiles rule like Z /etc/polkit-1/…, the lint will not warn.

This is a warning-only check (can be promoted to fatal with --fatal-warnings) and does not change runtime behavior.

Fixes #1562

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

lint: Check for potential uid drift for files in /etc

2 participants