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

[RFC] rpmbuild,check: verify file hashes #3039

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

nmanthey
Copy link

During the %check target, no files that existed before are expected to be modified. This change adds a validation to the rpmbuild command, which will store file hashes, and compare them after compilation again.

Note: this is only a simple demonstrator that cannot handle large projects, and it is using a very simply hash function.

Note

This is a demonstrator to steer discussions. A fully functional variant would likely use a dynamic container to store the hashes, handle errors better, and use a more sophisticated hash function.

We are aware that there are ways around this validation and still modify build files from the %check phase.

This is one way to implement the requirement to have an immutable build root during rpmbuild's %check phase, as described in #3010

Testing Done

I compiled the xz-utils package of Amazon Linux 2 in an Amazon Linux 2 container image with this change. We also tested a malicious RPM that modified its build files during %check.

During the %check target, no files that existed before are expected to
be modified. This change adds a validation to the rpmbuild command,
which will store file hashes, and compare them after compilation again.

Note: this is only a simple demonstrator that cannot handle large
projects, and it is using a very simply hash function.

Signed-off-by: Norbert Manthey <[email protected]>
@pmatilai
Copy link
Member

Rpm already hashes any packaged content cryptographically (SHA256 by default), any such mechanism should utilize that to minimize the extra cost.

But this seems like a big extra cost with limited benefit, we're more interested in preventing writes across the different stages.

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.

None yet

2 participants