fix(dockerfile): support custom-prefix Dockerfile names like AdtDockerfile#7557
Open
AlexanderSanin wants to merge 1 commit into
Open
fix(dockerfile): support custom-prefix Dockerfile names like AdtDockerfile#7557AlexanderSanin wants to merge 1 commit into
AlexanderSanin wants to merge 1 commit into
Conversation
…rfile The DOCKERFILE_MASK regex only matched files where "Dockerfile" appeared at the start or after a dot separator (e.g. Dockerfile, dev.Dockerfile). Files that use a CamelCase or word prefix without a dot separator, such as AdtDockerfile or MyServiceDockerfile, were silently skipped, leaving those images unscanned. The regex is updated to also match when a non-dot prefix precedes an uppercase-D "Dockerfile". Lowercase-only prefixes (e.g. ddockerfile) remain invalid to avoid ambiguity. All existing valid/invalid test cases continue to pass. Closes bridgecrewio#7541 Signed-off-by: Oleksandr Sanin <alexaaander.sanin@gmail.com>
Contributor
Author
|
Hey @yuvalmich @talazuri @omriyoffe-panw. Could you, please, have a look at this? |
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
DOCKERFILE_MASKincheckov/common/util/dockerfile.pyonly matchedDockerfile/dockerfileat the start of the filename or after a dot separator (e.g.dev.Dockerfile).AdtDockerfileorMyServiceDockerfile— were silently skipped, leaving those images unscanned.D, soAdtDockerfileand similar variants are now recognised.ddockerfile) remain invalid to avoid ambiguity, preserving all existing test expectations.Closes #7541
Test plan
is_dockerfile():Dockerfile,dockerfile,Dockerfile.prod,dev.Dockerfile,team1.product.dockerfile, etc..dockerfile,ddockerfile,docker-file,dockerfile1,Dockerfile.env.dockerignore, etc.AdtDockerfile,MyServiceDockerfile,AdtDockerfile.prodpytest tests/dockerfile/test_utils.py::test_is_dockerfile