ci: verify the InRelease signature before trusting its freshness#27
Merged
Conversation
The health check read the Date field straight from the downloaded InRelease body, so an attacker or a poisoned cache could serve an unsigned response with a fresh Date and the staleness alert would pass. I now import the committed archive public key and gpg --decrypt the InRelease before reading anything from it, so the Date comes from the cryptographically verified body — the same trust anchor apt clients use. A missing or untrusted signature now fails the check loudly. Signed-off-by: Jaro-c <75870284+Jaro-c@users.noreply.github.com>
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.
What
The scheduled health check now verifies the
InReleaseGPG signature against the committed archive public key (keyring/glyndor-apt-key.asc) before reading theDatefield, and reads that field from the cryptographically verified body rather than the raw download.Why
The check read
Date:straight from the downloadedInRelease. An attacker able to serve a response, or a poisoned cache, could present an unsigned body with a freshDateand the staleness alert would pass — the freshness signal was spoofable. This does not weaken what apt clients trust (they verify the index themselves), but the monitor that guards against a silent stale archive must gate on the same anchor. A missing or untrusted signature now fails the check loudly.Notes
checkoutstep so the workflow can reach the committed public key.GNUPGHOME, cleaned up on exit.