Secure Build

May 10, 2026 ยท View on GitHub

This document describes secure build practices for Hex registry infrastructure.

Artifact Provenance

Docker Images

PropertyImplementation
Image digestSHA256 of image manifest
Push by digestEnsures immutability
Multi-platform manifestsConsistent across architectures
Git commit linkingImage tagged with short SHA

Image Tagging

Tag FormatExamplePurpose
Short SHAabc1234Identifies specific commit
Registrygcr.io/hexpm-prod/hexpmGCP Container Registry

Package Releases

PropertyImplementation
ChecksumsSHA-256 in signed registry
ImmutabilityCannot modify after grace period
Registry signingRSA-PKCS1-SHA512 signatures

Dependencies

Automated Updates

Most Hex projects use GitHub Dependabot for automated dependency updates:

RepositoryDependabotEcosystems
hexpm/hexpmYesgithub-actions, mix
hexpm/hexYesgithub-actions, mix
hexpm/hex_coreYesgithub-actions, rebar
hexpm/hex_solverYesgithub-actions, mix
hexpm/hexdocsYesgithub-actions, mix
hexpm/previewYesgithub-actions, mix
hexpm/diffYesgithub-actions, mix
hexpm/specificationsYesgithub-actions
hexpm/bobNo-
hexpm/hexdocs-searchNo-

Dependency Constraints

Some projects have restrictions on external dependencies:

ProjectConstraintReason
hexNo external depsBootstrapped before package manager available
hex_coreNo external depsDesigned to be vendored by clients

These projects must only use OTP standard library functions or vendor library code.

Dependency Selection

CriterionConsideration
Maintenance statusActive development and releases
Security track recordHistory of vulnerabilities and response
Community adoptionUsage and community support
License compatibilityApache 2.0 / MIT preferred

Minimization Principles

PrincipleImplementation
Prefer standard libraryUse OTP/Elixir stdlib when sufficient
Avoid unnecessary depsEach dependency adds attack surface
Evaluate transitivesConsider full dependency tree

Toolchain

CI Pipeline

CheckDescription
FormattingCode formatting enforced in CI
Unit testsAutomated tests run on every PR
CodeQLSecurity scanning for GitHub Actions workflows
ZizmorGitHub Actions security best practices

Authentication (CI)

Application repositories (hexpm/hexpm, hexpm/hex, hexpm/preview, hexpm/diff, hexpm/hexdocs) authenticate to GCP using Workload Identity Federation:

StageMethod
GCP authenticationWorkload Identity Federation (OIDC)
Container RegistryShort-lived OAuth2 access token from OIDC
Image build / pushNo long-lived service account keys in repo secrets

The infrastructure repository (hexpm/hexpm-ops) authenticates to GCP using a long-lived service account key stored as a GitHub Actions secret, scoped per environment.