Skip to content

fix(dell): don't skip the SecureBootPolicy write when applied state matches - #472

Closed
mcanevet wants to merge 3 commits into
bmc-toolbox:mainfrom
mcanevet:fix/secure-boot-policy-always-write
Closed

mcanevet wants to merge 3 commits into
bmc-toolbox:mainfrom
mcanevet:fix/secure-boot-policy-always-write

Conversation

@mcanevet

@mcanevet mcanevet commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Stacked on #466 and #468. This PR's diff currently bundles their commits in; it'll shrink to just the last commit once they merge.

AllowCustomSecureBootKeys read the attribute's currently applied value and returned early when it already matched what was requested. Confirmed live, that's unsafe: currently-applied state can match while a different value is genuinely pending from an earlier call in the same boot cycle (e.g. a stale pending PATCH left staged by an interrupted, unrelated caller). Skipping the write left that stale pending value in place, silently reverting an explicit request on the next reboot — observed as a certificate import rejected because SecureBootPolicy committed as Standard despite requesting Custom moments earlier.

This is the same class of bug stmcginnis/gofish#571 (merged, picked up by #468) fixes one layer down, in SetBiosConfiguration's own diff baseline — but #468 alone doesn't cover this case, since the early return here skipped the call to SetBiosConfiguration entirely, before #468's fix ever gets a chance to run.

The attribute is still read first, but only to reject platforms that don't expose it at all. The write itself is now unconditional.

Depends on #466 and #468.

@mcanevet
mcanevet force-pushed the fix/secure-boot-policy-always-write branch 5 times, most recently from 0c3174a to a47f069 Compare September 17, 2026 06:25
mcanevet and others added 3 commits September 17, 2026 16:03
…ceptance

UEFI platform mode (Setup/Audit/User/Deployed) and this new capability are two
independent channels and must not be conflated. Platform mode is a
standardized, PK-presence-derived concept already expressible via
SecureBootKeysResetter (DeletePK) and SecureBootCertificateImporter (PK
import) - no new setter needed. SecureBootKeyManagementSetter instead gates
whether the platform accepts *out-of-band* modification of the key stores at
all, independent of mode or current key contents.

Implemented for Dell only; other providers correctly surface
ErrProviderImplementation by not implementing the interface. Lenovo has a
direct analog (SecureBootConfiguration.SecureBootPolicy) that Lenovo's own
docs confirm gates ImportSecureBootCertificate the same way, but it's not
implemented here: unconfirmed whether the attribute is reachable via the
generic /Bios PATCH this provider already uses, or requires Lenovo's
proprietary OneCLI/XCC transport - untestable without real hardware. Recorded
in providers/lenovo/secure_boot.go so it isn't rediscovered from scratch.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
The old name read like it managed something generic; per review feedback,
rename to make the actual behavior - toggling whether the platform accepts
non-factory UEFI Secure Boot keys - clear from the signature alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Mickael Canevet <mickael.canevet@proton.ch>
…atches

AllowCustomSecureBootKeys read the attribute's currently applied value and
returned early when it already matched what was requested. Confirmed live,
that's unsafe: currently-applied state can match while a different value is
genuinely pending from an earlier call in the same boot cycle (e.g. a stale
pending PATCH left staged by an interrupted, unrelated caller). Skipping the
write left that stale pending value in place, silently reverting an explicit
request on the next reboot - observed as a certificate import rejected
because SecureBootPolicy committed as Standard despite requesting Custom
moments earlier. It's the same class of bug stmcginnis/gofish#571 fixes one
layer down, in SetBiosConfiguration's own diff baseline - but this early
return happens before SetBiosConfiguration is ever called, so #571 can't
reach it.

The attribute is still read first, but only to reject platforms that don't
expose it at all. The write itself is now unconditional.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Signed-off-by: Mickaël Canévet <mickael.canevet@proton.ch>
@mcanevet
mcanevet force-pushed the fix/secure-boot-policy-always-write branch from a47f069 to 3f78ec4 Compare September 17, 2026 14:04
@mcanevet

Copy link
Copy Markdown
Contributor Author

Folded into #466 - this fix is for AllowCustomSecureBootKeys, which #466 itself introduces, so it belongs in that PR rather than as a separate follow-up.

@mcanevet mcanevet closed this Sep 17, 2026
@mcanevet
mcanevet deleted the fix/secure-boot-policy-always-write branch September 17, 2026 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant