Verify kernel archive SHA-256 digests#1703
Open
haoruilee wants to merge 2 commits into
Open
Conversation
kasc0206
approved these changes
Jun 14, 2026
kasc0206
left a comment
There was a problem hiding this comment.
审查意见 / Review
This is a well-crafted security improvement. The SHA-256 digest verification for kernel downloads is an important addition.
优点 / Strengths
- End-to-end implementation: From CLI flag → config → XPC message → server-side verification, the full pipeline is covered
- Backward compatible:
sha256isString?with defaultnil, so existing configs work unchanged - Smart defaults: Auto-populates the default SHA-256 when using the default kernel URL, while allowing custom values for custom URLs
- No breaking API changes: All new parameters have sensible defaults
- Proper error messaging: The
--sha256can only be used with--tar
Suggestion
- Consider adding a
--sha256-verifyflag with--sha256-verify=falseto allow users to explicitly skip verification, rather than relying onnilmeaning "no verification". But this is optional — current behavior is reasonable.
已验证 / Verified
- Code compiles with
swift build✅ - Follows existing project patterns (XPC keys, Config struct, ProgressBar)
Great contribution!
Code Review Summary / 代码审查摘要Strengths / 优点
Suggestion / 建议Consider adding a Verification / 验证
Great contribution! / 优秀的贡献! |
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.
Type of Change
Motivation and Context
Closes #1687
The default kernel archive is downloaded from a remote release URL during first-run setup and via
container system kernel set --recommended. Previously, the archive contents were not verifiedafter download, so integrity depended only on HTTPS and the release artifact remaining unchanged.
This change adds Homebrew-style
url + sha256verification for kernel archives. The recommended/default kernel now has a pinned SHA-256 digest, andcontainer system kernel set --taraccepts--sha256so custom local or remote tar archives can be verified before unpacking and installation.Testing
Validated on macOS:
swift test --filter KernelServiceTestspassedswift test --filter ConfigurationLoaderTestspassedcontainer system kernel set --tar <remote-url> --binary <path> --sha256 <digest>succeeded and containers ran successfully