buildx icon indicating copy to clipboard operation
buildx copied to clipboard

Annotation to turn off false positive SecretsUsedInArgOrEnv

Open jonapich opened this issue 9 months ago • 6 comments

Description

I am getting a SecretsUsedInArgOrEnv warning on non-sensitive data.

The variables are named instance_types_file_key and static_variables_file_key. Since this is a refactor I can't rename them just like that and will have to live with the warning.

It would be great if there was a way to annotate the line to acknowledge the false positive. For instance, some linters let you use # noqa at the minimum to disable these warnings, while some others are more specific e.g. # noqa: ignore[index-error]

jonapich avatar Mar 11 '25 14:03 jonapich

It would be great if there was a way to annotate the line to acknowledge the false positive. For instance, some linters let you use # noqa at the minimum to disable these warnings, while some others are more specific e.g. # noqa: ignore[index-error]

@colinhemmings Recall we discussed about it internally with smth like a nolint directive similar to https://golangci-lint.run/usage/false-positives/#nolint-directive

crazy-max avatar Mar 11 '25 15:03 crazy-max

You can set #check=skip=SecretsUsedInArgOrEnv on top of Dockerfile

tonistiigi avatar Mar 11 '25 16:03 tonistiigi

Or like shellcheck behavior.

A comment on top of a file disable the rule globally, whereas above a line of code it only ignores the LoC.

  • https://github.com/koalaman/shellcheck/wiki/Ignore

ggjulio avatar Mar 17 '25 14:03 ggjulio

Right now it's just noise because we don't enforce clean checks, but eventually, CI should fail when these come up. Being able to ignore a specific check at the line level is important to retain the ability of flagging new contributions (vs ignoring the whole file, which would silence the warning on the new contribution).

jonapich avatar Mar 17 '25 15:03 jonapich

Is there a way to suppress the warning for a specific ENV or ARG variable if it's a false positive? If not, is there any existing solution or a feature planned to address this?

KK-Repos avatar Mar 18 '25 12:03 KK-Repos

Of all the checks, I think this is the only one I completely disagree with. I understand its good intentions, but 99% of cases will be false-positives. All of our variables that start with SECRET_ actually point to a file path that is expected to be mounted at runtime.

ChristianCiach avatar Aug 06 '25 12:08 ChristianCiach