Skip to content

Reject image tags that are neither mapped nor valid image hashes before building the manifest path - #8983

Open
rzo1 wants to merge 1 commit into
masterfrom
fix/oci-image-tag-manifest-lookup
Open

Reject image tags that are neither mapped nor valid image hashes before building the manifest path#8983
rzo1 wants to merge 1 commit into
masterfrom
fix/oci-image-tag-manifest-lookup

Conversation

@rzo1

@rzo1 rzo1 commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

getHashFromImageTag returned the raw image tag when it was absent from both the local and HDFS tag-to-hash caches, and that value was concatenated into the manifest path without being held to the 64-character alphanumeric rule that mapped entries must satisfy.

Adds an isValidHash check on the fallback and before the manifest path is built, and reuses it for the existing parse-time check. Adds the first test class for this module, along with its test dependencies.

@rzo1 rzo1 added this to the 3.1.0 milestone Aug 19, 2026
@rzo1 rzo1 self-assigned this Aug 19, 2026
return hash;
} else {
if (!isValidHash(imageTag)) {
throw new IllegalArgumentException("Image tag " + imageTag

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

minor: should we throw an IOException here to be coherent with the validation in getManifestFromImageTag?

@reiabreu

Copy link
Copy Markdown
Contributor

great job!

@Override
public synchronized ImageManifest getManifestFromImageTag(String imageTag) throws IOException {
String hash = getHashFromImageTag(imageTag);
if (!isValidHash(hash)) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

another minor one caught by LLM: hdfsImageToHash and localImageToHashCache are built from readImageToHashFile, which already does this validation. It's not necessarily wrong to have this here, since it's defensive in case readImageToHashFile changes

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