Skip to content

ci: authenticate Docker Hub with OIDC (SEC-4519) - #253

Merged
nachorpaez merged 2 commits into
scipfrom
sec-4519-docker-oidc
Nov 27, 2026
Merged

nachorpaez merged 2 commits into
scipfrom
sec-4519-docker-oidc

Conversation

@nachorpaez

@nachorpaez nachorpaez commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Part of SEC-4519: Configure OIDC in GitHub Actions that log in to Docker. Replace reusable Docker credentials, which can be abused if leaked, with short-lived OIDC authentication.

Changes

  • Use Docker organization sourcegraph and connection 7937e496-9edf-4170-9bc8-9ff38a3954fe, with no password input.
  • Scope Buildx credentials to sourcegraph/scip-python, preserving default authentication for the public nikolaik/python-nodejs base image. This prevents the restricted OIDC token from being used for unrelated Docker Hub pulls, as observed in scip-clang's first OIDC run. No dependencies changed: the latest publishing run used Buildx v0.38.0 (scope requires >=0.31.0).
  • Keep docker/login-action pinned to 8aa5831fb8d48d8f76594c7ddde61ae58019f550 (v4.8.0).
  • Reuse the job's existing contents: read / id-token: write permissions. npm trusted publishing is unchanged.
  • Preserve triggers, npm packaging/publishing, Docker build steps and image tags. No GitHub subject-format changes, Docker trust-policy edits, or secret deletions; in particular, no immutable-subject migration that could affect npm compatibility.

OIDC refs and required Docker rule

Expected rule for Image Push to only sourcegraph/scip-python:

repo:sourcegraph/scip-python:ref:refs/tags/v*
  • v release tags* can authenticate, matching the existing publishing trigger.
  • No branch receives a Docker publishing grant, including the default branch scip or main. The separate non-publishing Docker build workflow is unchanged and does not need this connection.

The connection ID is non-secret configuration. Its deployed rules have not been inspected; confirm the rule and resource scope before merging. All five migrated repositories still report legacy default subjects.

Test plan

  • actionlint v1.7.12 passed on this workflow (external shellcheck/pyflakes integrations disabled; scripts are unchanged).
  • Parsed-YAML comparison against the base confirms only Docker login configuration changed; permissions, npm publishing, triggers, conditions, commands and image tags are identical.
  • Verified v4.8.0 resolves to the pinned SHA and supports connection-based OIDC with no password input.
  • git diff --check passed.
  • No live token exchange, npm publication or image publication was performed. PR CI does not prove Docker trust; validate authentication on an authorized release after approval.

Investigation and ruleset rationale · GitHub Docker OIDC guide

Replace static Docker credentials with the configured OIDC connection while preserving workflow triggers and publishing behavior.

Linear: https://linear.app/sourcegraph/issue/SEC-4519/configure-oidc-in-github-actions-that-log-in-to-docker

Amp-Thread-ID: https://ampcode.com/threads/T-01a2180e-b11b-76a6-b0cd-520034d574a0
Co-authored-by: Amp <amp@ampcode.com>
@nachorpaez
nachorpaez requested a review from a team November 26, 2026 15:07
Preserve default credentials for public Docker Hub base-image pulls.

SEC-4519
Amp-Thread-ID: https://ampcode.com/threads/T-01a2180e-b11b-76a6-b0cd-520034d574a0
Co-authored-by: Amp <amp@ampcode.com>
@nachorpaez
nachorpaez merged commit 56159a1 into scip Nov 27, 2026
5 checks passed
@nachorpaez
nachorpaez deleted the sec-4519-docker-oidc branch November 27, 2026 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant