-
Notifications
You must be signed in to change notification settings - Fork 20
Replace umockdev with vfido for passkey testing #237
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?
Changes from all commits
3f92cfe
d8c26dc
c71e8bb
008ddad
c9290e1
f5a5db9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1179,7 +1179,7 @@ def run_expect(): | |
| retry += 1 | ||
| time.sleep(1) | ||
|
|
||
| return result.stdout_lines[-1].strip() | ||
| return result.stdout_lines[-2].strip() | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The output of the for line in result.stdout_lines:
if line.strip().startswith("Passkey mapping:"):
return line.strip()
raise AssertionError("Passkey mapping not found in ipa command output") |
||
|
|
||
| def iduseroverride(self) -> IDUserOverride: | ||
| """ | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -417,6 +417,7 @@ def passkey_with_output( | |||||||||||||||||
| ) -> tuple[int, int, str, str]: | ||||||||||||||||||
| """wrapper for passkey_with_output methods""" | ||||||||||||||||||
| if "virt_type" in kwargs and kwargs["virt_type"] == "vfido": | ||||||||||||||||||
| del kwargs["virt_type"] | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Deleting
Suggested change
|
||||||||||||||||||
| return self.vfido_passkey_with_output(**kwargs) | ||||||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||||||||||||||||||
| else: | ||||||||||||||||||
| return self.umockdev_passkey_with_output(**kwargs) | ||||||||||||||||||
|
|
@@ -427,6 +428,7 @@ def passkey( | |||||||||||||||||
| ) -> bool: | ||||||||||||||||||
| """wrapper for passkey methods""" | ||||||||||||||||||
| if "virt_type" in kwargs and kwargs["virt_type"] == "vfido": | ||||||||||||||||||
| del kwargs["virt_type"] | ||||||||||||||||||
| return self.vfido_passkey(**kwargs) | ||||||||||||||||||
|
Comment on lines
+431
to
432
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Similar to the
Suggested change
|
||||||||||||||||||
| else: | ||||||||||||||||||
| return self.umockdev_passkey(**kwargs) | ||||||||||||||||||
|
|
@@ -690,12 +692,15 @@ def vfido_passkey_with_output( | |||||||||||||||||
| """ | ||||||||||||||||||
|
|
||||||||||||||||||
| match auth_method: | ||||||||||||||||||
| case PasskeyAuthenticationUseCases.PASSKEY_PIN | PasskeyAuthenticationUseCases.PASSKEY_PIN_AND_PROMPTS: | ||||||||||||||||||
| case ( | ||||||||||||||||||
| PasskeyAuthenticationUseCases.PASSKEY_PIN | ||||||||||||||||||
| | PasskeyAuthenticationUseCases.PASSKEY_PIN_AND_PROMPTS | ||||||||||||||||||
| | PasskeyAuthenticationUseCases.PASSKEY_FALLBACK_TO_PASSWORD | ||||||||||||||||||
| ): | ||||||||||||||||||
| if pin is None: | ||||||||||||||||||
| raise ValueError(f"PIN is required for {str(auth_method)}") | ||||||||||||||||||
| case ( | ||||||||||||||||||
| PasskeyAuthenticationUseCases.PASSKEY_PROMPTS_NO_PIN | ||||||||||||||||||
| | PasskeyAuthenticationUseCases.PASSKEY_FALLBACK_TO_PASSWORD | ||||||||||||||||||
| | PasskeyAuthenticationUseCases.PASSKEY_NO_PIN_NO_PROMPTS | ||||||||||||||||||
| ): | ||||||||||||||||||
| if pin is not None: | ||||||||||||||||||
|
|
@@ -738,71 +743,68 @@ def vfido_passkey_with_output( | |||||||||||||||||
| spawn "{run_su}" | ||||||||||||||||||
| set ID_su $spawn_id | ||||||||||||||||||
|
|
||||||||||||||||||
| # If the authentication method set without entering the PIN, it will directly ask | ||||||||||||||||||
| # prompt, if we set prompting options in sssd.conf it will ask interactive and touch prompt. | ||||||||||||||||||
|
|
||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_NO_PIN_NO_PROMPTS}") | ||||||||||||||||||
| || ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PROMPTS_NO_PIN}") }} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{interactive_prompt}*" {{ send -i $ID_su "\n" }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 201 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 202 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
| # If prompt options are set | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PROMPTS_NO_PIN}") }} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{touch_prompt}*" {{ }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 203 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 204 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
| }} | ||||||||||||||||||
| # Phase 1: all methods start with interactive prompt | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{interactive_prompt}*" {{ send -i $ID_su "\n" }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 201 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 202 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
|
||||||||||||||||||
| # If authentication method set with PIN, after interactive prompt always ask to Enter the PIN. | ||||||||||||||||||
| # If PIN is correct with prompt options in sssd.conf it will ask interactive and touch prompt. | ||||||||||||||||||
| # If we press Enter key for PIN, sssd will fallback to next auth method, here it will ask | ||||||||||||||||||
| # for Password. | ||||||||||||||||||
|
|
||||||||||||||||||
| # Phase 2: PIN-based methods need PIN prompt | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PIN}") | ||||||||||||||||||
| || ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PIN_AND_PROMPTS}") | ||||||||||||||||||
| || ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_FALLBACK_TO_PASSWORD}")}} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{interactive_prompt}*" {{ send -i $ID_su "\n" }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 205 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 206 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "Enter PIN:*" {{send -i $ID_su "{pin}\r"}} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 207}} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 208}} | ||||||||||||||||||
| }} | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_FALLBACK_TO_PASSWORD}") }} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "Password:*" {{send -i $ID_su "Secret123\r"}} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 209}} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 210}} | ||||||||||||||||||
| }} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
|
||||||||||||||||||
| # Password fallback method needs password prompt | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_FALLBACK_TO_PASSWORD}") }} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "Password:*" {{send -i $ID_su "Secret123\r"}} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 209}} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 210}} | ||||||||||||||||||
| }} | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PIN_AND_PROMPTS}") }} {{ | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{touch_prompt}*" {{ }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 211 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 212 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
|
||||||||||||||||||
| # Phase 3: handle touch prompts (for methods that show them) | ||||||||||||||||||
| if {{ ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PROMPTS_NO_PIN}") | ||||||||||||||||||
| || ($auth_method eq "{PasskeyAuthenticationUseCases.PASSKEY_PIN_AND_PROMPTS}") }} {{ | ||||||||||||||||||
| # Wait for touch prompt to appear and acknowledge it | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "{touch_prompt}*" {{ | ||||||||||||||||||
| # Touch prompt appeared - send Enter to acknowledge it | ||||||||||||||||||
| send -i $ID_su "\n" | ||||||||||||||||||
| }} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 203 }} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Unexpected end of file" 204 }} | ||||||||||||||||||
| }} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
|
||||||||||||||||||
| # Now simulate touch on vfido device | ||||||||||||||||||
| # Phase 4: Device touch | ||||||||||||||||||
| spawn {test_venv_bin}/vfido_touch | ||||||||||||||||||
| set ID_touch $spawn_id | ||||||||||||||||||
|
|
||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "Authentication failure" {{exitmsg "Authentication failure" 1}} | ||||||||||||||||||
| -i $ID_su eof {{exitmsg "Passkey authentication successful" 0}} | ||||||||||||||||||
| -i $ID_su timeout {{exitmsg "Unexpected output" 213}} | ||||||||||||||||||
| -i $ID_touch eof {{}} | ||||||||||||||||||
| -i $ID_touch timeout {{}} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
Comment on lines
791
to
794
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The
Suggested change
|
||||||||||||||||||
|
|
||||||||||||||||||
| expect -i $ID_touch eof | ||||||||||||||||||
| # Phase 5: Wait for authentication completion | ||||||||||||||||||
| expect {{ | ||||||||||||||||||
| -i $ID_su -re "Authentication failure" {{ | ||||||||||||||||||
| exitmsg "Authentication failure" 1 | ||||||||||||||||||
| }} | ||||||||||||||||||
| -i $ID_su eof {{ | ||||||||||||||||||
| exitmsg "Passkey authentication successful" 0 | ||||||||||||||||||
| }} | ||||||||||||||||||
| -i $ID_su timeout {{ | ||||||||||||||||||
| exitmsg "Unexpected output" 213 | ||||||||||||||||||
| }} | ||||||||||||||||||
| }} | ||||||||||||||||||
|
|
||||||||||||||||||
| exitmsg "Unexpected code path" 220 | ||||||||||||||||||
| """, | ||||||||||||||||||
|
|
||||||||||||||||||
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.
For consistency with the feature detection logic in
sssd_test_framework/hosts/client.py, it would be better to grep forvhci_hcdinstead of justvhci. This makes the verification step more specific and aligned with the actual kernel module name.