install: Add a config knob for container sigpolicy#2116
install: Add a config knob for container sigpolicy#2116jbtrystram wants to merge 1 commit intobootc-dev:mainfrom
Conversation
27089cc to
9f8f38a
Compare
There was a problem hiding this comment.
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.
| 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); | ||
| } |
There was a problem hiding this comment.
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
left a comment
There was a problem hiding this comment.
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
|
For now just missing |
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>
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)
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.
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)
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.
9f8f38a to
33db387
Compare
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)
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.
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)
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.
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)
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.
Surface the
--enforce-container-sigpolicyflag as a config file option.Fixes #2112
Assisted-by: OpenCode.ai <Opus 4.6>