moby / moby/buildkit

Dockerfile should check for `ARG`s or `ENV`s that ends with `_PSW`

Open
#6,064 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area/dockerfile area/dockerfile/checks
Dominant language
Go
Stars
10.3k
Forks
1.5k
Avg merge
1d 23h
Merged PRs (30d)
48

Description

Description

The following triggers the check:

FROM ubuntu

ARG CREDENTIALS="pass"
RUN echo "${CREDENTIALS}"

Sensitive data should not be used in the ARG or ENV commands (Do not use ARG or ENV instructions for sensitive data (ARG "CREDENTIALS"))
https://docs.docker.com/go/dockerfile/rule/secrets-used-in-arg-or-env/

But the following does not:

FROM ubuntu

ARG SOME_PSW="pass"
RUN echo "${SOME_PSW}"

I believe all ARGs or ENVs that ends with _PSW should trigger this rule because this is how credentials are injected in Jenkins by default.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the implementation and tests for the Dockerfile secrets-used-in-arg-or-env rule, then trace how ARG and ENV names are checked. Reproduce the examples from the issue, including SOME_PSW, and update the behavior so the reported _PSW case is detected. Done means the new case is covered by a passing test.

Written by the indexing model from the issue text.

Assessment

Tech stack
dockerfile, go
Domain
build-system, security
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.