-
Notifications
You must be signed in to change notification settings - Fork 647
daemon: extend secureboot endpoint to accept DB, KEK, and PK #16368
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Up until now, only DBX has been supported in the snapd API. As such all logging and function calls have assumed that the update relates to DBX. This commit will generalize the usage of DBX to include DB, KEK, and PK as well. Additionally, this commit will refactor function names to indicate that they do not just affect DBX.
* overlord/fdestate/secure_boot_update.go: Remove trailing whitespace on lines 87-88. * overlord/fdestate/secure_boot_update_test.go: Fix inconsistent argument alignment on line 1235.
The `FromString` and `IsSupportedString` methods will also be adapted to return an error and moved to the daemon API.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR extends the secureboot API endpoint to accept DB, KEK, and PK key database updates in addition to DBX. It's the third part of a three-part series that generalizes the DBX-specific secureboot update functionality to support all four UEFI Secure Boot key databases (PK, KEK, DB, and DBX). The changes include API validation updates, comprehensive unit test coverage for all key database types, and necessary refactoring of function names and error messages.
Key Changes
- Added validation and conversion functions for all four key database types (PK, KEK, DB, DBX) in the API layer
- Extended unit test coverage to test all key database types with parameterized test helpers
- Updated function names from
EFISecureBootDB*toEFISecurebootDB*for consistency
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| daemon/api_system_secureboot.go | Added keyDatabaseFromString() and isValidKeyDatabase() functions to support validation of all four key database types; updated function names for consistency |
| daemon/api_system_secureboot_test.go | Extended test coverage with parameterized helper functions to test PK, KEK, DB, and DBX operations separately |
| daemon/export_api_system_secureboot_test.go | Updated mock function names to match the corrected EFISecureboot* naming convention |
| overlord/fdestate/secure_boot_update.go | Added String() method for EFISecurebootKeyDatabase enum; updated function names, error messages, and logging to be generic rather than DBX-specific |
| overlord/fdestate/secure_boot_update_test.go | Extended comprehensive test coverage with parameterized test helpers for all four key database types; updated error message assertions to be dynamic based on key database type |
| overlord/fdestate/conflict.go | Updated conflict checking to accept key database parameter; generalized error messages and comments from DBX-specific to generic Secureboot Key Database |
| overlord/fdestate/conflict_test.go | Updated test expectations for generalized error messages |
| overlord/fdestate/fdestate_test.go | Updated test expectations for generalized error messages |
| overlord/fdestate/export_test.go | Updated exported test helper function names to match new naming convention |
Comments suppressed due to low confidence (4)
overlord/fdestate/secure_boot_update_test.go:1141
- The comment still refers to "external DBX manager process" but should be updated to refer to "external Secureboot Key Database manager process" or similar, since this test now applies to PK, KEK, DB, and DBX updates.
overlord/fdestate/secure_boot_update_test.go:1521 - The comment still refers to "external DBX manager process" but should be updated to refer to "external Secureboot Key Database manager process" or similar, since this test now applies to PK, KEK, DB, and DBX updates.
overlord/fdestate/secure_boot_update_test.go:1422 - Typo: "ant" should be "and".
overlord/fdestate/secure_boot_update_test.go:1492 - Typo: "ant" should be "and".
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #16368 +/- ##
==========================================
+ Coverage 77.47% 77.50% +0.03%
==========================================
Files 1339 1338 -1
Lines 182910 183041 +131
Branches 2438 2438
==========================================
+ Hits 141705 141864 +159
+ Misses 32613 32588 -25
+ Partials 8592 8589 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Fri Dec 12 18:59:46 UTC 2025 Failures:Executing:
Restoring:
|
A matched error message was not updated correctly in the nested core20-fde-dbx spread test.
Attempt to generalize API testing for easy extension of multiple different types of updates instead of only testing DBX. The proposed test design defines a general private method that is called by a specific public method for each update type. Initially, an attempt was made to utilize table driven tests, however separate test functions turned out to be the most straight- forward way of restoring state between tests.
f170bf9 to
95316b2
Compare
Note: this PR depends on proposed changes made in another PR. Once the first one has landed, this branch will be rebased onto
masterto reflect the relevant additions and changes. As such, the current scope in terms of additions, removals, and files changed is to be considered misleading.Overview
This PR is one of three with the intention of extending the secureboot API to accept DB, KEK, and PK updates in addition to DBX:
Proposed changes
This PR will change the validation check in the secureboot API to accept DB, KEK, and PK key databases in addition to DBX. It will also include API unit tests for these key databases and add additional spread tests similar to
tests/nested/manual/hybrid-fde-dbx.