Skip to content

install: Add a config knob for container sigpolicy#2116

Open
jbtrystram wants to merge 1 commit intobootc-dev:mainfrom
jbtrystram:sigpolicy-config-knob
Open

install: Add a config knob for container sigpolicy#2116
jbtrystram wants to merge 1 commit intobootc-dev:mainfrom
jbtrystram:sigpolicy-config-knob

Conversation

@jbtrystram
Copy link
Copy Markdown
Contributor

Surface the --enforce-container-sigpolicy flag as a config file option.

Fixes #2112

Assisted-by: OpenCode.ai <Opus 4.6>

@github-actions github-actions bot added area/install Issues related to `bootc install` area/documentation Updates to the documentation labels Apr 2, 2026
@jbtrystram jbtrystram force-pushed the sigpolicy-config-knob branch from 27089cc to 9f8f38a Compare April 2, 2026 07:46
@bootc-bot bootc-bot bot requested a review from jmarrero April 2, 2026 07:46
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces support for the enforce-container-sigpolicy configuration option, allowing users to enforce container image signature policies via TOML drop-in files. The changes include updating the InstallConfiguration struct, implementing the necessary merging logic, adding unit tests, and updating the relevant documentation. The reviewer suggested refactoring the configuration merging logic to use if let for better readability and to avoid redundant assignments when configuration values are absent.

Comment on lines +1553 to +1569
if !config_opts.bootupd_skip_boot_uuid {
config_opts.bootupd_skip_boot_uuid = config
.bootupd
.as_ref()
.and_then(|b| b.skip_boot_uuid)
.unwrap_or(false);
}

if config_opts.bootloader.is_none() {
config_opts.bootloader = config.bootloader.clone();
}

if !target_opts.enforce_container_sigpolicy {
target_opts.enforce_container_sigpolicy = config
.enforce_container_sigpolicy
.unwrap_or(false);
}
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.

medium

The logic for merging boolean options from the configuration file can be made more explicit to improve readability and avoid potentially redundant assignments.

When a boolean configuration option is not present, the current implementation with unwrap_or(false) assigns false to a variable that is already known to be false inside the if !... block.

Using if let to check for the presence of the config value before assigning makes the intent clearer and avoids this no-op assignment.

        if !config_opts.bootupd_skip_boot_uuid {
            if let Some(skip) = config.bootupd.as_ref().and_then(|b| b.skip_boot_uuid) {
                config_opts.bootupd_skip_boot_uuid = skip;
            }
        }

        if config_opts.bootloader.is_none() {
            config_opts.bootloader = config.bootloader.clone();
        }

        if !target_opts.enforce_container_sigpolicy {
            if let Some(enforce) = config.enforce_container_sigpolicy {
                target_opts.enforce_container_sigpolicy = enforce;
            }
        }

cgwalters
cgwalters previously approved these changes Apr 2, 2026
Copy link
Copy Markdown
Collaborator

@cgwalters cgwalters left a comment

Choose a reason for hiding this comment

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

Looks sane. That said I think it'd be helpful for us to

  • consolidate our install tests into one thing
  • add an install test case for this from a container image source config, not just a synthetic unit test

@cgwalters
Copy link
Copy Markdown
Collaborator

For now just missing cargo fmt

Surface the `--enforce-container-sigpolicy` flag as a config file option.

Fixes bootc-dev#2112

Assisted-by: OpenCode.ai <Opus 4.6>
Signed-off-by: jbtrystram <jbtrystram@redhat.com>
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 8, 2026
Tell bootc to enforce that `/etc/containers/policy.json` include a default
policy that verify our images signature.

When moving to image-builder, this config can be moved into the container itself
but as long as we are using osbuild manually we have to carry this in the buildroot.
TODO: uncomment this when bootc-dev/bootc#2116
is merged and released

See coreos/fedora-coreos-config#4093 (comment)
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 8, 2026
Until we are able to tune this through and install config file, let's
always pass the flag at the osbuild label.

This can be dropped once we have bootc-dev/bootc#2116
in bootc.
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 8, 2026
Tell bootc to enforce that `/etc/containers/policy.json` include a default
policy that verify our images signature.

When moving to image-builder, this config can be moved into the container itself
but as long as we are using osbuild manually we have to carry this in the buildroot.
TODO: uncomment this when bootc-dev/bootc#2116
is merged and released

See coreos/fedora-coreos-config#4093 (comment)
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 8, 2026
Until we are able to tune this through and install config file, let's
always pass the flag at the osbuild label.

This can be dropped once we have bootc-dev/bootc#2116
in bootc.
@jbtrystram jbtrystram force-pushed the sigpolicy-config-knob branch from 9f8f38a to 33db387 Compare April 8, 2026 14:21
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 9, 2026
Tell bootc to enforce that `/etc/containers/policy.json` include a default
policy that verify our images signature.

When moving to image-builder, this config can be moved into the container itself
but as long as we are using osbuild manually we have to carry this in the buildroot.
TODO: uncomment this when bootc-dev/bootc#2116
is merged and released

See coreos/fedora-coreos-config#4093 (comment)
jbtrystram added a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 9, 2026
Until we are able to tune this through and install config file, let's
always pass the flag at the osbuild label.

This can be dropped once we have bootc-dev/bootc#2116
in bootc.
dustymabe pushed a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 9, 2026
Tell bootc to enforce that `/etc/containers/policy.json` include a default
policy that verify our images signature.

When moving to image-builder, this config can be moved into the container itself
but as long as we are using osbuild manually we have to carry this in the buildroot.
TODO: uncomment this when bootc-dev/bootc#2116
is merged and released

See coreos/fedora-coreos-config#4093 (comment)
dustymabe pushed a commit to jbtrystram/coreos-assembler that referenced this pull request Apr 9, 2026
Until we are able to tune this through and install config file, let's
always pass the flag at the osbuild label.

This can be dropped once we have bootc-dev/bootc#2116
in bootc.
dustymabe pushed a commit to coreos/coreos-assembler that referenced this pull request Apr 9, 2026
Tell bootc to enforce that `/etc/containers/policy.json` include a default
policy that verify our images signature.

When moving to image-builder, this config can be moved into the container itself
but as long as we are using osbuild manually we have to carry this in the buildroot.
TODO: uncomment this when bootc-dev/bootc#2116
is merged and released

See coreos/fedora-coreos-config#4093 (comment)
dustymabe pushed a commit to coreos/coreos-assembler that referenced this pull request Apr 9, 2026
Until we are able to tune this through and install config file, let's
always pass the flag at the osbuild label.

This can be dropped once we have bootc-dev/bootc#2116
in bootc.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/documentation Updates to the documentation area/install Issues related to `bootc install`

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add knob in install config for --enforce-container-sigpolicy

2 participants