Repository navigation
ci: authenticate Docker Hub with OIDC (SEC-4519) - #1417
Open
nachorpaez wants to merge 2 commits into
Open
nachorpaez wants to merge 2 commits into
nachorpaez wants to merge 2 commits into
Conversation
Use the configured Docker OIDC connection instead of static Docker credentials, preserving release 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>
Update the shared Go setup action to its upstream full-SHA pinning fix. Amp-Thread-ID: https://ampcode.com/threads/T-01a2180e-b11b-76a6-b0cd-520034d574a0 Co-authored-by: Amp <amp@ampcode.com>
nachorpaez
marked this pull request as ready for review
November 26, 2026 15:55
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.
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
goreleaser.ymland authenticate before the dependency-image publisher indocker.yml. Both use Docker organizationsourcegraphand connection9f14c248-6ae5-4c2a-ad0c-3af4ca55a16ewithout a password input.docker/login-actionsteps to8aa5831fb8d48d8f76594c7ddde61ae58019f550(v4.8.0); grantcontents: readandid-token: writeonly to the two Docker-publishing jobs. GoReleaser keeps its existing cross-repository PAT for GitHub/Homebrew publishing.docker/batch-change-volume-workspace/push.py. It now reuses Docker's existing authentication, whether provided by the OIDC action or bydocker loginlocally. The script no longer readsDOCKER_USERNAMEorDOCKER_PASSWORD.sourcegraph/actions/go-setupcallers (scip.ymlandgoreleaser.yml) to the upstream pinning fix. Its only change is pinning the nestedactions/setup-go@v5to a full SHA, fixing the organization's full-SHA-policy rejection without weakening that policy.OIDC refs and required Docker rule
Compatibility rule for the existing unprefixed release tags, with Image Push to only
sourcegraph/src-cliandsourcegraph/src-batch-change-volume-workspace:8.2.0, can authenticate; this is deliberately notv*because src-cli versions are unprefixed.docker.ymlexclusion of thelatesttag remains unchanged. The Docker wildcard itself does not enforce that exclusion or semantic-version syntax.GitHub currently reports legacy default subjects. The deployed Docker rules have not been inspected; confirm the subject and resource scopes before merging. Release tags must include these workflow changes to use OIDC; old tagged workflows still reference static credentials. Keep shared credentials until every consumer has migrated and been validated.
Test plan
push.pyinvocation.push.pythrough its CLI with a stub Docker executable and no static credential variables: the original fails withKeyError; the updated script succeeds using the inherited Docker configuration. Verified exactlatest,8,8.2,8.2.17tags, all three architecture arguments and Dockerfile stdin; explicit branch refs still produce onlylatest, and failed Docker builds still fail the script. This was local validation, not a real registry exchange or image push.git diff --checkpassed.actionlintv1.7.12 passed onscip.ymlandgoreleaser.yml, including the updated pins. Fordocker.yml, both base and changed versions report the same existing unknownubuntu-26.04runner label, with no new diagnostics. External shellcheck/pyflakes integrations were disabled. The runner label is intentionally unchanged.How the script receives Docker authentication
The login action exchanges GitHub OIDC for a short-lived Docker token, then invokes
docker login --password-stdin. Docker stores it in the runner user's Docker configuration (normally$HOME/.docker/config.json, or the configured credential helper /$DOCKER_CONFIGlocation). The subsequent Python step runs on the same job and invokesdocker buildx build --pushwithout overriding its environment or configuration. Buildx reads Docker's credentials and supplies registry authentication to BuildKit; Python never needs the token itself. The login action's logout runs in post-job cleanup, after the script finishes.Verified against the pinned login action, Docker credential-storage documentation, and Buildx auth-provider wiring. The local stub test checks script behavior, not Docker Hub's deployed trust policy.
Investigation and ruleset rationale · GitHub Docker OIDC guide