utils_test: add support for updating kernel args for image mode#4332
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request adds support for updating kernel arguments in image mode by modifying bootloader entries directly. However, a critical security concern has been identified: several command injection vulnerabilities exist in the update_boot_option function. These vulnerabilities stem from the direct use of unvalidated or improperly escaped variables (e.g., from /proc/cmdline, file system, and test parameters) in shell commands like grep, sed, unshare, and grubby. This could allow an attacker to achieve arbitrary command execution on the guest system. Beyond the security issues, the sed command constructions also have robustness issues, such as unquoted filenames, unsafe sed delimiters, and unescaped arguments for regular expressions, which could lead to incorrect behavior. It is strongly recommended to use shlex.quote() for all variables in shell commands to prevent injection, and to address the sed command construction issues for improved reliability.
cda0a94 to
bec596c
Compare
bec596c to
d0f64e1
Compare
Extend 'update_boot_option' to handle updating kernel args in image mode Signed-off-by: Liang Cong <lcong@redhat.com>
d0f64e1 to
12e919e
Compare
|
@PaulYuuu please help review, thx. |
Extend 'update_boot_option' to handle updating kernel args in image mode.
Note: according to doc: https://docs.fedoraproject.org/en-US/bootc/kernel-args/#_modifying_kernel_arguments_on_existing_systems
Related test result on image mode:
(1/1) type_specific.io-github-autotest-libvirt.memory.devices.virtio_mem.change_memory.file.normal_requested.running_guest: STARTED
(1/1) type_specific.io-github-autotest-libvirt.memory.devices.virtio_mem.change_memory.file.normal_requested.running_guest: PASS (209.38 s)
(1/1) type_specific.io-github-autotest-libvirt.vIOMMU.hotplug_device_with_iommu_enabled.e1000e.intel: STARTED
(1/1) type_specific.io-github-autotest-libvirt.vIOMMU.hotplug_device_with_iommu_enabled.e1000e.intel: PASS (221.27 s)