Reproducible builds: Difference between revisions
Add all author names to citation |
No edit summary |
||
Line 3: | Line 3: | ||
'''Reproducible builds''', also known as '''deterministic compilation''', is a process of [[compiling]] software which ensures the resulting [[binary code]] can be [[Reproducibility|reproduced]]. [[Source code]] compiled using deterministic compilation will always output the same binary.<ref name="reproducible-builds-homepage">{{Cite web |url=https://reproducible-builds.org |title=reproducible-builds.org |website=reproducible-builds.org |archive-url=https://web.archive.org/web/20160520123008/https://reproducible-builds.org/ |archive-date=20 May 2016 |url-status=live |access-date=22 August 2016 |quote=Reproducible builds are a set of software development practices which create a verifiable path from human readable source code to the binary code used by computers....build system needs to be made entirely deterministic: transforming a given source must always create the same result. }}</ref><ref>{{Cite web |url=http://www.securityweek.com/establishing-correspondence-between-application-and-its-source-code |title=Establishing Correspondence Between an Application and its Source Code {{!}} SecurityWeek.com |last=Ratliff |first=Emily |date=4 April 2016 |website=www.securityweek.com |publisher=SecurityWeek |archive-url=https://web.archive.org/web/20160920014341/http://www.securityweek.com/establishing-correspondence-between-application-and-its-source-code |archive-date=20 September 2016 |url-status=live |access-date=22 August 2016}}</ref> |
'''Reproducible builds''', also known as '''deterministic compilation''', is a process of [[compiling]] software which ensures the resulting [[binary code]] can be [[Reproducibility|reproduced]]. [[Source code]] compiled using deterministic compilation will always output the same binary.<ref name="reproducible-builds-homepage">{{Cite web |url=https://reproducible-builds.org |title=reproducible-builds.org |website=reproducible-builds.org |archive-url=https://web.archive.org/web/20160520123008/https://reproducible-builds.org/ |archive-date=20 May 2016 |url-status=live |access-date=22 August 2016 |quote=Reproducible builds are a set of software development practices which create a verifiable path from human readable source code to the binary code used by computers....build system needs to be made entirely deterministic: transforming a given source must always create the same result. }}</ref><ref>{{Cite web |url=http://www.securityweek.com/establishing-correspondence-between-application-and-its-source-code |title=Establishing Correspondence Between an Application and its Source Code {{!}} SecurityWeek.com |last=Ratliff |first=Emily |date=4 April 2016 |website=www.securityweek.com |publisher=SecurityWeek |archive-url=https://web.archive.org/web/20160920014341/http://www.securityweek.com/establishing-correspondence-between-application-and-its-source-code |archive-date=20 September 2016 |url-status=live |access-date=22 August 2016}}</ref> |
||
Reproducible builds can act as part of a [[chain of trust]];<ref name=reproducible-builds-homepage/> the source code can be signed, and deterministic compilation can prove that the binary was compiled from trusted source code. |
Reproducible builds can act as part of a [[chain of trust]];<ref name=reproducible-builds-homepage/> the source code can be signed, and deterministic compilation can prove that the binary was compiled from trusted source code. Verified reproducible builds provide a strong countermeasure to detect binaries that do not match their source code, e.g., because an attacker has inserted malicious code into the binary (but not the source code, since it is the source code that developers normally review and modify). In a survey of 17 experts, reproducible builds had a very high utility rating from 58.8% participants, but also a high-cost rating from 70.6%.<ref>{{Cite web |url=https://arxiv.org/abs/2204.04008 |title=Taxonomy of Attacks on Open-Source Software Supply Chains |last=Ladisa |first=Piergiorgio |last2=Plate |first2=Henrik |last3=Martinez |first3=Matias |last4=Barais |first4=Olivier |date=19 April 2022|url-status=live |access-date=24 February 2023}}</ref> |
||
==Methods== |
==Methods== |
Revision as of 22:29, 24 February 2023
![](http://upload.wikimedia.org/wikipedia/commons/thumb/a/a8/Reproducible_Builds_project_logo.svg/220px-Reproducible_Builds_project_logo.svg.png)
Reproducible builds, also known as deterministic compilation, is a process of compiling software which ensures the resulting binary code can be reproduced. Source code compiled using deterministic compilation will always output the same binary.[1][2]
Reproducible builds can act as part of a chain of trust;[1] the source code can be signed, and deterministic compilation can prove that the binary was compiled from trusted source code. Verified reproducible builds provide a strong countermeasure to detect binaries that do not match their source code, e.g., because an attacker has inserted malicious code into the binary (but not the source code, since it is the source code that developers normally review and modify). In a survey of 17 experts, reproducible builds had a very high utility rating from 58.8% participants, but also a high-cost rating from 70.6%.[3]
Methods
For the compilation process to be deterministic, the input to the compiler must be the same, regardless of the build environment used. This typically involves normalizing variables that may change, such as order of input files, timestamps, locales, and paths.
Additionally, the compilers must not introduce non-determinism themselves. This sometimes happens when using hash tables with a random hash seed value. It can also happen when using the address of variables because that varies from address space layout randomization (ASLR).
Build systems, such as Bazel and Gitian,[4] can be used to automate deterministic build processes.
History
The GNU Project used reproducible builds in the early 1990s. Changelogs from 1992 indicate the ongoing effort.[5]
One of the older[6] projects to promote reproducible builds is the Bitcoin project with Gitian. Later, in 2013, the Tor (anonymity network) project started using Gitian for their reproducible builds.[7]
In July 2013 on the Debian project started implementing reproducible builds across its entire package archive.[8][9]
By July 2017 more than 90% of the packages in the repository have been proven to build reproducibly.[10]
In November 2018, the Reproducible Builds project joined the Software Freedom Conservancy.[11]
F-droid uses reproducible builds to provide a guarantee that the distributed APKs use the claimed free source code.[12]
The Tails portable operating system uses reproducible builds and explains to others how to verify their distribution.[13]
NixOS claims 100% reproducible build in June 2021.[14]
Challenges
According to the Reproducible Builds project, timestamps are "the biggest source of reproducibility issues. Many build tools record the current date and time... and most archive formats will happily record modification times on top of their own timestamps."[15] They recommend that "it is better to use a date that is relevant to the source code instead of the build: old software can always be built later" if it is reproducible. They identify several ways to modify build processes to do this:
- Set the SOURCE_DATE_EPOCH environment variable to the number seconds since January 1, 1970, using something from the source code. Tools that support this environment variable will use its value (when set) instead of the current date and time.
- Post-process output to remove timestamps or normalize them. The tool strip-nondeterminism can often help do this.
- Use a library like libfaketime to intercept requests for the current time of day and provide a controlled response.
In some cases other changes must be made to make a build process reproducible. For example, some data structures do not guarantee a stable order in each execution. A typical solution is to modify the build process to specify a sorted output from those structures. [16]
See also
References
- ^ a b "reproducible-builds.org". reproducible-builds.org. Archived from the original on 20 May 2016. Retrieved 22 August 2016.
Reproducible builds are a set of software development practices which create a verifiable path from human readable source code to the binary code used by computers....build system needs to be made entirely deterministic: transforming a given source must always create the same result.
- ^ Ratliff, Emily (4 April 2016). "Establishing Correspondence Between an Application and its Source Code | SecurityWeek.com". www.securityweek.com. SecurityWeek. Archived from the original on 20 September 2016. Retrieved 22 August 2016.
- ^ Ladisa, Piergiorgio; Plate, Henrik; Martinez, Matias; Barais, Olivier (19 April 2022). "Taxonomy of Attacks on Open-Source Software Supply Chains". Retrieved 24 February 2023.
{{cite web}}
: CS1 maint: url-status (link) - ^ "Gitian: a secure software distribution method". gitian.org. Retrieved 2018-01-10.
- ^ "Email describing GNU reproducible builds".
- ^ "LICENSE-file of the Gitian-Project". Retrieved 2019-12-03.
- ^ Deterministic Builds Part Two: Technical Details. October 04, 2013
- ^ "Reproducible Builds talk in Debian".
- ^ "Reproducible Builds history".
- ^ "Linux-Distributionen: Mehr als 90 Prozent der Debian-Pakete reproduzierbar - Golem.de" (in German). 2017-07-24. Retrieved 2018-10-30.
- ^ "Reproducible Builds joins the Software Freedom Conservancy". Retrieved 2018-12-15.
- ^ "Reproducible Builds". F-Droid.
- ^ "Verifying a Tails image for reproducibility". Tails.
- ^ "Nixos-unstable's iso_minimal.x86_64-linux is 100% reproducible!". NixOS Discourse. 2021-06-20. Retrieved 2021-06-21.
- ^ "Timestamps". Reproducible builds. Retrieved 2022-04-16.
- ^ "Timestamps". Reproducible builds. Retrieved 2022-04-16.