fix(anssi/R3): unquote regex pattern in Secure Boot check#187
Merged
jdauphant-dinum merged 1 commit intoJun 16, 2026
Merged
Conversation
The R3 check tested the hex dump of the SecureBoot efivar with `[[ "$secure_boot_status" =~ ".*01.*" ]]`. Since bash 3.2, any quoted portion of the right-hand side of `[[ =~ ]]` is matched as a literal string, not a regex. Bash therefore searched the hex dump for the literal substring `.*01.*` (dots and stars taken literally), which is never present. The test always failed, so R3 reported "Secure Boot is not enabled" on every host - including hosts where `sbctl status` and `bootctl status` confirm Secure Boot is on. R5 (`depends = [ "R3" ]`) inherited the false negative. Drop the quotes so the substring `01` is matched as a regex. The `SecureBoot` efivar carries attribute byte `0x06` (BS|RT) per the UEFI spec and a single value byte (`0x01` enabled / `0x00` disabled), so `01` only appears on the value byte in practice. Fixes cloud-gouv#128.
rlahfa-dinum
approved these changes
Jun 1, 2026
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.
Comme demandé par @rlahfa-dinum dans #128.
[[ "$status" =~ ".*01.*" ]]testait une chaîne littérale (bash 3.2+ : motif entre guillemets = comparaison littérale, pas regex). Le retrait des guillemets autour de01corrige le faux négatif.Closes #128.
Test plan
nix flake checkanssi-nixos-compliance-checksur un hôte avec Secure Boot activé : R3 retournepassfail