Add SOURCE_DATE_EPOCH support for reproducible builds#1537
Merged
neolynx merged 1 commit intoaptly-dev:masterfrom Feb 28, 2026
Merged
Add SOURCE_DATE_EPOCH support for reproducible builds#1537neolynx merged 1 commit intoaptly-dev:masterfrom
neolynx merged 1 commit intoaptly-dev:masterfrom
Conversation
Implement support for the SOURCE_DATE_EPOCH environment variable as specified by reproducible-builds.org. When set, this variable overrides the current timestamp in the Release file's Date and Valid-Until fields, enabling reproducible filesystem publishes. - Read SOURCE_DATE_EPOCH environment variable in Publish() - Use the epoch timestamp for both Date and Valid-Until fields - Gracefully fallback to current time if unset or invalid - Add comprehensive tests for valid and invalid SOURCE_DATE_EPOCH values
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #1537 +/- ##
==========================================
- Coverage 76.96% 76.64% -0.32%
==========================================
Files 160 160
Lines 14754 14757 +3
==========================================
- Hits 11355 11311 -44
- Misses 2266 2317 +51
+ Partials 1133 1129 -4 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
@neolynx Can you please have a look? |
Contributor
Author
|
Thanks man! |
tonobo
added a commit
to tonobo/aptly
that referenced
this pull request
Mar 3, 2026
Both the external GPG signer (--faked-system-time) and internal Go OpenPGP signer (signerConfig.Time) now honor SOURCE_DATE_EPOCH, producing reproducible signatures alongside the plain Release file dates. Adds system tests for both signer backends verifying byte-identical Release, Release.gpg and InRelease across repeated publishes. The internal signer test (PublishRepo38Test) uses an Ed25519 key because Ed25519 signatures are deterministic by design. The Go openpgp library uses a random nonce for DSA/ECDSA (see signature.go Sign calls using config.Random() link below) so those signatures vary across runs even with a fixed timestamp, making byte-identical verification impossible. In addition to 49f3428 Ref: aptly-dev#1537 Ref: https://github.com/ProtonMail/go-crypto/blob/v1.4.0/openpgp/packet/signature.go#L945-L979
tonobo
added a commit
to tonobo/aptly
that referenced
this pull request
Mar 3, 2026
Both the external GPG signer (--faked-system-time) and internal Go OpenPGP signer (signerConfig.Time) now honor SOURCE_DATE_EPOCH, producing reproducible signatures alongside the plain Release file dates. Adds system tests for both signer backends verifying byte-identical Release, Release.gpg and InRelease across repeated publishes. The internal signer test (PublishRepo38Test) uses an ed25519 key because ed25519 signatures are deterministic by design. The Go openpgp library uses a random nonce for DSA/ECDSA (see signature.go Sign calls using config.Random() link below) so those signatures vary across runs even with a fixed timestamp, making byte-identical verification impossible. In addition to 49f3428 Ref: aptly-dev#1537 Ref: https://github.com/ProtonMail/go-crypto/blob/v1.4.0/openpgp/packet/signature.go#L945-L979
6 tasks
tonobo
added a commit
to tonobo/aptly
that referenced
this pull request
Mar 3, 2026
Both the external GPG signer (--faked-system-time) and internal Go OpenPGP signer (signerConfig.Time) now honor SOURCE_DATE_EPOCH, producing reproducible signatures alongside the plain Release file dates. Adds system tests for both signer backends verifying byte-identical Release, Release.gpg and InRelease across repeated publishes. The signer tests (PublishRepo3[78]Test) are using an ed25519 key because ed25519 signatures are deterministic by design. The Go openpgp library uses a random nonce for DSA/ECDSA (see signature.go Sign calls using config.Random() link below) so those signatures vary across runs even with a fixed timestamp, making byte-identical verification impossible. In addition to 49f3428 Ref: aptly-dev#1537 Ref: https://github.com/ProtonMail/go-crypto/blob/v1.4.0/openpgp/packet/signature.go#L945-L979
tonobo
added a commit
to tonobo/aptly
that referenced
this pull request
Mar 3, 2026
Both the external GPG signer (--faked-system-time) and internal Go OpenPGP signer (signerConfig.Time) now honor SOURCE_DATE_EPOCH, producing reproducible signatures alongside the plain Release file dates. Adds system tests for both signer backends verifying byte-identical Release, Release.gpg and InRelease across repeated publishes. The signer tests (PublishRepo3[78]Test) are using an ed25519 key because ed25519 signatures are deterministic by design. The Go openpgp library uses a random nonce for DSA/ECDSA (see signature.go Sign calls using config.Random() link below) so those signatures vary across runs even with a fixed timestamp, making byte-identical verification impossible. In addition to 49f3428 Ref: aptly-dev#1537 Ref: https://github.com/ProtonMail/go-crypto/blob/v1.4.0/openpgp/packet/signature.go#L945-L979
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of the Change
Reproducible builds ensure that building the same source input always produces byte-identical output, regardless of when or where the build happens. This is important for security and trust: anyone can independently verify that published binaries actually correspond to their source code, with no tampering or hidden modifications.
When aptly publishes a repository to the filesystem, the Release file includes a Date field set to the current time. This means publishing the same packages twice produces different output, breaking reproducibility. By honoring SOURCE_DATE_EPOCH (a Unix timestamp typically derived from the last source change), the Date and Valid-Until fields become deterministic, making the entire published repository output byte-identical across runs with the same input.
This follows the https://reproducible-builds.org/specs/source-date-epoch/ specification, which is widely adopted across the Debian ecosystem and other projects.
Checklist
AUTHORS