this post was submitted on 13 Aug 2023
72 points (96.2% liked)

Open Source

29025 readers
235 users here now

All about open source! Feel free to ask questions, and share news, and interesting stuff!

Useful Links

Rules

Related Communities

Community icon from opensource.org, but we are not affiliated with them.

founded 4 years ago
MODERATORS
 

I have forked a project's source code on GitHub. The program takes a private key as an input and that key must never leave the client. If I want to share a pre-built executable as a release it is essential that I can prove beyond reasonable doubt that it is built from the published source.

I have learned about how to publish the releases by using a Workflow in the GitHub actions such that GitHub itself will build the project and then repare a release draft with the built files as well as the file hashes..

However, I noticed that the release is first drafted, and at that point I have the option to manually swap the executable and the hashes. As far as I can tell, a user will not be able to tell if I swapped a file and its corresponding hashes. Or, is there a way to tell?

One potential solution that I have found is that I can pipe the output of the hashing both to a file that is stored and also to the publicly visible logs by using "tee". This will make it such that someone can look through the logs of the build process and confirm that the hashes match the hashes published in the release.

Like this:

I would like to know whether:

  • There is already some built-in method to confirm that a file is the product of a GitHub workflow

  • The Github Action logs can easily be tampered by the repo owner, and the hashes in the logs can be swapped, such that my approach is still not good enough evidence

  • If there is another, perhaps more standard method, to prove that the executable is built from a specific source code.

you are viewing a single comment's thread
view the rest of the comments
[–] prcrst 26 points 11 months ago (9 children)

I don't know whether github actions output can be tampered with by you, but the only actually reliable way (that I know of) to prove that your binaries correspond to a certain state of the sourcecode is to support reproducible builds (See e.g. https://reproducible-builds.org/).

All other methods require trust (in either the developer or w.r.t. github actions towards github).

The drawback is of course, that to verify whether your binaries are good, someone needs to rebuild the software, but it is a good tool to build and maintain trust in your signed binaries, especially if they deal with sensitive information like private keys.

[–] [email protected] 10 points 10 months ago (1 children)

An important point to add for someone who hasn't heard of reproducible builds before: The key difference to a normal build process is that it is 100% deterministic i.e. it produces exactly the same output every time.

You might think that most built processes would be like this by default, however this is not the case. Compilers and linkers usually have some non-deterministic values that they put in the final binary such as timestamps. For a build to be deterministic these sources of variation must be disabled or mocked to be a repeatable value (i.e. not based on the actual compile time).

[–] prcrst 5 points 10 months ago (1 children)

True, while I think the page that I linked explains the concept well, it might not be easy to digest for someone who is new to software development.

But then again, if you handle cryptographic materiel, you better learn fast 😃

[–] [email protected] 4 points 10 months ago (1 children)

Yeah that site is pretty good. There's a lot of information though. I think a good starting point is maybe this page: https://reproducible-builds.org/docs/env-variations/

[–] prcrst 2 points 10 months ago* (last edited 10 months ago) (1 children)

Yeah, this topic would actually lend itself to an intro video which demonstrates the problem on a tiny project.

[–] [email protected] 2 points 10 months ago

Unfortunately given how hard reproducible builds are they aren't done much, and aren't talked about much. A vicious cycle. A nice short video would indeed be helpful for understand and awareness.

load more comments (7 replies)