Skip to content

PolicyContext: add new RequireSignatureVerification method#355

Merged
mtrmac merged 1 commit into
podman-container-tools:mainfrom
jlebon:pr/policy-eval
Nov 20, 2025
Merged

PolicyContext: add new RequireSignatureVerification method#355
mtrmac merged 1 commit into
podman-container-tools:mainfrom
jlebon:pr/policy-eval

Conversation

@jlebon

@jlebon jlebon commented Sep 24, 2025

Copy link
Copy Markdown
Contributor

In bootc, we want the ability to assert that signature verification is
enforced, but there are no mechanisms for this in the library.

Add a new RequireSignatureVerification method on the PolicyContext
object which would allow this.

Add a new isSigned method on the PolicyRequirement interface
which then allows IsRunningImageAllowed to detect if at least one
requirement performed signature verification.

Test generation was Assisted-by: Claude Code v1.0.120.

Part of podman-container-tools/skopeo#1829.

@github-actions github-actions Bot added the image Related to "image" package label Sep 24, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Sep 24, 2025
@jlebon

jlebon commented Sep 24, 2025

Copy link
Copy Markdown
Contributor Author

rather than extending the policy requirement interface

I initially went that way so have code for this as well if we want to compare.

Keeping it in draft for now until there's agreement on the approach.

@mtrmac mtrmac left a comment

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.

Thanks!

Just a very quick drive-by, looking at the implementation. The much more important part is designing the semantics of the new option, and I don’t have an opinion on that yet.

Comment thread image/signature/policy_eval.go
@cgwalters

Copy link
Copy Markdown
Contributor

Thanks for starting this! I think in the general case what we also want here is something like podman pull --require-signature or so.

@jlebon

jlebon commented Sep 26, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for starting this! I think in the general case what we also want here is something like podman pull --require-signature or so.

I did briefly look at that. Worth noting that e.g. skopeo today has an --insecure-policy but podman does not. Not sure if that was on purpose or an oversight. But yeah, I would agree.

@mtrmac

mtrmac commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

There’s a degree of implementation difficulty for Podman: Skopeo has the policy configuration centralized, as a top-level option; AFAIK Podman does not, really. So, an option would have to be added to each subcommand individually, or the policy setup would need to be fairly significantly refactored.

(Complicating this even more, for Podman, is the “remote” mode where the CLI is an API client to a server on a different VM / machine. Even if we did centralize the CLI handling, we would still need to add the “reject insecure” field (and the pre-existing “signature policy path”) to every single API operation individually. That’s one of the reasons the podman pull --signature-policy flag is entirely unavailable in remote mode — I suppose it would be viable to do the same here, and just not implement the feature for remote.)

@mtrmac mtrmac added the enhancement New feature or request label Oct 3, 2025
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Oct 5, 2025
@podmanbot

Copy link
Copy Markdown

✅ A new PR has been created in buildah to vendor these changes: podman-container-tools/buildah#6409

Comment thread image/signature/policy_eval_baselayer.go
Comment thread image/signature/policy_eval.go
@jlebon jlebon marked this pull request as ready for review October 6, 2025 15:22

@aguidirh aguidirh left a comment

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.

LGTM, I left only a nit.

Comment thread image/signature/policy_eval.go

@mtrmac mtrmac left a comment

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.

A full review now.

Comment thread image/signature/policy_eval.go Outdated
Comment thread image/signature/policy_eval.go Outdated
Comment thread image/signature/policy_eval.go Outdated
Comment thread image/signature/policy_eval.go Outdated
Comment thread image/signature/policy_eval_test.go Outdated
podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Nov 14, 2025
@podmanbot

Copy link
Copy Markdown

✅ A new PR has been created in buildah to vendor these changes: podman-container-tools/buildah#6504

@jlebon

jlebon commented Nov 14, 2025

Copy link
Copy Markdown
Contributor Author

Thanks for the feedback!

I changed tactics and flipped this around. I.e. rather than forbidding insecure policy requirements (which is/may become ambiguous), the new knob now requires signature verification policy requirements (and I tried to define it clearly in the docstrings to imply the signature must cover the entire contents).

I also rebased. (Sorry, I should've done it in two separate pushes to make it easier to see the real changes.)

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Nov 14, 2025
@jlebon jlebon changed the title PolicyContext: add new SetRejectInsecure method PolicyContext: add new RequireSignatureVerification method Nov 14, 2025

@mtrmac mtrmac left a comment

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.

I’ll re-read this more carefully next week, but looks great from a quick skim.

@mtrmac mtrmac left a comment

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.

One last thing:

Just to hold the line on “c/image/signature, at the very least in the policy enforcement code, should have code coverage whenever reasonably possible”, please add a bunch of one-line TestPR…VerifiesSignatures tests.

Comment thread image/signature/policy_eval_test.go Outdated
In bootc, we want the ability to assert that signature verification is
enforced, but there are no mechanisms for this in the library.

Add a new `RequireSignatureVerification` method on the `PolicyContext`
object which would allow this.

Add a new `isSigned` method on the `PolicyRequirement` interface
which then allows `IsRunningImageAllowed` to detect if at least one
requirement performed signature verification.

Test generation was `Assisted-by: Claude Code v1.0.120`.

Part of podman-container-tools/skopeo#1829.

Signed-off-by: Jonathan Lebon <jonathan@jlebon.com>
@jlebon

jlebon commented Nov 20, 2025

Copy link
Copy Markdown
Contributor Author

Updated!

podmanbot pushed a commit to podmanbot/buildah that referenced this pull request Nov 20, 2025

@mtrmac mtrmac left a comment

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.

Thanks!

@mtrmac mtrmac merged commit 2371269 into podman-container-tools:main Nov 20, 2025
25 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request image Related to "image" package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants