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>

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>
@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;
            }
        }

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

1 participant