fix(security): replace APPS_JSON_BASE64 build-arg with BuildKit secret#1861
Open
OmarElaraby26 wants to merge 2 commits intofrappe:mainfrom
Open
fix(security): replace APPS_JSON_BASE64 build-arg with BuildKit secret#1861OmarElaraby26 wants to merge 2 commits intofrappe:mainfrom
OmarElaraby26 wants to merge 2 commits intofrappe:mainfrom
Conversation
…t mount APPS_JSON_BASE64 is stored in image layer metadata, permanently exposing private repo tokens (GitHub PATs) to anyone with image pull access. Replace --build-arg with --mount=type=secret so that apps.json is only available during the RUN step and never committed to any layer. Refs: https://docs.docker.com/reference/build-checks/secrets-used-in-arg-or-env/
Collaborator
|
Instead of setting |
BuildKit has been the default builder since Docker Engine 23.0 (Feb 2023), so prefixing the example build commands with DOCKER_BUILDKIT=1 is redundant on any supported install. Replace the prefix with an explicit prerequisite note so the requirement lives with the user's environment, not the example. The build relies on BuildKit secret mounts (--secret) to keep apps.json tokens out of image layers, which is why a real BuildKit-default engine is mandatory rather than merely recommended. Addresses review feedback on PR frappe#1861.
Author
|
@DanielRadlAMR Thanks for the suggestion, agreed, and applied in the latest commit |
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.
Summary
ARG APPS_JSON_BASE64/--build-argwith BuildKit--mount=type=secretin bothcustomandlayeredContainerfiles02-build-setup.md,08-single-server-nginxproxy-example.md) to use--secretinstead of--build-argDetails
When building custom images with private apps,
apps.json(which may contain GitHub PATs in repository URLs) is currently passed as--build-arg=APPS_JSON_BASE64. Docker buildarguments are permanently stored in image layer metadata and visible to anyone with image access via
docker image history --no-trunc. This means private repo tokens aretrivially extractable from any built image.
This is a known Docker anti-pattern: SecretsUsedInArgOrEnv.
The fix uses BuildKit secret mounts (
--mount=type=secret), which makesapps.jsonavailable only during the RUN step — it is never committed to any layer. The change isbackward compatible: when no secret is provided, the build proceeds without
apps.json(same as before whenAPPS_JSON_BASE64was empty).Fixes #1860
Test plan
customimage with--secret=id=apps_json,src=apps.jsoncontaining private repos — build succeededdocker image history --no-truncshows no tokens in any layerapps.json)