Skip to content

Bound images are verified with the old deployment's policy #2652

Open

Description

@axel7083

If you define a /etc/containers/policy.json in a bootc image, and update this policy in a new image, bootc upgrade will reads the bound images from the new deployment:

pub(crate) async fn pull_bound_images(sysroot: &Storage, deployment: &Deployment) -> Result<()> {
// Log the bound images operation to systemd journal
const BOUND_IMAGES_JOURNAL_ID: &str = "1a0b9c8d7e6f5a4b3c2d1e0f9a8b7c6d5";
tracing::info!(
message_id = BOUND_IMAGES_JOURNAL_ID,
bootc.deployment.osname = deployment.osname().as_str(),
bootc.deployment.checksum = deployment.csum().as_str(),
"Starting pull of bound images for deployment"
);
let ostree = sysroot.get_ostree()?;
let bound_images = query_bound_images_for_deployment(ostree, deployment)?;
tracing::info!(
message_id = BOUND_IMAGES_JOURNAL_ID,
bootc.bound_images_count = bound_images.len(),
"Found {} bound images to pull",
bound_images.len()
);
pull_images(sysroot, bound_images).await

but pulls them with the booted system's /etc/containers/policy.json:

pub(crate) async fn pull(&self, image: &str, mode: PullMode) -> Result<bool> {
match mode {
PullMode::IfNotExists => {
if self.exists(image).await? {
tracing::debug!("Image is already present: {image}");
return Ok(false);
}
}
PullMode::Always => {}
};
let mut cmd = self.new_image_cmd()?;
cmd.stdin(Stdio::null());
cmd.stdout(Stdio::null());
cmd.args(["pull", image]);
tracing::debug!("Pulling image: {image}");
let mut cmd = AsyncCommand::from(cmd);
cmd.run().await.context("Failed to pull image")?;

So an image that adds a bound image and allows it in its own policy.json can't be upgraded to:

Source image rejected: Running image docker://ghcr.io/example/app@sha256:… is rejected by policy.

Expected: use the new deployment's policy (podman pull --signature-policy).

bootc 1.17.1, same code in v1.17.4.

Activity

  1. Johan-Liebert1 commented on Nov 24, 2026

    @Johan-Liebert1
    Member

    This has some intersection with #2679. I can pick it up one it's merged

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions