Skip to content
This repository was archived by the owner on Jul 1, 2026. It is now read-only.

fix: stop baking GH_TOKEN into config-svc-be image (PAT leak) - #204

Merged
Sandy-at-Tazama merged 1 commit into
devfrom
fix/secret-mount-pat-leak
Jun 29, 2026
Merged

fix: stop baking GH_TOKEN into config-svc-be image (PAT leak)#204
Sandy-at-Tazama merged 1 commit into
devfrom
fix/secret-mount-pat-leak

Conversation

@Justus-at-Tazama

Copy link
Copy Markdown
Contributor

Problem

packages/config-svc-be/Dockerfile.be received the @tazama-lf registry PAT via a build-args: GH_TOKEN=... argument, wrote it into .npmrc, and never deleted it. The credential was baked into a published image layer, so anyone pulling tazamaorg/config-svc-be could extract the token. This was the source of one of the leaked ghp_ tokens flagged on public DockerHub.

Fix

  • Dockerfile.be: add # syntax=docker/dockerfile:1, drop ARG GH_TOKEN, and mount the token via BuildKit --mount=type=secret,id=GH_TOKEN,env=GH_TOKEN on every npm install. The .npmrc now references ${GH_TOKEN} from the environment at install time only - nothing is persisted.
  • dockerhub-image-build.yml / dockerhub-image-build-rc.yml: pass the token through secrets: instead of build-args: for the be image build.

FE images are unaffected - they never needed a token.

Notes

  • The previously leaked tokens have already been revoked and the bad image tags deleted.
  • This brings config-svc-be in line with the secret-mount pattern already used by tazama-demo, lumberjack and event-sidecar.

Dockerfile.be wrote the PAT into .npmrc via build-arg and never removed
it, baking the credential into a published layer. Switch to BuildKit
secret mounts so the token is available only during npm install and is
never persisted. Update the be image build steps in both workflows to
pass the token via `secrets:` instead of `build-args:`.

Signed-off-by: Justus-at-Tazama <jortlepp@contractor.linuxfoundation.org>
@Justus-at-Tazama
Justus-at-Tazama requested review from a team as code owners June 29, 2026 10:54
@github-actions github-actions Bot added the bug Something isn't working label Jun 29, 2026
@Sandy-at-Tazama
Sandy-at-Tazama merged commit b49c1ae into dev Jun 29, 2026
4 checks passed
@Justus-at-Tazama
Justus-at-Tazama deleted the fix/secret-mount-pat-leak branch June 29, 2026 11:04
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants