Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RFE: user root:root permissions for files in SRPM #2604

Closed
NeilHanlon opened this issue Aug 4, 2023 · 3 comments · Fixed by #2797
Closed

RFE: user root:root permissions for files in SRPM #2604

NeilHanlon opened this issue Aug 4, 2023 · 3 comments · Fixed by #2797
Assignees
Labels

Comments

@NeilHanlon
Copy link

when building a source RPM, the username and filesystem permissions from the build host are preserved and end up propagating to a machine you extract them onto, e.g.. To be able to reproduce SRPMs, we should have predictable conventions for the permissions and ownership of files.

The idea we have come up with in the reproducibility hackfest was to adopt a git-style model of permission storage, i.e., dropping most information about the unix permissions. This model also just makes more sense, overall, for what source RPMS are.

Additionally, it would be useful to clamp the ownership of the files to root:root--though this will necessitate ensuring that the applications which work with RPM input/output respect this clamping and change the permissions if a user extracts or installs it. (Namely, we don't want a user to install an RPM with files they cannot touch or see)

@pmatilai pmatilai added the RFE label Sep 14, 2023
@pmatilai
Copy link
Member

Indeed, storing the local user/group into src.rpm makes no sense whatsoever. It's an anachronism from the ancient days before Buildroot was a thing that has somehow survived all the way up to this date. We've made some effort to swipe the symptoms under the carpet (ie avoid pointless warnings when this happens) but might as well address the root cause instead.

@pmatilai pmatilai added the fileformat Matters concerning package (file) format label Sep 14, 2023
@keszybz
Copy link
Contributor

keszybz commented Sep 14, 2023

it would be useful to clamp the ownership of the files to root:root--though this will necessitate ensuring that the applications which work with RPM input/output respect this clamping and change the permissions if a user extracts or installs it. (Namely, we don't want a user to install an RPM with files they cannot touch or see)

Actually this is not an issue. A user cannot create files they cannot touch or see: if we do the proposed change, if running as root, the file is created owned by root, but anyway, for root the ownership and permission mask are ignored. If running as a user, they cannot create any files not owned by them.

So please just store the files as uid=0, gid=0, mask=-rwxrwxrwx or drwxrwxrwx. This way, the right thing will happen, i.e. file will always be owned by the user and the permission mask will be determined by the user's umask.

@pmatilai
Copy link
Member

Yes, the only real change needed here is the stored user/group. I doubt it ever made sense, really

@pmatilai pmatilai changed the title RFE: allow clamping username and permissions for source RPMs RFE: user root:root permissions for files in SRPM Sep 15, 2023
pmatilai added a commit to pmatilai/rpm that referenced this issue Nov 30, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: rpm-software-management#2604
@pmatilai pmatilai self-assigned this Nov 30, 2023
pmatilai added a commit to pmatilai/rpm that referenced this issue Nov 30, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: rpm-software-management#2604
@pmatilai pmatilai removed the fileformat Matters concerning package (file) format label Nov 30, 2023
pmatilai added a commit that referenced this issue Dec 4, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: #2604
dmnks pushed a commit to dmnks/rpm that referenced this issue Dec 11, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: rpm-software-management#2604
(backported from commit a0553eb)
dmnks pushed a commit to dmnks/rpm that referenced this issue Dec 12, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: rpm-software-management#2604
(backported from commit a0553eb)
dmnks pushed a commit that referenced this issue Dec 12, 2023
There's no situation where rpmbuild should use uid/gid from either
the filesystem or current user. The former made sense in the
pre-historic times before Buildroot was a thing, but in the last 20+
years that's always the wrong thing to do. Always. The only user/group
info rpm can legitimately use is the one that is explicitly specified in
the packaging, and otherwise fallback to root/equivalent.

Besides fixing a long-standing annoyance with src.rpm file ownership,
this also fixes a regression in 4.19.0 where a non-local or otherwise
unresolvable user info could cause a segfault during rpmbuild (RhBug:2248763).

Fixes: #2604
(backported from commit a0553eb)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants