Skip to content

imagetools: validate descriptor input for create -f#3933

Open
amarkdotdev wants to merge 1 commit into
docker:masterfrom
amarkdotdev:fix/imagetools-create-descriptor-validation
Open

imagetools: validate descriptor input for create -f#3933
amarkdotdev wants to merge 1 commit into
docker:masterfrom
amarkdotdev:fix/imagetools-create-descriptor-validation

Conversation

@amarkdotdev

Copy link
Copy Markdown

Summary

  • Validate JSON passed to imagetools create -f is an OCI content descriptor, not a manifest or index.
  • Reject descriptors with missing or invalid digests before push, returning a clear error instead of panicking.

Fixes #2091

Test plan

  • go test ./commands/imagetools/ -run TestParseSourceDescriptorValidation
  • docker buildx imagetools inspect --raw alpine | docker buildx imagetools create -f /dev/stdin -t example/test returns a descriptive error (no panic)
  • Valid descriptor JSON with digest, mediaType, and size still works

Return a clear error when -f contains a manifest or index instead of an OCI
content descriptor, and reject descriptors missing a valid digest. Avoids
a nil-pointer panic when piping inspect --raw output into imagetools create.

Fixes docker#2091
@amarkdotdev

Copy link
Copy Markdown
Author

@jsternberg @jedevc friendly review request — targets the descriptor validation discussed on #2091 (clear error for manifest/index JSON piped from inspect --raw, plus digest checks). Unit tests included.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

panic in buildx imagetools create

1 participant