Skip to content

fix(query): the "Image Version Using Latest" dockerfile query was not accounting for specific digest values#8033

Open
cx-andre-pereira wants to merge 5 commits intoCheckmarx:masterfrom
cx-andre-pereira:AST-145728--FP_Dockerfile_latest_tag
Open

fix(query): the "Image Version Using Latest" dockerfile query was not accounting for specific digest values#8033
cx-andre-pereira wants to merge 5 commits intoCheckmarx:masterfrom
cx-andre-pereira:AST-145728--FP_Dockerfile_latest_tag

Conversation

@cx-andre-pereira
Copy link
Copy Markdown
Contributor

@cx-andre-pereira cx-andre-pereira commented Apr 9, 2026

Reason for Proposed Changes

  • Currently the "Image Version Using Latest" query does not account for digest values appended to the ":latest" tag; causing a FROM statement like : FROM 923847651029.dkr.ecr.eu-west-1.amazonaws.com/echo/echo-fips:latest@sha256:a1f3c2e9b0d74682f5a3c1e8b2d09f47c6e1a3b8d2f04c7e9a1b3d5f7c2e4a6b8
    to produces a False Positive result.

Proposed Changes

  • Made a small adjustment to the query to ensure the target ":latest" tag is the suffix of the reference image being used through a regex enforcing end of line ($) after any trailing whitespaces that may exist.
  • Added a new sample in the negative.dockerfile test.

I submit this contribution under the Apache-2.0 license.

@cx-andre-pereira cx-andre-pereira marked this pull request as ready for review April 9, 2026 10:58
@cx-andre-pereira cx-andre-pereira requested a review from a team as a code owner April 9, 2026 10:58
Copy link
Copy Markdown
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey André, can you take a look at my comment please?

Comment thread assets/queries/dockerfile/image_version_using_latest/query.rego Outdated
Copy link
Copy Markdown
Contributor

@cx-artur-ribeiro cx-artur-ribeiro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants