Skip to content

trust: switch policy.json lookup to configfile#28508

Merged
Luap99 merged 3 commits intocontainers:mainfrom
jankaluza:configfile
Apr 21, 2026
Merged

trust: switch policy.json lookup to configfile#28508
Luap99 merged 3 commits intocontainers:mainfrom
jankaluza:configfile

Conversation

@jankaluza
Copy link
Copy Markdown
Member

@jankaluza jankaluza commented Apr 14, 2026

Use shared configfile instead of custom policy.json path handling. This switches ocipull to signature.DefaultPolicy(), removes SignaturePolicyPath plumbing, and updates podman image trust to use --signature-policy.

Checklist

Ensure you have completed the following checklist for your pull request to be reviewed:

  • Certify you wrote the patch or otherwise have the right to pass it on as an open-source patch by signing all
    commits. (git commit -s). (If needed, use git commit -s --amend). The author email must match
    the sign-off email address. See CONTRIBUTING.md
    for more information.
  • Referenced issues using Fixes: #00000 in commit message (if applicable)
  • Tests have been added/updated (or no tests are needed)
  • Documentation has been updated (or no documentation changes are needed)
  • All commits pass make validatepr (format/lint checks)
  • Release note entered in the section below (or None if no user-facing changes)

Does this PR introduce a user-facing change?

Podman now uses shared configfile logic for policy.json resolution and introduces `--signature-policy` for podman image trust. This new option is required for `podman image trust set`.

@github-actions github-actions Bot added machine kind/api-change Change to remote API; merits scrutiny labels Apr 14, 2026
@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

3 similar comments
@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

some smaller comments, overall this seems mostly fine.

Longer term we really need to de duplicate this logic out of podman IMO

Comment thread pkg/domain/infra/abi/trust.go Outdated
Comment thread pkg/domain/infra/abi/trust.go Outdated
Comment thread pkg/domain/infra/abi/trust.go Outdated
@mtrmac mtrmac marked this pull request as draft April 14, 2026 17:12
@mtrmac mtrmac added the No New Tests Allow PR to proceed without adding regression tests label Apr 14, 2026
@mtrmac
Copy link
Copy Markdown
Contributor

mtrmac commented Apr 14, 2026

(I have added “No new tests” to let the CI run, and switched the PR to draft, correspondingly. If this PR does end up making changes to the repo, please consider removing the label.)

Comment thread pkg/api/handlers/compat/images.go Outdated
if err != nil {
logrus.Warnf("could not resolve relative path to binary: %q", err)
}
paths = append(paths, filepath.Join(filepath.Dir(p), DefaultPolicyJSONPath, policyfile))
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.

Note this part, this seems to allow shipping Podman machine in a non-default / relocatable location.

Do we know that this is no longer necessary?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

this has never been used or documented by us, it comes from patches before we agreed to not mandate policy.json for podman machine.

Using the officially documented locations consistently seem much much saner to me

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.

OTOH we have this week been talking about starting to sign the machine images, so something like this might be coming.

If we are not worried about breaking users, I’m fine with switching back to the default now and perhaps changing the behavior again later.

Comment thread pkg/domain/infra/abi/trust.go Outdated
Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

ack overall, just some minor stuff and the missing docs.

Comment thread cmd/podman/images/trust_set.go Outdated
Comment thread cmd/podman/images/trust_show.go
Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

ACK overall, I didn’t carefully look at the CLI integration.

I’ll also drop the “no new tests” label now.

Comment thread pkg/domain/infra/abi/trust.go Outdated
@mtrmac mtrmac removed the No New Tests Allow PR to proceed without adding regression tests label Apr 15, 2026
@jankaluza jankaluza force-pushed the configfile branch 3 times, most recently from 9669567 to 53a5d13 Compare April 16, 2026 11:05
@jankaluza jankaluza added the bloat_approved Approve a PR in which binary file size grows by over 50k label Apr 16, 2026
Use shared configfile instead of custom policy.json path handling.
This updates ocipull to rely on signature.DefaultPolicy(), removes
explicit SignaturePolicyPath, and replaces trust's custom default-policy
path logic with common configfile code.

Replace hidden `--policypath` with --signature-policy` and require
it for `trust set` command instead of path resolution based on
configfile.

For `trust get`, the `--signature-policy` is optional.

Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
Signed-off-by: Jan Kaluza <jkaluza@redhat.com>
@jankaluza jankaluza changed the title WIP: trust: switch policy.json lookup to configfile trust: switch policy.json lookup to configfile Apr 20, 2026
@jankaluza
Copy link
Copy Markdown
Member Author

I rebased it to main and also to latest container-libs.

@packit-as-a-service
Copy link
Copy Markdown

tmt tests failed for commit cae4c40. @lsm5, @psss, @thrix please check.

@jankaluza
Copy link
Copy Markdown
Member Author

/packit test

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

changes LGTM overall, I would squash commit 1 and 2 though

@packit-as-a-service
Copy link
Copy Markdown

[NON-BLOCKING] Packit jobs failed. @containers/packit-build please check. Everyone else, feel free to ignore.

Copy link
Copy Markdown
Contributor

@mtrmac mtrmac left a comment

Choose a reason for hiding this comment

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

LGTM if tests pass. Thanks!

@jankaluza
Copy link
Copy Markdown
Member Author

/packit test

@packit-as-a-service
Copy link
Copy Markdown

tmt tests failed for commit cae4c40. @lsm5, @psss, @thrix please check.

@jankaluza
Copy link
Copy Markdown
Member Author

I'm down to revdeps test, which fails with suspicious message:

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Test
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

:: [ 04:42:13 ] :: [   FAIL   ] :: Command 'tmt run --id /tmp/tmp.PTfvFVrcdN -vvv' (Expected 0, got 2)
:: [ 04:42:13 ] :: [   FAIL   ] :: File '/var/tmp/rlRun_LOG.cL0FXj6O' should contain 'NAME.*Fedora Linux' 
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
::   Duration: 7s
::   Assertions: 0 good, 2 bad
::   RESULT: FAIL (Test)

@jankaluza jankaluza marked this pull request as ready for review April 21, 2026 05:11
@jankaluza
Copy link
Copy Markdown
Member Author

But I see the same test failure also on other recent PRs (#28550), so maybe it's just tft issue. I will retry this later today.

Copy link
Copy Markdown
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

LGTM, packit tests are non blocking and can be ignored, the tmt reverse dep tests use the wrong netavark version.

@Luap99 Luap99 merged commit ff6fb6e into containers:main Apr 21, 2026
90 of 91 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bloat_approved Approve a PR in which binary file size grows by over 50k kind/api-change Change to remote API; merits scrutiny machine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants