SOURCE_DATE_EPOCH specification

Chris Lamb

Revision History
Revision 1.001 September 2015
Initial version.

Table of Contents

Introduction
Motivation
Build timestamps
Specification
SOURCE_DATE_EPOCH
Examples
Copyright
Contributors

Introduction

This specification defines a distribution-agnostic standard for build systems to exchange a timestamp.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119.

The canonical URI for this document is: https://reproducible-builds.org/specs/source-date-epoch/.

Motivation

Whilst anyone can inspect the source code of free software for malicious flaws, most distributions provide binary (or "compiled") packages to end users. The motivation behind "reproducible" builds is to allow verification that no flaws have been introduced during this compilation process by promising identical binary packages are always generated from a given source.

This prevents against the installation of backdoor-introducing malware on developers' machines as an attacker would need to simultaneously infect all the developers attempting to reproduce the build. In addition, a reproducible build has other technical advantages:

  • Requires the removal of any non-deterministic and/or unsafe behaviour, eg. connecting to the internet to download build-dependencies or reading from uninitialised memory

  • Detects corrupted or outdated build environments

  • Provides validation of packages built on foreign architectures

  • Reduces time-to-detection of a build host compromise

  • Can show that proposed changes have no impact on binaries

Build timestamps

Software packages are often unreproducible because they embed compile-time timestamps into generated files. As the current time changes between builds, this results in the binaries containing different contents. Futhermore, these dates are unreliable indicators of the software's age given that software can be arbitrarily rebuilt.

An improvement is to use the last modification time of the source; if the source is then modified, the binaries will change by design. This timestamp is also more informative as it reflects the actual age of the software and not when it was last compiled.

However, in the context of a distribution, the last modification time is not a property of the upstream source, but rather of the packaging that encapsulates it.

This specification therefore defines a distribution-agnostic standard for upstream build processes to consume this timestamp from packaging systems.

Specification

SOURCE_DATE_EPOCH

A UNIX timestamp, defined as the number of seconds (excluding leap seconds) since 01 Jan 1970 00:00:00 UTC.

The value MUST be exported through the operating system's usual environment mechanism.

The value MUST be an ASCII representation of an integer with no fractional component, identical to the output of date +%s.

The value SHOULD be set to the last modification time of the source, incorporating any packaging-specific modifications. For example, in Debian, the timestamp of the latest entry in debian/changelog.

Upstream build processes MUST use this variable for embedded timestamps in place of the "current" date and time.

Build systems MUST NOT overwrite this variable for child processes to consume if it is already present.

Formatting MUST be deferred until runtime if an end user should observe the value in their own locale or timezone.

If the value is malformed, the build process SHOULD exit with a non-zero error code.

Examples

Examples are available at https://wiki.debian.org/ReproducibleBuilds/TimestampsProposal#Examples.

Copyright

Copyright © 2015 See Contributors List

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contributors

  • Axel Beckert

  • Chris Lamb (lamby)

  • Chris West (Faux)

  • Dmitry Shachnev

  • Eduard Sanou

  • Holger Levsen

  • Jérémy Bobbio (Lunar)

  • Mattia Rizzolo

  • Ximin Luo