Added more comprehensive support to inspect bootloader configuration#404
Merged
Added more comprehensive support to inspect bootloader configuration#404
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the image inspection/comparison subsystem to extract, represent, diff, classify, and render bootloader configuration changes (GRUB/systemd-boot/UKI-derived) as part of EFI evidence and semantic equality assessment.
Changes:
- Add
BootloaderConfig/BootloaderConfigDiffstructures and integrate them into EFI evidence, comparison diffs, and equality tallying. - Extract bootloader config data from raw FAT/ESP reads (plus UKI-based synthesis) and parse basic GRUB + loader.conf content.
- Render bootloader config details and diffs in the text renderer, and add comprehensive unit tests around parsing/validation/diffing.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
| internal/image/imageinspect/renderer_text.go | Renders bootloader config details per image and bootloader config diffs during comparisons. |
| internal/image/imageinspect/imageinspect.go | Introduces core BootloaderConfig/related types and adds hashBytesHex helper. |
| internal/image/imageinspect/helpers_test.go | Updates hashing test to use hashBytesHex. |
| internal/image/imageinspect/fs_raw.go | Extracts bootloader config from ESP FAT volume and synthesizes config from UKI cmdline when applicable. |
| internal/image/imageinspect/compare_efi.go | Computes structured diffs for bootloader config changes. |
| internal/image/imageinspect/compare.go | Adds bootloader config diffs into semantic diff tallying (meaningful vs volatile). |
| internal/image/imageinspect/bootloader_efi.go | Switches PE hashing to hashBytesHex and adds a bootloader config path helper. |
| internal/image/imageinspect/bootloader_config.go | Adds GRUB/systemd-boot parsing + UUID extraction/validation utilities. |
| internal/image/imageinspect/bootloader_config_test.go | Adds tests for parsing, diffing, UUID resolution, validation, and UKI synthesis. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
In renderBootloaderConfigDiffText, CmdlineTo could be shorter than 77 chars when CmdlineFrom was >80, causing an index out of range panic. Each string is now truncated independently.
9cd16ba to
2e0fb3e
Compare
When both Mismatch and Context differed for the same UUID, compareUUIDReferences silently dropped the context change. Merged the two separate if-blocks into a single condition that produces one change entry carrying both deltas. Added test assertion.
Contributor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge Checklist
All boxes should be checked before merging the PR
Description
This commit completes the bootloader configuration inspection feature by adding comprehensive comparison, diffing, and rendering capabilities. It integrates bootloader configuration changes into the semantic equality assessment system, enabling intelligent classification of changes as meaningful (functional) versus volatile (build artifacts).
Key Functionality Added
Categorizes bootloader config changes for accurate semantic equality assessment:
Meaningful Changes (functional impact - affects boot behavior):
/vmlinuz-5.14→/vmlinuz-5.15)Volatile Changes (expected build variations):
m.BootConfigdiff (consistent with UKI diff pattern)Usage Example
Example output for bootloader config parsing
Any Newly Introduced Dependencies
How Has This Been Tested?
New Test Coverage:
bootloader_config_test.go- +428 lines of comprehensive test cases