Skip to content

Conversation

@jbtrystram
Copy link
Contributor

install: Allow setting ostree stateroot in install config

Support for configuring the stateroot name through the install
configuration file under `[install.ostree]`.
The CLI flag will override config file values, as for other options.

Partial fix for https://github.com/bootc-dev/bootc/issues/1939

Assisted-by: Opencode (Claude Opus 4.5)
Signed-off-by: jbtrystram <jbtrystram@redhat.com>

install: Allow root and boot mount-specs in config

Allow configuring the root and boot filesystem mount
specs via the install configuration file under [install].

As for other options, CLI arguments take precedence.

For the to-existing-root flow, mount specs from config are ignored.
Example configuration:
```
[install]
root-mount-spec = "LABEL=rootfs"
boot-mount-spec = "UUID=abcd-1234"
```

Fixes https://github.com/bootc-dev/bootc/issues/1939

Assisted-by: Opencode (Claude Opus 4.5)
Signed-off-by: jbtrystram <jbtrystram@redhat.com>

Support for configuring the stateroot name through the install
configuration file under `[install.ostree]`.
The CLI flag will override config file values, as for other options.

Partial fix for bootc-dev#1939

Assisted-by: Opencode (Claude Opus 4.5)
Signed-off-by: jbtrystram <jbtrystram@redhat.com>
Allow configuring the root and boot filesystem mount
specs via the install configuration file under [install].

As for other options, CLI arguments take precedence.

For the to-existing-root flow, mount specs from config are ignored.
Example configuration:
```
[install]
root-mount-spec = "LABEL=rootfs"
boot-mount-spec = "UUID=abcd-1234"
```

Fixes bootc-dev#1939

Assisted-by: Opencode (Claude Opus 4.5)
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 Jan 23, 2026
@bootc-bot bootc-bot bot requested a review from jeckersb January 23, 2026 07:36
Copy link
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 configuring stateroot, root-mount-spec, and boot-mount-spec via the install configuration file. While the implementation correctly prioritizes CLI arguments, integrates new fields, and includes comprehensive tests and documentation, a critical security concern has been identified. The new configuration fields lack validation, which could lead to vulnerabilities like Path Traversal, Kernel Command Line Injection, and fstab Injection if a malicious container image is installed. Addressing this input validation is essential to prevent potential system compromise.

Comment on lines +569 to +573
.or_else(|| {
self.install_config
.as_ref()
.and_then(|c| c.stateroot.as_deref())
})
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The stateroot value can now be supplied via the installation configuration file. This value is used to construct file system paths (e.g., ostree/deploy/{stateroot}) and is passed to libostree functions without validation. A malicious value containing path traversal sequences (e.g., ..) could be used to manipulate files outside the intended directory on the target system during installation. It is recommended to validate that the stateroot value is a simple alphanumeric string and does not contain path traversal sequences or directory separators.

Comment on lines +2243 to +2247
let config_root_mount_spec = state
.install_config
.as_ref()
.and_then(|c| c.root_mount_spec.as_ref());
let root_info = if let Some(s) = fsopts.root_mount_spec.as_ref().or(config_root_mount_spec) {
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The root_mount_spec value, which can now be supplied via the installation configuration file, is used to construct the root= kernel argument without proper validation. Because the kernel command line is a space-separated list of arguments, an attacker providing a malicious configuration file can include spaces in the root_mount_spec value to inject arbitrary additional kernel arguments (e.g., selinux=0, init=/bin/sh) into the target system. It is recommended to validate that the root_mount_spec value does not contain whitespace.

Comment on lines +2329 to +2333
let config_boot_mount_spec = state
.install_config
.as_ref()
.and_then(|c| c.boot_mount_spec.as_ref());
let mut boot = if let Some(spec) = fsopts.boot_mount_spec.as_ref().or(config_boot_mount_spec) {
Copy link
Contributor

Choose a reason for hiding this comment

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

security-medium medium

The boot_mount_spec value, which can now be supplied via the installation configuration file, is used to construct an entry in the target system's /etc/fstab file without validation. An attacker can include newlines or extra fields in this value to inject arbitrary entries or malicious mount options into the target system's fstab. It is recommended to validate that the boot_mount_spec value does not contain newlines or unexpected whitespace.

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.

1 participant