Repository navigation
Finish fingerprint setup when a print is already enrolled - #13542
stevederico wants to merge 15 commits into
Conversation
Automated AI review
Outcome: A new print that fails verification still gets "try enrolling again", which a rerun now skips. Fresh print that fails verification gets the old adviceThe Suggested change: merge the Reproducer (fails at 2b24db0)Reproducer: fresh enrollment that fails verification still says "try enrolling again"Reviewed head: A test in the PR's own style. The stubbed Save as bash test/shell.d/fingerprint-setup-rerun-test.sh#!/bin/bash
#
# A print that fresh enrollment stored is still enrolled when its verification
# fails, so the next run of setup skips enrollment. The advice printed after
# that failure has to work on the next run.
set -euo pipefail
source "$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)/base-test.sh"
setup="$ROOT/bin/omarchy-setup-security-fingerprint"
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
mkdir -p "$scratch/bin"
export CALL_LOG="$scratch/calls"
export PRINTS="$scratch/prints"
export PATH="$scratch/bin:$ROOT/bin:$PATH"
stub() {
printf '#!/bin/bash\n%s\n' "$2" > "$scratch/bin/$1"
chmod +x "$scratch/bin/$1"
}
stub sudo '[[ $1 == fprintd-enroll ]] && exec "$@"; printf "sudo %s\n" "$*" >> "$CALL_LOG"'
stub omarchy-hw-fingerprint 'exit 0'
stub omarchy-pkg-missing 'exit 1'
# Like fprintd, list what an earlier fprintd-enroll stored.
stub fprintd-list 'if [[ -e $PRINTS ]]; then printf "Fingerprints for user %s on Validity VFS5011 (swipe):\n - #0: right-index-finger\n" "$1"; else printf "User %s has no fingers enrolled for Validity VFS5011.\n" "$1"; fi'
stub fprintd-enroll 'echo "fprintd-enroll $*" >> "$CALL_LOG"; touch "$PRINTS"'
stub fprintd-verify 'echo "fprintd-verify" >> "$CALL_LOG"; exit 1'
run_setup() {
: > "$CALL_LOG"
USER=tester bash "$setup" > "$scratch/out" 2>&1 || true
}
# First run: nothing enrolled, enrollment works, verification fails.
run_setup
grep -qx 'fprintd-enroll tester' "$CALL_LOG" || fail "the first run enrolls" "$(<"$CALL_LOG")"
first_run=$(sed 's/\x1b\[[0-9;]*m//g' "$scratch/out")
# Second run: does setup enroll again, as the first run's advice suggests?
run_setup
if ! grep -q '^fprintd-enroll' "$CALL_LOG" && ! grep -q 'fprintd-delete tester' <<< "$first_run"; then
fail "a fresh print that fails to verify says how to enroll again" \
"first run said: $(grep -i 'verification failed' <<< "$first_run")
second run calls: $(tr '\n' ' ' < "$CALL_LOG")"
fi
pass "a fresh print that fails to verify says how to enroll again"Actual output at 2b24db0 (exit 1, stderr)Actual output at the merge-base 97a9fce (exit 0)(At the merge-base the second run enrolls again, so the old advice was accurate there.) With the suggested changeReplacing the -elif $already_enrolled; then
- # Rerunning setup would skip enrollment again while that print exists.
+else
+ # Rerunning setup skips enrollment while any print exists, including the one
+ # this run may just have enrolled.
echo -e "\e[31m\nVerification failed. To enroll again, remove the saved fingerprints with\e[0m"
echo -e "\e[31mfprintd-delete $USER, then run this setup again.\e[0m"
-else
- echo -e "\e[31m\nVerification failed. You may want to try enrolling again.\e[0m"
fithis reproducer prints Package test runs the host's
|
[Medium impact] The change affects fingerprint setup and the sign-in options it configures. The code appears sound, but the test cases must be combined with the existing file before merging to meet repository requirements. Findings
SummarySetup now checks for saved fingerprints on the default reader and verifies an existing print instead of enrolling it again.
Reviews (12) · Last reviewed commit: "Stub the platform enable hook in the enr..." · Reviewed by Greptile |
|
Reviewed against Reproduction. On a worker I ran fprintd 1.94.5 and libfprint-git 1.94.100 (the versions in #13433) with libfprint's virtual image reader, which matches prints the way a VFS5011 does, and ran the setup script itself with only the hardware check stubbed. With a print saved under What actually triggers Pushed:
Tests. On the worker, all six fingerprint test files pass at Second opinion. Codex Medium reviewed the branch with my commits on top. It agreed on when fprintd reports Competing fixes. #13467 never detects a saved print (fprintd doesn't print Waiting on the maintainer: choosing between this, #13467 and #13612, and deciding whether the two-reader case matters. |
fprintd-enroll refuses a finger that is already enrolled, so re-running setup after an earlier run left a print behind always stopped at "Enrollment failed" and never wrote the PAM stacks. The print existed but could not be used for sudo, polkit or the lock screen, and no rerun could fix it. Check fprintd-list for enrolled prints first and go straight to verify and PAM when one exists. Match its " - #N:" entry lines: its "no fingers enrolled" message also contains the word finger. Fixes omacom#13433
A print enrolled in this run stays saved when its verification fails, so a rerun skips enrollment just as it does for an older print, and "try enrolling again" sent the user round the same loop. The comments now say when fprintd actually reports enroll-duplicate: fprintd 1.94 deletes a print saved under the same finger name before enrolling, and refuses only a finger that matches a print saved under another name.
Setup now asks fprintd-list for saved prints before enrolling, so without a stub the test read the host's fprintd and failed for anyone with a print enrolled.
fprintd-list lists every reader, but fprintd-enroll and fprintd-verify use fprintd's default one. A print saved only on another reader made setup skip enrollment and then fail verification. Setup now asks fprintd for its default reader (GetDefaultDevice over gdbus, which ships with glib2) and only counts prints listed under that reader's "Using device" header. A failed fprintd-list no longer reads as no prints: setup stops before enrollment and says to check that fprintd is running. The enrolled-print test redirects /etc/pam.d into its scratch directory and now checks the sudo and polkit steps as well as the lock screen. New cases cover a print on a non-default reader, a print on the default of two readers, and a failed list.
18fa2c9 to
a8c76eb
Compare
A failed verification pointed at fprintd-delete $USER, which removes every print the user saved on the reader, not just the one that failed. Since fprintd-verify accepts any saved finger, the failing one is not known, so the message now points at fprintd-list to see them and offers fprintd-delete -f <finger> for one, or the bare command for all.
When omarchy-hw-fingerprint sees a sensor that libfprint cannot drive, fprintd has no devices and GetDefaultDevice fails. Setup treated that as "could not check for saved fingerprints" and told the user to make sure fprintd was running, which it was. No default reader holds no print, so setup now goes on to enrollment, which fails with fprintd's own "No devices available", as it did before the saved-print check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The per-finger command also contains fprintd-delete tester, so the old check would still pass if the advice to remove every print went away. Since verification can't say which finger failed, that line is the one that reliably starts over, so the test now looks for it separately.
a9dfed5 to
ee5b65a
Compare
Any failure of the GetDefaultDevice call went on to enrollment, so a bus or activation failure that cleared before fprintd-enroll ran could hide a saved print and bring back enroll-duplicate. Only fprintd's own NoSuchDevice means there is no reader to hold a print; every other failure stops setup like a failed fprintd-list. Co-Authored-By: Codex Medium <noreply@openai.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Re-reviewed at Reproduction. Same setup as last time, on a fresh worker: fprintd 1.94.5 and libfprint-git 1.94.100, this time with libfprint's virtual storage reader, running the setup script with only the hardware check stubbed. With a print saved under Default reader. a1df827 answers last review's two-reader case. Matching on the Pushed:
Tests. On the worker at this head, all four fingerprint test files pass (10 cases in Second opinion. Codex Medium reviewed this head over three rounds. It agreed that the missing-reader message was wrong, a problem I had already put in its brief, so that agreement isn't a guaranteed independent check. It found something I hadn't: my first version sent every failed reader lookup on to enrollment, and Unchanged. The case in #13433's output, where a finger saved for another account still ends at "Enrollment failed", is still not fixed. That is why this PR says Waiting on CI to finish at this head, then on the maintainer to choose between this, #13467 and #13612. |
quattro now guides enrollment and verification through enroll_progress and verify_progress, authenticates sudo before enrolling, and fails setup on a failed verify. The enrolled-print check keeps its place before enrollment: the scan-type prompts are worked out before the branch, so the verify step of an already-enrolled print gets the same prompt and result filter, while the sudo step and the enrollment instructions stay with enrollment. A failed verify keeps the fprintd-delete advice and now exits non-zero, as quattro's does. The enrolled-print test stubs busctl so the reader lookups never reach the host's fprintd. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
assert_pam_untouched only rejected the polkit tee, so a sudo sed before verification passed it, and the fresh-print verify failure ignored the exit status quattro now makes non-zero. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-Authored-By: Codex Medium <noreply@openai.com>
|
Brought up to date with Pushed:
Reproduction. On a fresh worker with real fprintd 1.94.5, libfprint-git and libfprint's virtual storage reader, I saved a print as Tests. On the worker, every fingerprint test file passes, and so does Second opinion. Codex Medium reviewed the merge and found no defect in the resolution. It raised the two test gaps fixed in Unchanged. A finger saved under another account still ends at "Enrollment failed". That is the case in #13433's output, so this PR still says Waiting on the maintainer. |
# Conflicts: # bin/omarchy-setup-security-fingerprint
| # Fingerprint setup must still reach PAM when a print is already enrolled, since | ||
| # fprintd-enroll refuses a finger saved under another finger name as enroll-duplicate. | ||
| # fprintd, sudo, omarchy-apply-lock and omarchy-lifecycle-dispatch are stubbed; they only record what setup asked for. |
There was a problem hiding this comment.
Fingerprint tests duplicate existing setup
This new file adds a second set of tests and stubs for omarchy-setup-security-fingerprint. The contributor guide requires extending the area's existing test file rather than adding another *-test.sh. Move these cases into fingerprint-package-test.sh and share its setup. This repository requirement must be satisfied before merging.
File Used: AGENTS.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
|
Re-checked at The merges. Reproduction, on a fresh worker with fprintd 1.94.5, libfprint-git and libfprint's virtual storage reader:
Tests, on the worker. Second opinion. Codex Medium and muse-wonder (pi, thinking high) reviewed the merges, the two test commits and the competing #13467. Neither found a functional defect. Both chose this PR over #13467, which is older but still checks for Left for you. Both reviewers agree with Greptile's second point: Unchanged. A finger saved under another account still ends at "Enrollment failed", so this stays Waiting on the author for the test move, then on the maintainer. |
omarchy setup security fingerprintstops at "Enrollment failed" when your finger is already saved under another finger name, so sudo, polkit and the lock screen never get fingerprint auth. Refs #13433Before: fprintd answers
enroll-duplicate, and setup only configures PAM after a fresh enroll.After: when a print is already saved on fprintd's default reader, setup skips enrolling, verifies it, then sets up sudo, polkit and the lock screen. A failed verify prints how to delete prints (
fprintd-list $USER,fprintd-delete $USER -f <finger>). If fprintd can't be asked, setup stops instead of treating it as no prints.How I tested
bash test/shell.d/fingerprint-setup-enrolled-test.shpasses (10 ok) and fails with the fix reverted.fingerprint-package-test.shpasses and no longer reads the host's fprintdRefs, not Fixes: a finger saved for another account (the case in #13433's output) still ends at "Enrollment failed". #13467's check never matches real
fprintd-listoutput. #13612 adds a confirm prompt.