Skip to content

fix: secure PostgreSQL APT key installation in dockerfile#22391

Merged
erikburt merged 2 commits into
developfrom
fix/dockerfile-pgsql-gpg
May 12, 2026
Merged

fix: secure PostgreSQL APT key installation in dockerfile#22391
erikburt merged 2 commits into
developfrom
fix/dockerfile-pgsql-gpg

Conversation

@erikburt
Copy link
Copy Markdown
Collaborator

@erikburt erikburt commented May 11, 2026

  • Switches off of apt-key add as that is deprecated, and less secure
  • Uses a per-repo keyring, and verifies the GPG key

Testing

Builds are successful: https://github.com/smartcontractkit/chainlink/actions/runs/25699217695?pr=22391

Notes

Sonarqube is complaining with:

RUN curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc
^
Not enforcing HTTPS here might allow for redirections to insecure websites. Make sure it is safe here.

This is not that relevant as we are validating the fetched key with a known/static fingerprint baked into our Dockerfile. This means that we technically don't care if it ends up redirecting to http, because the key is still verified.


DX-4135

@erikburt erikburt self-assigned this May 11, 2026
@erikburt erikburt added the build-publish Build and Publish image to SDLC label May 11, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 11, 2026

✅ No conflicts with other open PRs targeting develop

@erikburt erikburt changed the title fix: secure PostgreSQL APT key installation in dockefile fix: secure PostgreSQL APT key installation in dockerfile May 11, 2026
@trunk-io
Copy link
Copy Markdown

trunk-io Bot commented May 11, 2026

Static BadgeStatic BadgeStatic BadgeStatic Badge

View Full Report ↗︎Docs

@cl-sonarqube-production
Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
2 Security Hotspots

See analysis details on SonarQube

@erikburt erikburt marked this pull request as ready for review May 12, 2026 16:49
@erikburt erikburt requested a review from a team as a code owner May 12, 2026 16:49
Copilot AI review requested due to automatic review settings May 12, 2026 16:49
@erikburt erikburt requested review from a team as code owners May 12, 2026 16:49
Copy link
Copy Markdown
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

Risk Rating: MEDIUM — Changes affect how production/testing Docker images add and trust an external APT repository (PostgreSQL), which can impact build reliability and supply-chain trust.

This PR updates the Chainlink Docker build to install the PostgreSQL APT signing key without apt-key, using a dedicated keyring and a fingerprint check to improve security.

Changes:

  • Replace deprecated apt-key add usage with a per-repo keyring under /usr/share/keyrings.
  • Add a GPG fingerprint check for the PostgreSQL repository key.
  • Switch the PGDG APT source URL from http to https and use signed-by in the source entry.

Scrupulous human review recommended (security-sensitive):

  • The key download + dearmor + fingerprint validation pipeline, to ensure it strictly enforces the intended trust model (only the expected key(s) are trusted).
  • The resulting keyring permissions/format and the signed-by wiring, to ensure apt-get update works reliably in CI/build environments.

Reviewed changes

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

File Description
core/chainlink.Dockerfile Reworks PGDG key installation to use a dedicated keyring + fingerprint validation and signed-by.
plugins/chainlink.Dockerfile Mirrors the same PGDG keyring + fingerprint + signed-by approach for the plugins image.

Comment thread core/chainlink.Dockerfile
Comment thread plugins/chainlink.Dockerfile
@erikburt erikburt added this pull request to the merge queue May 12, 2026
Merged via the queue into develop with commit 96fc5c0 May 12, 2026
243 of 244 checks passed
@erikburt erikburt deleted the fix/dockerfile-pgsql-gpg branch May 12, 2026 20:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

build-publish Build and Publish image to SDLC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants