Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

podman save: enforce signature removal #11714

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion pkg/api/handlers/libpod/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ func ExportImages(w http.ResponseWriter, r *http.Request) {
MultiImageArchive: len(query.References) > 1,
OciAcceptUncompressedLayers: query.OciAcceptUncompressedLayers,
Output: output,
RemoveSignatures: true,
}

imageEngine := abi.ImageEngine{Libpod: runtime}
Expand Down
2 changes: 0 additions & 2 deletions pkg/domain/entities/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,6 @@ type ImageSaveOptions struct {
OciAcceptUncompressedLayers bool
// Output - write image to the specified path.
Output string
// Do not save the signature from the source image
RemoveSignatures bool
Copy link
Collaborator

Choose a reason for hiding this comment

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

If this is the HTTP API, is it OK to change it like this? I guess unrecognized fields don’t cause failures?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for checking. It's an internal (non-REST) API. The REST handlers always set it to true.

Copy link
Collaborator

@mtrmac mtrmac Sep 23, 2021

Choose a reason for hiding this comment

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

My mistake, I should write down how things work one of these days. It’s pkg/domain/infra/tunnel.ImageEngine.Save(entities.ImageSaveOptions)pkg/bindings/images.Export(pkg/bindings/images.ExportOptions)pkg/api/handlers/libpod.ExportImagespkg/domain/infra/abi.ImageEngine.Save(entities.ImageSaveOptions), right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that is the exact flow.

// Quiet - suppress output when copying images
Quiet bool
}
Expand Down
5 changes: 4 additions & 1 deletion pkg/domain/infra/abi/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,10 @@ func (ir *ImageEngine) Save(ctx context.Context, nameOrID string, tags []string,
saveOptions := &libimage.SaveOptions{}
saveOptions.DirForceCompress = options.Compress
saveOptions.OciAcceptUncompressedLayers = options.OciAcceptUncompressedLayers
saveOptions.RemoveSignatures = options.RemoveSignatures

// Force signature removal to preserve backwards compat.
// See https://github.com/containers/podman/pull/11669#issuecomment-925250264
saveOptions.RemoveSignatures = true

if !options.Quiet {
saveOptions.Writer = os.Stderr
Expand Down