Skip to content

Conversation

@dmcilvaney
Copy link
Contributor

@dmcilvaney dmcilvaney commented Jan 7, 2026

Allow the tools to directly validate rpm signatures during production image builds instead of relying on external validation. Set VALIDATE_IMAGE_GPG=y to enable.

Unlike the related VALIDATE_TOOLCHAIN_GPG option, it is not configured automatically since RPMs used in images may come from multiple sources and it is not feasible to automatically determine if they should all be signed (i.e. mix of official repos and locally built packages).

Merge Checklist

All boxes should be checked before merging the PR (just tick any boxes which don't apply to this PR)

  • The toolchain has been rebuilt successfully (or no changes were made to it)
  • The toolchain/worker package manifests are up-to-date
  • Any updated packages successfully build (or no packages were changed)
  • Packages depending on static components modified in this PR (Golang, *-static subpackages, etc.) have had their Release tag incremented.
  • Package tests (%check section) have been verified with RUN_CHECK=y for existing SPEC files, or added to new SPEC files
  • All package sources are available
  • cgmanifest files are up-to-date and sorted (./cgmanifest.json, ./toolkit/scripts/toolchain/cgmanifest.json, .github/workflows/cgmanifest.json)
  • LICENSE-MAP files are up-to-date (./LICENSES-AND-NOTICES/SPECS/data/licenses.json, ./LICENSES-AND-NOTICES/SPECS/LICENSES-MAP.md, ./LICENSES-AND-NOTICES/SPECS/LICENSE-EXCEPTIONS.PHOTON)
  • All source files have up-to-date hashes in the *.signatures.json files
  • sudo make go-tidy-all and sudo make go-test-coverage pass
  • Documentation has been updated to match any changes to the build system
  • Ready to merge

Summary

Adds optional GPG signature verification for RPM packages during image builds. When VALIDATE_IMAGE_GPG=y is set, all packages fetched for image generation are validated against the Microsoft GPG signing keys (or custom keys via IMAGE_GPG_VALIDATION_KEYS). This provides defense-in-depth for production builds by ensuring all packages have completed the signing process before being included in images.

Change Log
  • Add VALIDATE_IMAGE_GPG and IMAGE_GPG_VALIDATION_KEYS build variables
  • Add --enable-gpg-check and --gpg-keys flags to imagepkgfetcher tool
  • Add GPG signature validation functions to internal/rpm package (ImportGpgKeysToRpmDb, CheckRpmSignature, ValidateDirectoryRpmSignatures)
  • Add comments to installutils.go explaining that --nogpgcheck is safe because validation happens at fetch time
  • Add documentation for new variables and production build recommendations
Does this affect the toolchain?

NO

Associated issues
Test Methodology

@dmcilvaney dmcilvaney requested a review from a team as a code owner January 7, 2026 19:25
@microsoft-github-policy-service microsoft-github-policy-service bot added documentation Improvements or additions to documentation Tools 3.0 PRs Destined for 3.0 labels Jan 7, 2026
@dmcilvaney dmcilvaney changed the base branch from 3.0 to 3.0-dev January 7, 2026 19:28
@microsoft-github-policy-service microsoft-github-policy-service bot added the 3.0-dev PRs Destined for AzureLinux 3.0 label Jan 7, 2026
@dmcilvaney dmcilvaney requested a review from Copilot January 7, 2026 19:35
Allow the tools to directly validate rpm signatures during production image builds
instead of relying on external validation. Set VALIDATE_IMAGE_GPG=y to enable.

Unlike the related VALIDATE_TOOLCHAIN_GPG option, it is not configured automatically
since RPMs used in images may come from multiple sources and it is not feasible to
automatically determine if they should all be signed (i.e. mix of official repos and
locally built packages).

Signed-off-by: Daniel McIlvaney <damcilva@microsoft.com>
@dmcilvaney dmcilvaney force-pushed the image_gpg_validation branch from c364181 to 593b989 Compare January 7, 2026 19:38
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds optional GPG signature verification for RPM packages during image builds to provide defense-in-depth for production deployments. When VALIDATE_IMAGE_GPG=y is set, all packages fetched for image generation are validated against Microsoft GPG signing keys before being included in images.

Key changes:

  • Added VALIDATE_IMAGE_GPG and IMAGE_GPG_VALIDATION_KEYS build variables with corresponding CLI flags in imagepkgfetcher
  • Implemented GPG signature validation functions in the internal/rpm package (ImportGpgKeysToRpmDb, CheckRpmSignature, ValidateDirectoryRpmSignatures)
  • Added documentation explaining production build recommendations and clarifying that --nogpgcheck is safe during installation since validation occurs at fetch time

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
toolkit/tools/internal/rpm/rpm.go Adds three new functions for GPG signature validation: importing keys to RPM database, checking individual RPM signatures, and validating all RPMs in a directory
toolkit/tools/imagepkgfetcher/imagepkgfetcher.go Adds --enable-gpg-check and --gpg-keys flags, validates downloaded packages after cloning if GPG checking is enabled
toolkit/tools/imagegen/installutils/installutils.go Adds explanatory comments to clarify that --nogpgcheck is safe because validation happens during package fetching
toolkit/scripts/utils.mk Adds VALIDATE_IMAGE_GPG to the list of watched variables for dependency tracking
toolkit/scripts/imggen.mk Adds conditional logic to pass GPG validation flags to imagepkgfetcher when VALIDATE_IMAGE_GPG=y
toolkit/docs/security/production-builds.md New documentation file explaining production build workflow and GPG validation variables
toolkit/docs/security/intro.md Adds links to new production builds documentation
toolkit/docs/building/building.md Documents the new VALIDATE_IMAGE_GPG, IMAGE_GPG_VALIDATION_KEYS, VALIDATE_TOOLCHAIN_GPG, and TOOLCHAIN_GPG_VALIDATION_KEYS variables
toolkit/Makefile Defines VALIDATE_IMAGE_GPG and IMAGE_GPG_VALIDATION_KEYS variables with defaults, consolidates default GPG keys into shared variable

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dmcilvaney dmcilvaney force-pushed the image_gpg_validation branch from bef77fb to 4886492 Compare January 7, 2026 21:54
@dmcilvaney dmcilvaney merged commit e3c975d into microsoft:3.0-dev Jan 19, 2026
38 of 41 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.0-dev PRs Destined for AzureLinux 3.0 3.0 PRs Destined for 3.0 documentation Improvements or additions to documentation Tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants